Quickly Reinstalling VPS OS: A Tutorial for Software Developers
As an engineer, you often work with various development, testing, and production environments. This script saves you a ton of time and effort in several scenarios
Rapid Environment Provisioning
You can quickly set up a fresh environment without needing to manually configure everything from scratch, which is perfect for spinning up new test servers or sandboxes.
Disaster Recovery
If an OS becomes corrupted or unstable, this script allows for a fast and clean reinstall, minimizing downtime.
OS Migration/Downgrade
You can easily switch your VPS to a different OS distribution (e.g., from Ubuntu to Debian) or even an older version to test compatibility with your applications.
Standardizing Environments
It helps ensure that all your VPS instances start from a consistent, known-good state, which is crucial for reproducibility in development and production.
Essentially, it automates a tedious and error-prone manual process, letting you focus on your code and applications instead of system administration tasks.
The repository provides a simple, one-click script that works on various Linux distributions. Here's a step-by-step guide
Log in to your VPS
Use SSH to connect to your server.
ssh user@your_vps_ip
Choose a Script
The repository has multiple scripts for different scenarios. The most common is the one-click reinstall script. You'll use wget to download and execute it in one command.
Run the Script
The basic command is structured as follows. You just need to choose the desired OS from the documentation.
wget --no-check-certificate -qO /dev/null https://moeclub.org/dd/v2/dd-v2.sh && bash dd-v2.sh -u user -p password -t type_of_os
wget --no-check-certificate -qO /dev/null
This downloads the script.
bash dd-v2.sh
This executes the script.
-u user, -p password
These are for setting up the new root user and password. Be sure to change user and password!
-t type_of_os
This is where you specify the OS image you want to install.
Let's say you want to reinstall your VPS with a fresh installation of Debian 12.
Find the OS Type
You'd check the bin456789/reinstall repository or a similar source to find the correct type identifier for Debian 12. Let's assume it's debian12.
Execute the Command
You would run this command on your VPS
wget --no-check-certificate -qO /dev/null https://moeclub.org/dd/v2/dd-v2.sh && bash dd-v2.sh -u my_new_user -p MySuperSecurePassw0rd -t debian12
After you run this, the script will download the Debian 12 image and begin the reinstallation process. Your SSH connection will likely be terminated, and your VPS will reboot into the new OS.