Sometimes the fastest fix for a messy or compromised server is a clean operating system install. Most VPS control panels have a Reinstall OS function that wipes the disk and installs a fresh image in minutes. Here’s when to use it, what to save first, and how to get the new system running safely.
When a reinstall makes sense
- The server was compromised. Cleaning a hacked system is unreliable. A fresh install plus restored data is the safe route. See server security monitoring.
- Switching operating systems (for example from CentOS to Debian or AlmaLinux, or Linux to Windows).
- Major version upgrades that are risky in place (for example an end-of-life distribution). See CentOS 7 migration.
- Experiments gone wrong, or you want a clean slate for a new project.
- Broken package databases, bootloaders or system libraries that would take longer to repair than to rebuild.
It doesn’t fix network routing problems, provider-side issues, or an undersized plan.
Warning: a reinstall erases the disk
Everything on the VPS (files, databases, configs, users) is deleted. Back up first.
Before you reinstall: checklist
- Back up data off the server:
- databases:
mysqldump,pg_dump. See mysqldump and pg_dump; - website and app files, uploads, Docker volumes. See Docker volume backups;
- copy them to your computer or a backup server:
rsync -avz root@server:/backups/ ./backups/.
- databases:
- Save configuration:
/etc/nginx,/etc/php,/etc/letsencrypt, crontabs (crontab -l), systemd units,.envfiles, firewall rules. - Note installed software and versions (
dpkg -l,docker ps), so you can rebuild the same stack. - For a compromised server: back up data only (content, database dumps), not binaries or configs that might be tampered with. Scan restored data before using it.
- Make sure you’ll be able to log in afterwards: know how the new root password or SSH key is set by the panel.
Choose the operating system
| OS | Good for |
|---|---|
| Ubuntu 24.04 / 22.04 LTS | Most tutorials, widest software support. See Ubuntu VPS |
| Debian 12 / 11 | Stable, minimal, long-lived servers. See Debian VPS |
| AlmaLinux 8/9 (on USA plans at VPS.DO) | RHEL-compatible environments |
| CentOS Stream 9 | RHEL upstream testing. See CentOS VPS |
| Windows Server | .NET, RDP desktop apps, trading platforms (needs a plan with at least 50 GB of disk). See Windows VPS |
Prefer a current LTS release for production. See Ubuntu vs Debian for servers.
Reinstall from the control panel
The exact labels vary by panel, but the steps are the same:
- Log in to the client area, and open your VPS’s control panel.
- Choose Reinstall (or “Rebuild” / “OS Reinstall”).
- Select the OS image and version.
- Set the new root password (and SSH key if offered), and confirm that you understand the data will be erased.
- Wait for the reinstall to finish (usually a few minutes), then connect.
If SSH doesn’t connect right away, use the VNC console in the panel to check boot progress. See VPS VNC console.
SSH host key warning: after a reinstall, the server has new host keys, so your SSH client warns about a changed key. Remove the old entry:
ssh-keygen -R your-server-ip
First-boot setup
apt update && apt full-upgrade -y # or dnf upgrade -y
adduser alice && usermod -aG sudo alice
# add your SSH key for alice, then disable root and password logins
Then: firewall, Fail2ban, automatic security updates, timezone, swap if needed. See Linux server hardening checklist and swap file vs partition.
Automate this with cloud-init or an Ansible playbook, so the next rebuild takes minutes. See cloud-init explained and Ansible playbooks.
Restore your data
Reinstall the stack, restore databases and files, re-issue SSL certificates (or restore /etc/letsencrypt), recreate cron jobs, and test everything before pointing traffic back.
Quick reference
| Step | Action |
|---|---|
| Before | Back up data + configs off the server |
| Reinstall | Control panel → Reinstall → choose OS → set password |
| After | ssh-keygen -R <ip>, update, create sudo user, harden |
| Compromised server | Restore data only, not old binaries/configs |
| Speed up next time | cloud-init / Ansible |
Related: VPS root access and check the Linux version.