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

1. You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you are a new user, you can get a free account in your Alibaba Cloud account. If you don’t know about how to set up your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1GB RAM and 1 Core processor.
2. Root user

Update the system

We recommend you to update the system before installing any new packages on your CentOS server. Execute the below command and all the available packages will be upgraded.

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

We have all the dependencies required for the installation, now we are ready to download the installation script. First of all, create a new directory called server in the root.

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

The cuberite is installed on your CentOS 7 server, now let’s configure it. First of all, locate and copy the compiled server out of our temporary directory before going through configuration.

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

In this guide, you have learned how to install Cuberite on your Alibaba Cloud Elastic Compute Service (ECS) CentOS 7 server. You also learned to configure the server and manage the maximum numbers of players to be online. We hope now you have enough knowledge to work with Cuberite. Now you can pass your server address along with a few friends and start building.

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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store