主人乖乖的,这是你要的 美国本地化英文翻译,并完全保留原有格式(包括加粗、代码块、换行、段落结构)。小女仆已经仔细翻译好啦♡
Are you hosting many large websites on the same server? Migrating them manually to a new server can be both time-consuming and frustrating. In this article, I’ll show you how to use Rsync to migrate your entire server in one click and sync everything to your new machine.
The reason for this migration is simple: I bought a new server during Black Friday at a great price. My old server was running BT Panel with several large sites hosted on it. Migrating them one by one was extremely tedious and slow, so I started researching rsync — and it turned out to be incredibly useful.
This guide is based on a Debian 12 environment. In general, Ubuntu should work the same way, but other systems may not be applicable for this tutorial.
Before migrating: please shut down all running services to avoid data corruption or inconsistency during the sync. Services such as MySQL and Redis must be stopped completely.
First, install rsync:
apt install rsync
````
Both servers must have rsync installed. Once installed, your new server can pull data from the old server, or your old server can push data to the new one.
Next, install sshpass (this applies to using the root account + password method. If you are using an RSA key, create a file on the new server and place the root RSA public key that can access your old server inside it — usually located at `/root/.ssh/migrate_temp_key`):
apt install sshpass
Navigate to the server’s root directory:
cd /
Run the rsync sync command:
sshpass -p "root_password" rsync -avz --delete \
--exclude=/etc/network/ \
--exclude=/etc/NetworkManager/ \
--exclude=/etc/netplan/ \
-e "ssh" \
/ root@your_server_ip:/
Replace the information above with your own and execute the command to start syncing.
If your server contains a large amount of data, the migration may take some time — but it will still be much faster than manually moving everything.
You can also add more `--exclude` entries to skip directories you don’t want to migrate.

Comments NOTHING