How To Set Up a Minecraft Server on Linux

Minecraft Banner

There are many ways to set up a Minecraft server, and tons of options out there where you can simply pay to have someone else host one for you. Fortunately, setting up your own server (for free), is incredibly easy.

In this tutorial, I will show you how to set up a Minecraft Server on Linux (Ubuntu 14.04). Here are some requirements before we get started:

Note - the rest of the tutorial assumes you have already installed Ubuntu Server 14.04, and you are able to login with a user that has root privileges.

Installing the Minecraft Server Requirements

First, let’s make sure our server is up to date:

sudo apt-get update

Once updates are complete, check to see if Java is installed on our server:

java -version

If no Java version gets displayed, you will need to install it before preceeding:

sudo apt-get install default-jdk

Next, we will install an application called Screen. Screen allows us to use multiple terminal sessions in a single window. For example, you may have multiple tasks running on your server simultaneously. Screen allows you to switch between sessions, without having to close one, all within the same window.

sudo apt-get install screen

Install the Minecraft Server

(Update as of 12/15/2015 - If you want to install a server that allows plugins, please refer to this article)

Next, we will install the Minecraft Server onto our Ubuntu Server.

First, create a directory anywhere on your server that you want to store the Minecraft files. Be sure to switch into that directory after it is created.

mkdir minecraft
cd minecraft

Now, within our newly created minecraft directory, download the Minecraft Server:

wget -O minecraft_server.jar https://s3.amazonaws.com/Minecraft.Download/versions/1.8.1/minecraft_server.1.8.1.jar

Using Screen, create a new session for our Minecraft server:

screen -S "Minecraft"

Next we will create a short script that will launch our Minecraft server. To create in Nano, do the following:

sudo nano minecraft.sh

Once the editor is open, put this line into the script. Once done, save the file, and close Nano.

sudo java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

Launching our Minecraft Server

Finally, to run the server, simply execute the script you previously made.

sudo ./minecraft.sh

Hopefully, the server launches successfully. If it is running, you should see the word “Done” at the bottom of your terminal output. Don’t be alarmed if you see messages like “Failed to load operators list” or “Failed to load white-list”. That is okay, because those files have not been created yet. They will be generated automatically, and next time your restart your server, those warnings will be gone.

You will also see a ‘server.properties’ file get generated. Feel free to open it up with Nano and adjust settings as necessary. You will notice a default port of 25565 is being used for the server, so be sure to set up port forwarding in your router for your server IP and that port number if you plan on giving access to those outside your local internet.

To leave your “Minecraft” Screen do the following:

ctrl-a d

You can reattach the screen with the following:

screen -R

Feel free to leave me any questions you may have in the comments below.