Preface: With the holidays approaching, many friends with idle devices at home want to try setting up a Minecraft server but don't know where to start. This article introduces the deployment process centered around PVE-Debian-MCSM.
What is PVE?
PVE (Proxmox Virtual Environment) is an open-source and free virtualization environment platform that supports both KVM virtual machines and LXC containers. It is developed based on Debian and KVM technology and can run Linux, OpenWRT, Windows, etc., on a single PC or server, achieving an integrated solution for computing, networking, and storage, known as "all in one." Similar platforms include ESXi, Unraid, etc.
What is MCSM?
MCSManager Panel (abbreviated as MCSM Panel) is a fully Chinese, lightweight, out-of-the-box, multi-instance, and Docker-supported Minecraft server management panel. This software has gained a certain level of popularity within the Minecraft and other gaming communities. It helps you centrally manage multiple physical servers, dynamically create game servers on any host, and provides a secure and reliable multi-user permission system, making it easy to manage multiple servers.
Specific Steps: Install PVE and optimize, create a virtual machine and install Debian, install the MCSM interface and create instances, configure network services.
Preparation Work:
- PVE image, recommended to use version 7.4 https://www.proxmox.com/en/downloads
- Debian image: https://mirrors.tuna.tsinghua.edu.cn/debian/dists/ (DVD version is not recommended as it may cause strange issues.)
- Our old friend Rufus: https://www.423down.com/10080.html
- Purpur1.19 server: https://purpurmc.org/
- MC launcher HMCL: https://hmcl.huangyuhui.net/
- Zerotier client: https://www.zerotier.com/download/
- Install PVE and optimize
- Write the downloaded image to a USB drive using Rufus.
- Insert the USB drive into the target host and enter the BIOS-boot settings to adjust the boot order. Here I am using a second-hand Inspur server with an X99 motherboard, a mining power supply, and a 128G SSD. Note: Most server motherboards have a chassis intrusion detection mechanism, and you need to find specific pins in the manual and cover them with a conductive cap; otherwise, it won't boot.
- Enter the installation interface and select install;
Then run the code and enter the following interface, agree to the agreement:
Set the hard disk and file type, you can choose ext4 or btrfs;
Choose the country and region, here you need to type China;
Then set the password and email, the email can be filled in randomly:
Then set up the network connection; just plug in the network cable to get the address; set the hostname and note down the internal IP address;
After checking everything is correct, start the installation:
After the installation is complete, reboot.
4. Open the PVE address in a browser, after entering the system, we need to change the source for PVE. First, remove (backup) the original official source of PVE (rename sources.list to sources.list.bak)
mv /etc/apt/sources.list /etc/apt/sources.list.bak
Add domestic Debian software sources:
nano /etc/apt/sources.list
Change to
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib
Edit the file pve-no-subscription.list#
nano /etc/apt/sources.list.d/pve-no-subscription.list
The content is as follows:#
deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm pve-no-subscription
Disable the PVE enterprise source:
nano /etc/apt/sources.list.d/pve-enterprise.list
Comment out the following line (add a hash at the front):
#deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bookworm pve-no-subscription
Update test:
apt-get update
- Create a new virtual machine and install Debian
- Find local-btrfs (pve), and upload the downloaded Debian image in the ISO;
- Then create a virtual machine, select the Debian image, and set the number of CPU cores, hard disk, and memory size;
- After confirming all the way, boot into the command line interface to start the Debian installation. We choose graphical install:
- Choose the country and language, then automatically configure the network;
- Set the hostname, skip the domain name setting; set the root account name and password, ordinary user account name and password;
- Partition the disk; since it is a virtual machine, we choose to use the entire disk;
- Install the basic system, then enter the package manager and large component installation;
We choose the Tsinghua source, which is faster. Note: Debian installation defaults to enabling the security source, which is foreign and thus has a very slow download speed, so the configuration file needs to be modified. Here we use Ctrl+Alt+F2 to switch from the graphical interface to the tty command terminal, press Enter, and use the command nano /target/etc/apt/sources.list to change all sources to http://mirrors.ustc.edu.cn or Tsinghua source, then Ctrl+X to exit and save, Ctrl+Alt+F5 to return to the graphical interface.
Downloading will take some time; you can have a cup of tea first, then you will see the following interface:
Since it is a server, there is no need for a desktop environment:
Install the grub bootloader:
Then the installation is complete, reboot to enter the MCSM installation.
- Install MCSM and create instances
- Boot into the tty1 interface
- Install the JAVA environment; different versions of the game require different Java versions. Here we use version 1.19, which requires Java 18. Install wget and download Java 18
apt install wget && wget http://img.zeruns.tech/down/Java/OpenJDK18U-jre_x64_linux_hotspot_18.0.1_10.tar.gz
Create the installation directory
mkdir /usr/local/java/
Unzip the JDK compressed file in the current directory
tar -zxvf OpenJDK18U-jre_x64_linux_hotspot_18.0.1_10.tar.gz -C /usr/local/java/
Create a soft link to the environment variable
ln -sf /usr/local/java/jdk-18.0.1+10-jre/bin/java /usr/bin/java
Test if the installation is normal; if it shows openjdk version "18.0.1" 2022-04-19, then it is normal
java -version
3. Port development; the panel requires ports 23333 and 24444, and the default port for the game server is 25565. Open them in the PVE firewall. If it still doesn't work, execute the following commands:
systemctl stop firewalld
systemctl disable firewalld
service iptables stop
to turn off the firewall.
4. Install the panel; here we use a one-click installation command (note that this script is only suitable for AMD64 architecture)
wget -qO- https://gitee.com/mcsmanager/script/raw/master/setup.sh | bash
After execution, use systemctl start mcsm-{web,daemon} to start the panel service. Use systemctl enable mcsm-{daemon,web}.service to enable it to start on boot.
5. Open the address in the browser with the 23333 port suffix to see the panel; the account is root, and the password is 123456.
6. Create a new instance, upload the Purpur1.19 server, set the name, and then start the instance
- Then we can set the game's related options in the configuration file, such as disabling the official verification, etc.
- Great job! At this point, open the HMCL launcher to join the game.
- Configure the online network
- At this point, don't forget that you need to play with your friends. If you have a public fixed IPv4 or IPv6 at home, just enter the connection; if you don't have a public IP, you will need to perform NAT traversal or DDNS. Here is a tool called Zerotier.
- First, register and create a private network at https://www.zerotier.com/;
- First, install curl command support in the virtual machine
apt-get install curl - Install the gnupg asymmetric encryption system, which is essential software for communication
apt-get install gnupg - Install ZeroTier
curl -s https://install.zerotier.com/ | bash
After successful installation, the prompt is as follows:
Success! You are ZeroTier address [ xxxxxxxxx ].
The address in brackets is similar to a MAC address. - Set it to start on boot (execute the following commands separately)
systemctl start zerotier-one.service
systemctl enable zerotier-one.service - Join your private network
zerotier-cli join xxxxxxxxx - Great job! Now just let your friends download the Zerotier client and join the same private network to play together happily!
Postscript: Some optimizations for PVE:
https://blog.vvusu.com/article/pve-install
https://www.cnblogs.com/jimaojin/p/12378201.html