Skip to main content
Back to Category

Server Reinstall: OS Reinstall Step-by-Step Guide

When to reinstall your server OS, pre-reinstall backup checklist, REXE control panel OS reinstall steps, and post-installation configuration guide for Linux servers.

Read time: 13 min Server Management
reinstallos installserver reinstallbackuplinuxserverrexe panel

Table of Contents

Server Reinstall: OS Reinstall Step-by-Step Guide

Server reinstallation (OS reinstall) is the process of installing the operating system from scratch, returning the server to a clean state. This is used to resolve serious system issues, switch to a different operating system, or bring the server to a clean starting point. This guide covers when to reinstall, how to prepare, and the steps through the REXE control panel.

When is Reinstallation Necessary?

Consider reinstallation in these situations:

Mandatory Cases

  • Server was hacked: Malware or rootkit detected
  • Critical system files corrupted: System won't boot or keeps crashing
  • Unrecoverable configuration error: System became inaccessible
  • Ransomware attack: Files were encrypted

Preferred Cases

  • You want to switch to a different Linux distribution
  • You're handing the server over to someone else (clean handover)
  • You want to clean up long-accumulated issues
  • You want to reset a test environment

Reinstallation deletes ALL data on the disk. This action cannot be undone. Always take a backup before proceeding.

Pre-Reinstall Backup Checklist

Before starting reinstallation, back up the following data:

1. Website and Application Files

hljs bash
# Backup web files
tar -czf /tmp/www-backup-$(date +%Y%m%d).tar.gz /var/www/

# Backup application directory
tar -czf /tmp/app-backup-$(date +%Y%m%d).tar.gz /opt/myapp/

# Transfer backups to remote server
rsync -avz /tmp/*-backup-*.tar.gz user@backup-server:/backup/

2. Database Backups

hljs bash
# MySQL/MariaDB all databases
mysqldump --all-databases -u root -p > /tmp/all-databases-$(date +%Y%m%d).sql

# Specific database
mysqldump -u root -p mydb > /tmp/mydb-$(date +%Y%m%d).sql

# PostgreSQL
pg_dumpall -U postgres > /tmp/postgres-all-$(date +%Y%m%d).sql

# Compress backups
gzip /tmp/*.sql

3. Configuration Files

hljs bash
# Nginx configuration
tar -czf /tmp/nginx-config-$(date +%Y%m%d).tar.gz /etc/nginx/

# Apache configuration
tar -czf /tmp/apache-config-$(date +%Y%m%d).tar.gz /etc/apache2/

# SSH configuration and keys
tar -czf /tmp/ssh-config-$(date +%Y%m%d).tar.gz /etc/ssh/ /root/.ssh/

# Crontab
crontab -l > /tmp/crontab-backup-$(date +%Y%m%d).txt

# Full /etc directory
tar -czf /tmp/etc-backup-$(date +%Y%m%d).tar.gz /etc/

4. SSL Certificates

hljs bash
# Let's Encrypt certificates
tar -czf /tmp/letsencrypt-$(date +%Y%m%d).tar.gz /etc/letsencrypt/

# Custom certificates
tar -czf /tmp/ssl-certs-$(date +%Y%m%d).tar.gz /etc/ssl/

5. User Data and Home Directories

hljs bash
# All user home directories
tar -czf /tmp/home-backup-$(date +%Y%m%d).tar.gz /home/

# User list
cat /etc/passwd > /tmp/users-list.txt
cat /etc/group > /tmp/groups-list.txt

6. Installed Package List

hljs bash
# Ubuntu/Debian
dpkg --get-selections > /tmp/installed-packages.txt

# RHEL/CentOS/AlmaLinux
rpm -qa > /tmp/installed-packages.txt

Backup Verification

hljs bash
# List backup files and check sizes
ls -lh /tmp/*-backup-*.tar.gz

# Verify archive contents
tar -tzf /tmp/www-backup-*.tar.gz | head -20

# Verify backups reached remote server
rsync -avz --dry-run /tmp/*-backup-*.tar.gz user@backup-server:/backup/

OS Reinstall via REXE Control Panel

Step 1: Log into Control Panel

  1. Go to panel.rexe.tr
  2. Log in with your username and password
  3. Navigate to My Servers in the left menu
  4. Select the server you want to reinstall

Step 2: Initiate Reinstall

  1. On the server detail page, click the Actions or Management tab
  2. Find the Reinstall Operating System (OS Reinstall) option
  3. Read the warning message and confirm

Step 3: Select Operating System

Available options typically include:

  • Ubuntu 22.04 LTS (recommended)
  • Ubuntu 20.04 LTS
  • Debian 12
  • Debian 11
  • AlmaLinux 9
  • CentOS Stream 9
  • Windows Server (if available)

Step 4: Installation Parameters

- Operating System: Ubuntu 22.04 LTS
- Hostname: server-name.domain.com
- Root Password: [set a strong password]
- SSH Key: [add if available]

The reinstall process typically takes 5-15 minutes. The server will be inaccessible during this time. You'll receive an email notification when complete.

Step 5: Confirm Installation

  1. Review all parameters
  2. Click Confirm and Start
  3. The process begins and progress is shown in the panel

Post-Installation Configuration Checklist

After the server is reinstalled:

1. First Connection and Security

hljs bash
# Connect via SSH
ssh root@server-ip

# Update the system
apt update && apt upgrade -y

# Create a new user (don't work as root)
adduser newuser
usermod -aG sudo newuser

# Secure SSH configuration
nano /etc/ssh/sshd_config
# PermitRootLogin no
# PasswordAuthentication no (if using SSH keys)

systemctl restart sshd

2. Firewall Configuration

hljs bash
# Install and configure UFW
apt install ufw -y
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable

3. Install Essential Software

hljs bash
# Essential tools
apt install -y curl wget git vim htop net-tools unzip

# Set timezone
timedatectl set-timezone UTC

# Enable NTP
timedatectl set-ntp true

4. Restore from Backups

hljs bash
# Transfer backups to server
rsync -avz user@backup-server:/backup/ /tmp/restore/

# Restore web files
tar -xzf /tmp/restore/www-backup-*.tar.gz -C /

# Restore database
mysql -u root -p < /tmp/restore/all-databases-*.sql

# Restore Nginx configuration
tar -xzf /tmp/restore/nginx-config-*.tar.gz -C /
nginx -t && systemctl restart nginx

# Restore SSL certificates
tar -xzf /tmp/restore/letsencrypt-*.tar.gz -C /

5. Service Verification

hljs bash
# Check all service statuses
systemctl list-units --type=service --state=running

# Web server
curl -I http://localhost

# Database
mysql -u root -p -e "SHOW DATABASES;"

# Firewall
ufw status verbose

Within the first 24 hours after installation, verify all services are working correctly. Especially check SSL certificate validity and auto-renewal settings.

Conclusion

Server reinstallation is a smooth process when properly prepared. With comprehensive backups, careful installation parameter selection, and systematic post-installation configuration, you can quickly restore your server to its previous state. The REXE control panel makes this process achievable in just a few clicks.