Contents
Preface
After I set up the Trinitycore 3.3.5 World of Warcraft server, I was also thinking about what other game servers I could set up. After all, my blog "Game World" section cannot only have World of Warcraft. The name is so big, but the pattern is so small, it's too low. After some research, the Turnkey-gameserver solution caught my eye. It is basically a one-click setup, and there are more than 100 game servers to choose from. This article takes the setup of a Minecraft (bedrock edition) server as an example to demonstrate how to use the PVE LXC template to quickly build a game server.
A quick introduction to Turnkey linux: "Turnkey GNU/Linux is a free system image based on Debian that pre-integrates and polishes the best free software components into secure, easy-to-use solutions. TurnKey is inspired by a belief in the democratizing power of free software, which, like science, promotes the advancement of a free and humane society. Without the freedom to distribute, patch, and study free software, the Internet as we know it would cease to exist. Free software is the silent and often invisible force behind the greatest technological wonders of our time."
Simply put, Turnkey has deployed various excellent free software based on the Debian system and formed numerous ct templates. Users only need to use these ct templates to create a virtual machine, and they can immediately get a Debian-based LXC with relevant software deployed. This is as simple as deploying an application using docker.
In fact, in the PVE ct template, you can see a lot of turnkey-(software name) naming templates:
By using these ct templates to build LXC, you can immediately have a Linux container with the corresponding software deployed. This article will build a gameserver in this way.
Use ct template: Turnkey-gameserver to create LXC
Follow the steps below to create the gameserver LXC:
Click to create LXC.
Initialize gameserver
In PVE, select the gameserver linux container you just created, and log in to the terminal using root and the password you created earlier in the console interface on the right:
After logging in, you will directly enter the gameserver initialization interface, create a new account named "gameuser" and set a password for it:
After setting the password, enter the "Initialize Hub services" interface:
Here we mainly configure Turnkey's backup, migration, domain name management and other functions. If necessary, you need to provide an API key.https://hub.turnkeylinux.org/profileRegistration and a free AWS account are required. If you need it, just follow the prompts. This step is not necessary. You can select the Skip button below to skip and enter the system notification and security warning interface:
If you need to accept the notification, fill in your email address and select Enable below. Otherwise, you can directly select Skip and enter the security update interface:
If you need to install the security update immediately, select the Install button below to install it, otherwise select Skip. I chose Install. After installing the update, it is recommended to reboot:
After reboot, the terminal displays the following interface:
The two red boxes in the above picture show the IP address of this Linux container and the command to enter the advanced command line console.
confconsole
At this time, you can directly use the SSH client to directly access the IP address for management.
Installing the Game
GUI installation (not recommended, many problems)
Use an ssh client or the pve console to log in to the gameserver, then runconfconsole
Command to enter the game server application service interface, as shown below (if you choose skip in the last security update in the previous section, you will go directly to this interface):
The Web shell in the figure above is a web-based command line tool. Webmin can be understood as a panel tool (in my other article:Docker series builds a DNS server based on bind9Here we first select "Advanced menu" in the red box below to enter the advanced menu:
Select Game Server in the image above, then select Select below:
Select Select game in the image above, then select Select below:
The above picture indicates that some games may require some basic configuration such as server name. Just select OK below, and then you can finally enter the stage of choosing to install the game:
Because we are going to set up a Minecraft Bedrock Edition server this time, select 60, and then select OK below:
The installation is completed quickly:
Because gameserver installation must bind the game to a non-root account, when installing the game through gui, the system will bind the game to the gameuser account created during initialization and install the game to/home/gameuser/gameserver/
Directory, because this time is the installation of minecraft (bedrock edition), so the final path of the final execution program is/home/gameuser/gameserver/mcbserver
:
Note: Try not to use the GUI to install, as it seems more likely to go wrong. I also encountered the problem of incomplete installation files. The official recommended installation method is command line.
Command line installation
implementauto_install.sh
Command to install, as follows:
cd /root/gameservers ./auto_install.sh --list # to see which games can be installed
Then you can see the code (first column) corresponding to the game you need to install, as shown in the red box above, the code for Minecraft (bedrock edition) is mcb, then run the following command:
./auto_install.sh --game mcb --user gameuser --path /home/gameuser/gameserver/
--user gameuser
is to bind Minecraft to the user gameuser, --path /home/gameuser/gameserver/
Specifies the installation directory of the game. The default is/home/$USERNAME/gameserver
, press Enter to complete the game installation. To be honest, the command line is much faster than the GUI installation.
Please pay attention to whether there is any lack of dependencies during the installation process:
You can use apt install directly in root mode to install the corresponding dependencies or enter in root mode
/home/gameuser/gameserver
Directory Run./mcbserver install
Automatically install the corresponding dependencies.
Run the game
Log in to the system with the account bound to the game (gameuser), enter the game installation directory, find the executable program and run it with the start parameter. The steps are as follows:
su gameuser cd /home/gameuser/gameserver ./mcbserver start
Direct operation./mcbserver
You can see the supported operations:
If you want to check the running status of the server, you can use the monitor option:
Of course, if you want to put it on the public Internet, you need to do the corresponding domain name resolution and udp 19132 port mapping (or the firewall policy allows it).
Although this article uses Minecraft as an example, there are actually more than 100 game servers that can be created using the same method. The only thing to note is that if it is a domestic environment, scientific and technological assistance is required.