In this tutorial we will cover the steps needed to install Minecraft Server on Linux.

Requirements

  • Container/Server with installed Linux Distribution (Ubuntu, CentOS or Debian)
  • At least 1 GB
  •  Installed JDK
  •  Installed Screen

Setting Up the Environment

First of all, we will need to install the packages that are needed to run Minecraft on our server. Log in to your server via SSH. [link to the tutorials for connecting via SSH]

Step 1: Installing screen:

In order to install screen on CentOS, you will need to execute:

In order to install screen on Ubuntu/Debian, you will need to execute:

Step 2: The next part of the server configuration is to install Java:

For Java installation on your CentOS server you can use:

For Java installation on your Ubuntu/Debian server you can use:

Once you are ready with these installations,you can proceed with the Minecraft server installation.

Installing Minecraft Server

Step 1: Navigate to the folder that you want to install Minecraft Server in, create separate directory for the installation and switch into it:

Step 2: Download the Minecraft server software in the current folder and change its permissions so it can be executed:

Step 3: Start a screen, under which you will run the Minecraft server:

Note: the option “-S” is used for setting a name for the screen.

Step 4: Once you have entered the screen, you need to execute the Minecraft .jar file that you have downloaded using the following command:

Note: You can change the values for Xmx and Xms accoring to your server's resources.

The value Xmx is the maximum Java heap size (the maximum memory that your application will be able to use).

The values Xms is the initial Java heap size (the initial memory that the Java will allocate when the process starts).

The output for a successful installation should look like the example below:

Now your Minecraft server is installed and started successfully. You can now detach the screen by pressing Ctrl + a + d.

Minecraft Configuration

In order to configure your installation, you will need to edit the file:

which is located in the Minecraft installation folder. The file contains the following options:

We will explain every part of the file separately below:

- allow-nether=true - allows players to travel to the Nether realm.

- level-name=world - the "level-name" value is the name of the world and folder it is stored in. If you have your own map or world created on your personal copy of Minecraft, you may upload it to your server and change the level-name within the configuration to be the same as the world you uploaded, and then the server will load your own world instead.

- allow-flight =false – if it is true, it will allow users to fly on your server in Survival mode, if they have a mod that provides flight installed.

- enable-query=false – if it is true, it enables GameSpy4 upon the server.

- server-port=25565 - specifies the port the server is accessed by. It is 25565 by default, it is advisable leaving it so, otherwise the clients will need to add :* after your IP, where * is your port you have selected. You must also make sure it is allowed in the firewall:

- enable-rcon=false – if it is set to "true", it enables remote access to the server console. However, this is very insecure and is not often used.

- level-seed=[value] – it specifies the seed your server is generated with. A seed is simply a way of telling the server what terrain to generate. For example, "glacier" and "404" are popular seeds.

- server-ip=[value] – the value sets the connection IP. This is the IP that the players will use to connect to your Minecraft server.

- white-list=false – this is a restriction option. It enables the server whitelist. When it is true, only users which are present in white-list.txt file will be able to connect.

- spawn-animals=true – when it is set to "true", it allows animals to spawn in the wild.

- online-mode=true – when it is set to "true", only players with purchased accounts will be able to connect to your server. It is recommended to leave that option enabled.

- pvp=true – when it is set to "true", it enables PvP on your server.

- difficulty=1 - defines the difficulty (such as damage, hunger and poison that affects players) of the server. This option is entirely server-dependent and will not be affected by client-side difficulty settings.

The available values for this option are:
0 - Peaceful
1 - Easy [default]
2 - Normal
3 - Hard

- gamemode=0 – it defines the mode of gameplay, either Survival (0) or Creative (1).

- max-players=20 - the maximum number of players that can play on the server at the same time. Please notice that increasing that limit will require more server resources.

- spawn-monsters=true – when it is set to "true", it allows monsters to be spawned at night and in the dark.

- view-distance=10 – this is the amount of world data the client receives from the server. The default value is 10.

- motd=A Minecraft Server – this is the message displayed in the client's server list, below the name. Mind that if the MOTD is over 59 characters, the server list may report an error.