How to Install Cuberite on a CentOS 7

By Sajid Qureshi, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

Cuberite is a free Minecraft-compatible game server written in C++. It has easy to use plugins that allow for the user to write their own plugins with Lua. Cuberite supports multi-platforms and works with most of Linux and Windows operating systems. Cuberite was created in late 2010 with its original name MCServer, as a replacement for the Vanilla Minecraft server.

In this guide, you will learn how to install Cuberite on your Alibaba Cloud Elastic Compute Service (ECS) CentOS 7 server.

Prerequisites

Update the system

yum -y update

Next, execute the following command to install cmake compiler.

yum -y install cmake

Next, execute the following command to install ‘screen’ that allows applications to run in the background.

yum -y install screen

Installing Cuberite

cd ~ && mkdir server

Now, go to the newly created directory and download the installation script using the following commands.

cd serverwget -O install.sh https://compile.cuberite.org

Once it gets completed, you can run the installation script using the following command.

sh install.sh

You should see the following message.

Hello, this script will download and compile Cuberite.
On subsequent runs, it will update Cuberite.
The compilation and download will occur in the current directory.
If you're updating, you should run: <Path to Cuberite>/compile.sh
Compiling from source takes time, but it usually generates faster
executables. If you prefer ready-to-use binaries or if you want
more info, please visit: https://cuberite.org
Choose compile mode:
* (R)Release: Compiles normally.
Generates the fastest build.
* (D)Debug: Compiles in debug mode.
Makes your console and crashes more verbose.
A bit slower than Release mode. If you plan to help
development by reporting bugs, this is preferred.
Choose compile mode: (r/d) (Default: "Release"):

If you see the above message then press ENTER button on your keyboard.

Next, you will be asked to choose threads for the compilation, it depends on instance type you have, after that press the ENTER button on your keyboard.

You should see the following output in your terminal.

#### Settings Summary ####
Build Type: Release
Branch: master (Currently the only choice)
Compilation threads: 1
CPU Threads: 2
Previous Compilation: Not detected. We are assuming this is the first compile.sh run.
Upstream Link: https://github.com/cuberite/cuberite.git
Upstream Repo: origin
After pressing ENTER, the script will connect to https://github.com/cuberite/cuberite.git
to check for updates and/or fetch code. It will then compile your program.
If you compiled before, make sure you're in the proper directory and that "Previous
compilation" is detected.
Press ENTER to continue...

Hit the ENTER button on your keyboard to start the compilation. It will take some time about 10–15 minutes, so hold on a bit.

Once the compilation gets completed, you will see the output something like this:

-----------------
Compilation done!
Cuberite awaits you at:
/root/server/cuberite/Server/Cuberite
You can always update Cuberite by executing:
/root/server/cuberite/compile.sh
Enjoy :)

Configuring Cuberite

cd cuberitecp -r Server ~/server/cuberiteServer

Now, your server will be located at ‘/root/server/cuberiteServer’. You can now proceed further and edit the configuration file using any text editor.

cd ./cuberiteServernano settings.ini

You should see something familiar to this:

[Server]
Description=Cuberite - in C++!
ShutdownMessage=Server shutdown
MaxPlayers=100
HardcoreEnabled=0
AllowMultiLogin=0
Ports=25565

You can manage the number of the players that can be online at any given time and to do so just change the value of MaxPlayers=100 to any number you wish.

You can also change the default port number by changing the value of Ports in the configuration file, but we recommend you do not change the port number because of the increased difficulty for users to connect to the server.

Save the file and exit from the text editor.

To start the server, go to the server directory using the following command.

cd ~/server/cuberiteServer

Now, start a screen using the following command.

screen -S MinecraftServer && screen -r MinecraftServer

You can reconnect to the screen at any time using the following command.

screen -r <screenName>

Please replace screenName with your screen name.

Now, execute the server binary:

./Cuberite

You can exit to the screen using the CTRL + A + D key combination.

If you want to force shutdown the server then you can do so using the CTRL + C combination. If you want to shut down the server gracefully then simply type stop command in the console.

Finally, you can enter your server address in the Minecraft client to connect to the server. Your server address should be like this YourServerIP:25565.

Please replace the YourServerIP with your actual server IP address.

Conclusion

Reference:https://www.alibabacloud.com/blog/how-to-install-cuberite-on-a-centos-7_594628?spm=a2c41.12714941.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com