The main task of this migration was to move a server running MCSManager from one Debian server to another new Debian server. Specifically, it involved the following:
- Minecraft Servers: Including three server instances:
- Velocity proxy server
- Purpur login server
- Leaves survival server
- Bot Services:
- Bots based on the Nonebot / Koishi framework using the OneBot v11 protocol
- Bots using the official QQ interface
Optimizations were also made to the new server, including installing the 1Panel panel, setting up the Zsh terminal, and introducing the plugin manager Zinit.
This migration was not just a copy of the base environment, but also an iteration of the technology stack~
Data Migration
Using rsync to Improve Transfer Efficiency
During the migration, I initially tried using scp for data transfer, but found the speed unsatisfactory. Therefore, I switched to rsync, which supports incremental synchronization and displays transfer progress, while also offering better transfer efficiency and flexibility.
The full command executed was:
rsync -avz --progress --exclude="Config/" ***@192.168.*.*:/opt/mcsmanager/daemon/data/ /opt/mcsmanager/daemon/data/
-a: Archive mode, preserving file permissions, timestamps, and other metadata.-v: Verbose output.-z: Compress data during transfer.--progress: Show transfer progress.--exclude="Config/": Exclude specific directories.
With this command, I achieved data synchronization from the old server to the new one, a process that was stable and efficient. Moreover, rsync's incremental update feature is ideal for scenarios requiring multiple debugging attempts during migration, significantly reducing the time spent on transferring duplicate data.
Installing and Using 1Panel
What is 1Panel
1Panel is a modern open-source Linux operations management panel designed to improve server management efficiency by simplifying operations. It offers the following key advantages:
- Efficient Management: Provides host monitoring, file management, database management, and more through a web graphical interface.
- Rapid Site Setup: Deeply integrates open-source site building tools like WordPress and Halo, supporting one-click domain binding and SSL configuration.
- App Store: Offers a rich selection of high-quality open-source tools and applications, allowing for quick installation and upgrades.
- Security and Reliability: Includes a built-in firewall and log auditing to enhance system security, while using container technology to reduce vulnerability exposure.
- One-Click Backup: Supports backup to local or cloud storage, making data security easy to achieve.
Installation Steps
Installing 1Panel is very straightforward, using the following command:
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && bash quick_start.sh
Migration
- MariaDB
- phpMyAdmin
- Koishi
- Qinglong
- DDNS-Go
- Uptime-Kuma
- Alist
- Redis
Migrating these was particularly simple, essentially just using rsync to transfer the contents of /opt/1panel/apps one by one.
If you're feeling too lazy, I suggest directly migrating the entire /opt/1panel directory. It's tested and works (:
If you're interested in any of these migrations, please leave a comment. Maybe I'll write another article about it~
Configuring the Zsh Terminal
Why Zinit
When configuring the terminal for the new server, I chose Zinit as the Zsh plugin manager instead of the more common Oh My Zsh. The reason is Zinit's lightweight nature and high performance. Compared to Oh My Zsh, Zinit loads plugins much faster and doesn't affect terminal startup time.
Zinit can be thought of as the "vim-plug" for Zsh, while Oh My Zsh is more like a complete framework (similar to SpaceVim). This lightweight characteristic allows me to flexibly customize the terminal environment as needed, without introducing unnecessary redundant features.
Installing Zsh
First, I installed Zsh using the following command:
apt install zsh
Installing Zinit
Next, I ran the following command to install Zinit:
bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)"
After installation, I added the following configuration to the .zshrc file to load commonly used plugins (just add them! They will be downloaded automatically):
# The four great Zsh plugins
zinit light zsh-users/zsh-completions
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-history-substring-search
zinit light zdharma-continuum/fast-syntax-highlighting
zinit light romkatv/powerlevel10k
# Oh My Zsh features
zinit snippet OMZ::lib/completion.zsh
zinit snippet OMZ::lib/history.zsh
zinit snippet OMZ::lib/key-bindings.zsh
zinit snippet OMZ::lib/theme-and-appearance.zsh
# Key bindings
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey ',' autosuggest-accept
# Other
zinit load djui/alias-tips
Detailed Plugin Functions
zsh-users/zsh-completions: Extends Zsh's auto-completion capabilities, supporting advanced completions for common tools (likegit,docker), improving input efficiency.zsh-users/zsh-autosuggestions: Provides real-time command suggestions based on history and context, reducing repetitive typing.zsh-users/zsh-history-substring-search: Allows quick searching of historical commands by substring, making history queries more convenient when combined with key bindings.zdharma-continuum/fast-syntax-highlighting: Implements command syntax highlighting, marking incorrect commands in red and correct ones in green, helping to quickly identify input errors.romkatv/powerlevel10k: A high-performance terminal theme that offers rich visual effects and information display (such as Git status, network status, etc.), and loads extremely fast.OMZ::lib/completion.zsh: Enhances Zsh's auto-completion, working together withzsh-completions.OMZ::lib/history.zsh: Optimizes Zsh history management, supporting persistence and quick recall.OMZ::lib/key-bindings.zsh: Provides more intuitive key binding functions, enhancing terminal interaction.OMZ::lib/theme-and-appearance.zsh: Controls Zsh's theme and appearance settings, working best when paired with Powerlevel10k.djui/alias-tips: Provides alias tips, for example, when typinggit status, it will prompt you with a defined alias (likegst).
Installing the x-cmd Tool
Introduction to x-cmd
After the migration was complete, I also tried installing the x-cmd tool. It is a lightweight tool written in POSIX Shell with the following features:
- No root privileges required: Comes with its own package manager, so it can run without superuser permissions.
- Modular design: Code is organized in modules (mods), offering high flexibility.
- Ready to use: Simple installation, ready for various operations scenarios.
Installation Steps
The command to install x-cmd is as follows:
eval "$(curl https://get.x-cmd.com)"
x-cmd's package management feature allows me to easily install standalone tools without relying on the system-level package manager or anything like that. It's just good to use!