Preface
Since I set up the Trinitycore 3.3.5 World of Warcraft server, I have also been thinking about what other game servers I could set up. After all, the "Game World" section of my blog cannot have only one World of Warcraft; with such a grand name, having such a small scope is just too low. After some research, the Turnkey-gameserver solution caught my eye. It is basically a one-click setup, and there are over 100 game server backends to choose from. This article will take setting up a Minecraft (Bedrock Edition) server as an example to demonstrate how to use PVE's LXC template to quickly build a game server.
A brief introduction to Turnkey Linux: "Turnkey GNU/Linux is a free Debian-based library of system images 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 progress of a free and humane society. Without the freedom to freely distribute, patch, and learn from free software, the Internet as we know it would not exist. Free software is the silent, often invisible force behind the greatest technological wonders of our time."
Simply put, Turnkey has already 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 virtual machines, and they can immediately get a Debian-based LXC with the relevant software already deployed, which is as simple as deploying an application using Docker.
In fact, in PVE's CT templates, you can see many templates named turnkey-(software_name):

By using these CT templates to establish LXCs, you can immediately have a Linux container with the corresponding software already deployed. This article will build a gameserver in this manner.
Using CT Template: Turnkey-gameserver to Create LXC
Follow the steps below to create the gameserver LXC:









Click to complete the creation of the LXC.
Initializing gameserver
In PVE, select the newly created gameserver Linux container, and log into the terminal in the right console interface using root and the password created earlier:

After logging in, you will directly enter the gameserver initialization interface, where a new account named "gameuser" will be created and its password set:

After setting the password, enter the "Initialize Hub services" interface:

Here, you mainly configure Turnkey's backup, migration, domain name management, and other functions. If needed, you will need to provide an API key, which requires going tohttps://hub.turnkeylinux.org/profileregister, as well as needing a free AWS account, etc. If you need this, just follow the prompts to set it up. This step is not mandatory; you can choose the Skip button below to skip it and enter the system notification and security warning interface:

If you need to receive notifications, enter your email in the email field and select Enable below; otherwise, you can directly select Skip to skip, and then enter the security update interface:

If you need to install security updates immediately, select the Install button below to install; otherwise, select Skip to skip. I chose Install. After installing the updates, a reboot is recommended:

After rebooting, the terminal displays the following interface:

In the two red boxes in the image above, you can see the IP address of this Linux container and the command to enter the advanced command-line console
confconsole. At this point, you can already use an SSH client to directly access the IP address for management.
Installing the game
GUI Installation (Not recommended, many issues)
Use an SSH client or the console on PVE to log into the gameserver, and then runconfconsolecommand to enter the game server application service interface, as shown below (if you chose skip for the security update at the end of the previous section, you will go directly to this interface):

In the image above, Web shell is a web-based command-line tool, and Webmin can be understood as a panel tool (which is also covered in my other article:Docker Series: Building a DNS Server Based on Bind9). Here, we first select "Advanced menu" in the red box below to enter the advanced menu:

Select Game Server in the image above, and then choose Select below:

Select "Select game" in the image above, and then choose Select below:

The image above prompts that some games may require some basic configurations, such as the server name. Directly select OK below, and finally, we enter the step of choosing the game to install:

Since we are going to set up a Minecraft Bedrock Edition server this time, select 60, and then choose OK below:

It will be installed quickly:

Because gameserver must bind the game to a non-root account when installing a game, installing the game via GUI will cause the system to bind the game to the gameuser account created during initialization, and install the game to the/home/gameuser/gameserver/directory. Since we are installing Minecraft (Bedrock Edition) this time, the final path of the executable program is/home/gameuser/gameserver/mcbserver:

Note: Try not to install via GUI, as it feels like there is a higher chance of issues. I also encountered the problem of incomplete installation files. The official recommendation is command-line installation.
Command Line Installation
Execute theauto_install.shcommand to install, as follows:
cd /root/gameservers
./auto_install.sh --list #查看有哪些游戏可以安装

./auto_install.sh --list # to view which games can be installed
./auto_install.sh --game mcb --user gameuser --path /home/gameuser/gameserver/
./auto_install.sh --game mcb --user gameuser --path /home/gameuser/gameserver/--user gameuser binds Minecraft to the user gameuser,It specifies the installation directory of the game, and the default is/home/$USERNAME/gameserver, press Enter to complete the game installation. Honestly, command-line installation is much faster than GUI.
Please pay attention to whether there are missing dependencies during the installation process:

You can directly use apt install in root mode to install the corresponding dependencies, or enter root mode and go to the
/home/gameuser/gameserverdirectory to run./mcbserver installto automatically install the corresponding dependencies.
Running the game
Log in to the system with the account bound to the game (gameuser), go to the game's 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
Run directly./mcbserverto 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 network, you need to set up the corresponding domain name resolution and UDP port 19132 mapping (or allow it in the firewall policy).
Although this article takes Minecraft as an example, in fact, there are more than 100 other game servers that can be created using the same method. The only thing to note is that if you are in a domestic environment, you will need VPN/proxy assistance.