In this guide, I will show you how to create a Minecraft server.

Minecraft is available in the Java Edition version for PCs with Linux, Windows, macOS, and Pocket Edition versions, usually for playing on Android devices.

We will install our own Minecraft Java Edition (on CentOS 7) and Minecraft Pocket Edition (on Ubuntu 18.04) servers with minimal configurations.

The servers will be created from the original developers builds without modifications or other extensions.

Minecraft Java Edition

We need to connect to the server via SSH.

# ssh [email protected]

Update all CentOS 7 components and their dependencies to the latest versions in the repositories:

# yum -y upgrade

Check if we have java installed or do we need to reinstall it on a newer version (version 8 is recommended).

# java -version

In our case, java is not installed.

There are two different implementations of Java, OpenJDK, and Oracle Java, between which there are almost no differences, except that Oracle Java has several additional commercial functions.

Install OpenJDK

# yum -y install java-1.8.0 *

Install Oracle Java

Oracle packages are available for download only from the official site.

Before installing Oracle Java, be sure to read the Oracle JDK license. Only non-commercial use of the software is permitted.

You can download the Java .rpm Oracle packages from the Java SE download page.

To download Oracle Java, you need to register on the Oracle website.

After downloading the package, use the following command to install it:

# yum localinstall jdk-VERSION-linux-x64.rpm

Then install the on-screen application to start the Minecraft server, so it be running after the ssh connection is closed:

# yum -y install screen

Create a window with a unique and easy to read name:

# screen -S "Minecraft"

If you need to view a list of open windows in screen, you can use the command:

# screen -r

Then enter the window ID or its name in quotation marks given during creation and switch to it:

To return to the primary console of CentOS 7, you must at the same time press the keys “Ctrl” “a”, and then the key “d”.

Install Minecraft server

For easy Minecraft server start, create minecraft directory of the same name in the /home directory.

# cd /home
# mkdir minecraft && cd minecraft

To download the file necessary for the server to work, install wget utility:

# yum -y install wget

Download the file to start the server, for example, from the official Minecraft website:

# wget https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar

Start the Minecraft server with the following command:

# java -Xmx1024M -Xms1024M -jar server.jar nogui

Where:

-Xmx1024M -Xms1024M – the allocated amount of RAM;

-jar server.jar – downloaded file to start the server;

nogui – start without a graphical interface.

The first time you start your server, it checks for existing Minecraft worlds and configuration files. If nothing is found, then everything that is needed is automatically created. With a new installation, you will receive a world directory containing the newly created Minecraft map, some configuration files, and a log file.

The first start server may be launch failed. This is because it is necessary to accept the terms of the license agreement. You can do this by editing the eula.txt file, replacing false with true.

After that, the server will start successfully.

Minecraft Pocket Edition

We are still connecting to the server via SSH.

# ssh [email protected]

Update all the components of Ubuntu 18.04 and their dependencies to the latest versions in the repositories:

# apt -y update && apt -y upgrade

Create the directory in which you want to install Minecraft Pocket Edition and navigate to it:

# mkdir PocketServer && cd PocketServer

Download the Minecraft Pocket Edition archive from the official website:

# wget https://minecraft.azureedge.net/bin-linux/bedrock-server-1.14.60.5.zip

Install unzip utility:

# apt -y install unzip

Unzip the downloaded archive:

# unzip bedrock-server-1.14.60.5.zip

Next, install screen in order to start the Minecraft server and it continued to work after we exit the server console:

# apt -y install screen

Create a window with a unique and easy to read name:

# screen -S "MineraftPE"

If you need to view the list of open windows in screen, enter the command:

# screen -r

Then enter the window ID or its name in quotation marks given during creation and switch to it.

To return to the primary Ubuntu 18.04 console, at the same time press the Ctrl + a key, then the d key.

To start the server, run the following command:

# LD_LIBRARY_PATH =. ./bedrock_server

That’s all, the server is running, you can connect to it, use the server’s IP address and port 19132.