How to Install Cuberite on a CentOS 6 or 7 Server
Introduction
Section titled “Introduction”What is Cuberite?
Section titled “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:
Section titled “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
AleForge offers these specifications for $7.50 per month (including 25 GB of SSD and a terabyte of bandwidth).
Installation
Section titled “Installation”Prerequisites
Section titled “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 -yNow, we will install nano . (you may use vim or any other editor you
prefer):
yum install nano -yOnce it finishes, run the following command to install cmake (the compiler):
yum install cmake -yNow, install screen (allows applications to run in the background):
yum install screen -yAfter screen installs, you can proceed to the next section.
Running the installation script
Section titled “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 servercd serverwget -O install.sh https://compile.cuberite.orgNow, you can run the installation script:
sh install.shYou will see the following message in your terminal:
[root@demo server]# sh install shHello, 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.shCompiling from srouce takes time, but it usually generates fasterexecutables. If you prefer ready-to-use binaries or if you wantmore 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 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 .
Once you’ve done so, you will be prompted with following message:
#### Settings Summary ####Build Type: ReleaseBranch: master (Currently the only choice)Compilation threads: 1CPU Threads: 2Previous Compilation: Not detected. We are assuming this is the first compile.sh run.Upstream Link: https://github.com/cuberite/cuberite.gitUpstream Repo: origin
After pressing ENTER, the script will connect to https://github.com/cuberite/cuberite.gitto 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 "Previouscompilation" is detected.Press ENTER to continue...This is the final step before the compilation will start. You will be told to hit 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
Section titled “Configuration”To configure your server, we must first locate and copy the compiled server out of our temporary directory:
cd cuberitecp -r Server ~/server/cuberiteServercd ./cuberiteServerYour 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.iniYou will see something that looks like the following:
[Server]Description=Cuberite - in C++!ShutdownMessage=Server shutdownMaxPlayers=100HardcoreEnabled=0AllowMultiLogin=0Ports=25565In 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 + , followed by .
Starting, stopping and connecting to your new server
Section titled “Starting, stopping and connecting to your new server”Starting the server
Section titled “Starting the server”To start the server, simply head to the server directory
(/root/server/cuberiteServer ) and start a screen:
cd ~/server/cuberiteServerscreen -S MinecraftServer && screen -r MinecraftServerYou 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:
./CuberiteIt 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: + + .
Stopping the server
Section titled “Stopping the server”In order to perform a hard-shutdown, all you need to do is use + . To perform a graceful shutdown, enter the following command in the console:
stopConnecting to your server
Section titled “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
Section titled “Final Remarks”At this point, you can pass your server address along with a few friends and start building.
Uninstalling Cuberite
Section titled “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 .