Aliyun account purchase: Aliyun server reloading system full-step teaching
Reinstalling the server system is commonplace for many operations and development, but for novices or people who haven't touched the server for a long time, they often beat the drum in their hearts. What I fear most is that the data is lost, the environment is mismatched, or the connection cannot be completed after reloading.
This tutorial gets straight to the point, does not beat around the bush, and takes you to use the safest and fastest method to reinstall the Aliyun server (ECS) cleanly. Whether you want to switch from Windows to Linux, or if the system crashes and wants to reset, just read this article.
Core Pit-Avoidance Principle (Must Read Before Doing)
Before clicking any button, say it three times:
Data is priceless.
Alibaba Cloud's "replacement operating system" is essentially
Format the system disk
.
System disk (C disk // dev/vda1): All data, installed software and configured environment will disappear completely. If there is important data, it must be backed up locally in advance, or in the snapshot we will talk about later.
Data disk (D disk // dev/vdb): If you buy a data disk separately, the reload system will not move the data of the data disk by default. However, in order to be safe, do not check "Initialize Data Disk" during operation ".
Alibaba Cloud account purchase
Public IP: Reloading the system will not change your public IP address. Don't worry about this.
Stage 1: Preparation (10 minutes)
The troops are not moved, the food and fodder go first. Make preparations so that you can have a 100% retreat when you encounter an accident later.
1. Backup data (the most important step)
If the server can still log in, put the key database (
MySQL dump
Export), website source code, configuration files (such as Nginx's
nginx.conf
) to download locally.
If the server has crashed or cannot be connected, look directly at the next step.
2. Take a snapshot (buy a regret medicine)
Aliyun's "snapshot" function is to make a mirror image of the server disk. in case something is forgotten to be backed up after reloading, it can also be read out through the snapshot.
Log on to the Alibaba Cloud console and go to the ECS management page.
In the left-side navigation pane, click Storage and Snapshots-> Cloud Disk.
Find the system disk of your server (usually the capacity is about 20G-40G, and the attribute is the system disk).
On the right, click Create Snapshot, name it (e. g. 20260602-Backup Before Reloading), and click OK.
In the snapshot list on the left, wait until the progress reaches 100 percent before proceeding.
Phase 2: Stop the server (2 minutes)
A server that is running (Running) cannot reinstall the system, we need to let it "sleep" first ".
On the ECS instance list page, find the server you want to reinstall.
If the status is "Running", click Stop under Remote Connection on the right (or click in the Actions column
instance state-> stop).
Select Stop Method: Normal Stop is recommended. If the card does not respond, then choose forced stop.
Wait for about 1 minute until the instance status shows as Stopped.
Phase 3: Replace the operating system (core step, 5 minutes)
This step is the core of the whole process, staring at the screen, don't choose the wrong option.
In the Actions column on the right of the stopped server, click Manage (or click the instance ID to go to the details page).
In the basic information area, find the cloud disk or the cloud disk and mirror module.
See the column of the system disk, there will be a button to change the operating system on the right (sometimes hidden in the "more" or "cloud disk operation" drop-down menu), click it.
At this point, a security prompt will pop up to tell you that the data will be cleared. After confirmation, click OK to replace the operating system.
Key parameter configuration guide:
After entering the replacement system page, you will see several forms that need to be filled in. Select according to the following suggestions:
① Mirror type
public image (recommended): the pure version of the system provided by alibaba cloud. No messy pre-installed software, the most secure.
Custom mirror/shared mirror: If you have made a backup mirror yourself before, or others have shared it with you, choose this one.
Mirror Market: Integrated environment (such as pagoda panel, LAMP environment) is pre-installed inside. If you are a pure novice, you can choose to save trouble, but in the long run, public mirroring is more stable.
② Operating system version selection
Choose according to your business needs:
Linux (recommended, lightweight, memory-saving):Alibaba Cloud Linux: Alibaba Cloud's own optimized system has the best compatibility with ECS hardware. If it is an enterprise production environment, it is strongly recommended to choose this (long support cycle). Ubuntu: Favorite by Internet companies and developers, with many tutorials and good ecology. It is recommended to choose 22.04 LTS or 24.04 LTS (with LTS is the long-term support version, stable). CentOS: Attention! CentOS has officially stopped maintenance. If it is not an old project must be used, don't choose.
Windows Server: If you must use it, we recommend that you select Windows Server 2022 Datacenter Edition. Ordinary servers (2 cores and less than 4G) will Windows very hard and consume memory.
③ Security settings (login credentials)
Alibaba Cloud account purchase:
How do you connect to the server after reloading? Here's the key.
Custom password (most commonly used): Set a complex password directly. Linux default user name: rootWindows default user name: administrator password requirements: uppercase and lowercase alphanumeric special symbol, length greater than 10 characters. Don't use it too simply, now the robot that sweeps the weak password online can target you in a few seconds.
Key pair (strongly recommended for Linux):
If you can use SSH key, choose this one 100 times safer than password, and log in directly without secret, thus eliminating the risk of violent cracking.
④ Storage (data disk processing)
System disk: keep it as it is, or upgrade the capacity by the way (it can only be increased but not reduced).
Data disk: If your server has a data disk mounted, there is an option to "initialize data disk". Do not check! As long as you don't check it, after reinstalling the system, the contents of the data disk will still be there and can be used after remounting it.
After checking that all configurations are correct, check the "Cloud Server Service Terms" at the bottom and click Confirm Replacement.
At this time, the system will enter the "replacement" state, which usually takes 2 to 5 minutes. You can pick up a glass of water and pack it when you come back.
The fourth stage: inspection and first connection after reloading (5 minutes)
When the instance state changes back
Running
, indicating that the system has been full of blood resurrection. Next do these things:
1. Try to connect for the first time
Linux users: Open your local terminal (Mac/Linux) or shell tool (Windows can use Xshell, Tabby, Putty). Enter the command: Bashssh root @ your server public network IP and enter the complex password you just set. If prompted "Are you sure you want to continue connecting", enter yes.
Windows the user: Press the shortcut key Win R and enter mstsc to open the remote desktop connection. Enter your public network IP, fill in the Administrator user name, and then enter the password to connect.
2. If you can't connect? Check the security group (common pit)
Many people found that they could not connect to the server after reloading, 90% of which was due to Aliyun's
Security group
The corresponding port is not released.
On the ECS instance details page, click Security Groups.
Click Inbound Rules.
Check for the following ports: Linux: Port 22 (SSH protocol) must be released. Windows: The 3389 port (RDP protocol) must be released.
If not, click Add Manually, select the corresponding protocol (or directly select SSH / RDP template), set the source address to 0.0.0.0/0 (allow everyone to connect, if you have a fixed IP, you 'd better fill in your own IP), and save.
Phase 5: The final work of the new system
After entering the new system, don't rush to dress the software. Doing these two things first can save a lot of trouble in the future.
For Linux systems (using Ubuntu/Alibaba Cloud Linux as an example):
1. Update system software package patch
The newly installed system may have some security vulnerabilities. First, update it as a whole:
Bash
# Ubuntu
/Debian system
sudo apt update && sudo apt upgrade -y
# Alibaba Cloud Linux / CentOS / RHEL systems
sudo yum update -y
2. Re-mount the data disk (if you have one)
After reinstalling the system, Linux will not automatically help you mount the previous data disk.
Run
df -h
Found the data disk missing? Don't panic, it's just not "open".
Run fdisk -l to see if there is a disk like/dev/vdb.
Create a mount point (for example, you want to put it in the/data directory):Bashmkdir /data
Mount it (note: never run the mkfs format command, mount it directly!) :Bashmount /dev/vdb /data
Enter/data to see if the previous data is lying intact?
Remember to write the mount information into/etc/fstab, otherwise the next time the server restarts, this disk will not be seen again.
For Windows systems:
Open the server manager and turn off "IE Enhanced Security Configuration" (otherwise any software you download with your own browser will be blocked by a pop-up window and crash).
Open This PC-> Manage-> Disk Management ".
Alibaba Cloud account purchase
If there is a data disk, you will see a "online" or "unassigned drive letter" disk, right-click it, select online and assign a drive letter (such as D disk), and all the previous data will be returned.
Summary
The Alibaba Cloud server reloading system actually has four core actions:
Backup-> Stop-> Replace-> Check
.
As long as you do not shake your hands to check "Initialize Data Disk" and take a snapshot of the system disk in advance, the whole process is 100% safe. If the new system collapses, the big deal is to use the snapshot just created to "restore to the state before reloading" with one click, with extremely low trial and error costs.

