Introduction
What is Cuberite?
Cuberite is a scalable, open-source Minecraft server implementation that is written in C++. It has an easy-to-use plugin system that allows for users to write custom plugins with Lua and was originally created under the MCServer
name.
Supported Platforms:
Cuberite is multi-platform and will work with most Linux operating systems and Windows. This tutorial will only cover the installation of the server software on a CentOS 6 or 7 installation. Like most Minecraft servers, plugins and other factors will contribute to a larger memory footprint. To start off, it is suggested that you have at least:
- One gigabyte of RAM
- One CPU core
Aklweb host offers these specifications for $5 per month (including 25 GB of SSD and a terabyte of bandwidth).
Installation
Prerequisites
Before we begin, we have to make sure that the system is up to date and that we have an appropriate text editor. This will be necessary for configuring the server. We will also need the appropriate tools to build and compile the software.
Before we install anything, execute the command below to update your system:
yum update -y
Now, we will install nano
. (you may use vim
or any other editor you prefer):
yum install nano -y
Once it finishes, run the following command to install cmake
(the compiler):
yum install cmake -y
Now, install screen
(allows applications to run in the background):
yum install screen -y
After screen
installs, you can proceed to the next section.
Running the installation script
Now that we have all the dependencies required for the installation to complete, we must retrieve the script. The commands below will create a new directory in /root
, or ~
.
cd ~ && mkdir server
cd server
wget -O install.sh https://compile.cuberite.org
Now, you can run the installation script:
sh install.sh
You will see the following message in your terminal:
[root@demo server]# sh install sh
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 srouce 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"):
When you see the above, just hit ENTER on your keyboard.
You will now see the following:
Choose the number of compilation threads.
You have 2 CPU threads.
If you have enough RAM, it is wise to choose your CPU's thread count.
Otherwise choose lower. Old Raspberry Pis should choose 1. If in doubt, choose 1
.
Please enter the number of compilation threads to use (Default: 1):
You may choose to use more threads for the compilation (depending on the instance you have). Apart from this, all you have to do is hit ENTER.
Once you’ve done so, you will be prompted with following message:
#### 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...
This is the final step before the compilation will start. You will be told to hit ENTER to start the compilation. It will take roughly 15 minutes, depending on your system.
NOTE: Don’t be alarmed if you see a bunch of text scrolling on your terminal. It will take some time for the system to fully compile the software into an executable package.
Once it completes, you will be greeted with the following message:
-----------------
Compilation done!
Cuberite awaits you at:
/root/server/cuberite/Server/Cuberite
You can always update Cuberite by executing:
/root/server/cuberite/compile.sh
Enjoy :)
This marks the end of the installation. You can proceed to the next section for the configuration of the server.
Configuration
To configure your server, we must first locate and copy the compiled server out of our temporary directory:
cd cuberite
cp -r Server ~/server/cuberiteServer
cd ./cuberiteServer
Your server directory will now be located at /root/server/cuberiteServer
and the configuration file will be located at /root/server/cuberiteServer/settings.ini
.
We can now edit the configuration using any text editor:
nano settings.ini
You will see something that looks like the following:
[Server]
Description=Cuberite - in C++!
ShutdownMessage=Server shutdown
MaxPlayers=100
HardcoreEnabled=0
AllowMultiLogin=0
Ports=25565
In order to edit the maximum number of players that can be online at any given time, just modify the MaxPlayers=100
line to any number you desire.
For example, if you wanted a maximum of 25 players, all you’d have to do is change the line to MaxPlayers=25
.
You can also change the port, but it is not recommended because of the increased difficulty for users to connect to your server (the default port for Minecraft servers is 25565
).
If you’re using nano
, you can exit and save by doing CTRL + X, followed by ENTER.
Starting, stopping and connecting to your new server
Starting the server
To start the server, simply head to the server directory (/root/server/cuberiteServer
) and start a screen:
cd ~/server/cuberiteServer
screen -S MinecraftServer && screen -r MinecraftServer
You can reconnect to the screen
at any given time using the screen -r <screenName>
command. We named the screen MinecraftServer
, so reconnecting can be done by performing screen -r MinecraftServer
.
Now, execute the server binary:
./Cuberite
It may take a few seconds for the terrain to generate before the server can be used. Also, use the following combination to exit the screen: CTRL + A + D.
Stopping the server
In order to perform a hard-shutdown, all you need to do is use CTRL + C. To perform a graceful shutdown, enter the following command in the console:
stop
Connecting to your server
Assuming that you’ve already configured the firewall, you can enter your server address in the Minecraft client.
Your address should look like the following: 192.0.2.5:25565
(192.0.2.5
being your actual server address).
Final Remarks
At this point, you can pass your server address along with a few friends and start building.
Uninstalling Cuberite
Removing the software is simple. All you have to do is make sure that the server is offline and run rm -rf ~/server
.