How To Set Up a Minecraft Server on Linux

Minecraft is popular sandbox indie game originally created by Swedish programmer Markus “Notch” Persson and later developed and published by Mojang. It is a game about breaking and placing blocks. At first, people built structures to protect against nocturnal monsters, but as the game grew players worked together to create wonderful, imaginative things.

Setting up minecraft server on your Linux server is simple and straight forward task. The server hosting Minecraft should have at least 2GB RAM memory, once we are logged in, we should make sure that our repositories are up to date:

# sudo apt-get update

Minecraft server requires java installed on the server. In order to check if we already have in installed, we will execute the following command:

# java –version

If Java is installed, we will get message with information about current Java version. If we don’t have Java, we will get error, like ”Command not found” or similar. If we need to install Java, we need to execute the following command:

# sudo apt-get install default-jdk

We also need to install screen on our server. We will be using it later in order to start the minecraft server. It will keep the connection up and running even after closing the console. To install screen, we execute the following command:

# sudo apt-get install screen

After we have installed all prerequisites, it is time to install Minecraft server. We start with creating directory that we are going to use to keep the Minecraft files:

# mkdir minecraft
# cd minecraft
# wget -O minecraft_server.jar https://s3.amazonaws.com/Minecraft.Download/versions/1.7.4/minecraft_server.1.7.4.jar

Once it is downloaded, we need to run it. We will run it inside screen, so it will keep running in background all the time. To create the screen and then start the Minecraft server we need to execute:

# screen -S "Minecraft server"
# java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

We will get some output and status progress as well as message that it is “done”. We can easily exit the screen and re-attach to it any time. To exit the screen, hit CTRL+A at the same time and then click on your “d” key afterwards.

To re-attach to the screen, we list all screens first and then re-attach to the one with the specific ID:

# screen –ls
# screen –r <screen_id>

You can edit the main configuration file which will be located in ~/minecraft/server.properties and change all the settings from there. You’re now all set and the Minecraft server is installed. Invite all your friend to play and have fun!

Try this tutorial on an SSD cloud server for $5.00/month only!

Built for Developers: 512MB RAM, 20GB SSD Disk and 2TB Transfer. 30 second setup.