Update: Follow this link for a new tutoriel to create a Minecraft Bedrock server on Ubuntu 20.04.
The game Minecraft has grown incredibly in recent years, both on game console platforms and on mobile devices.
One of the features that people have greatly appreciated is the ability to play as a team or against each other in a controlled environment. To do this, you must have a Minecraft PE server in which you can invite our friends to join you.
Today we are going to look at the steps necessary to have your own Minecraft PE server.
Let’s prepare the server
You will need a server with the latest distribution of Ubuntu 16.04. If you do not already have one, we offer excellent servers right here.
You must connect to your server by SSH. Several software can help you make the connection. Personally, I prefer the software named PuTTY.
The first step when entering a new server is to make sure it is up to date. Perform the following two commands to update your Ubuntu server (the first SSH command will search for the list of available updates and the second command will install the new modules).
sudo apt-get update sudo apt-get upgrade
Note: It is possible and quite normal that when you start a command with “sudo”, the system asks for the server administrator password. Usually the Ubuntu operating system will ask for the password only during the first command executed with “sudo”. The reason is that the “sudo” command is used to run an application with administrator rights.
Adding some security
Once the server is up to date, you must apply a minimum of security. This section is optional, but highly recommended.
By default, the SSH service of a server is listening on port 22. Therefore, many of the hackers will try to exploit this port. Fortunately, it is very simple to change the default port on a Linux server.
sudo vi /etc/ssh/sshd_config
You should see the contents of the file as follows:
You need to replace the port number on the line below the cursor, shown in the picture above. For this tutorial, I will change port 22 for the port 22222.
Note: If you have never used the “VI” file editor in a Linux server, here are the basics. To modify a file, start by typing the “i” character (the text “- INSERT -” will appear at the bottom of the screen). Then make the desired changes. In this case; change the port number. When the changes are complete, press the “ESC” key to stop the edit mode. To save, enter the character “:”, this one allows you to enter a command. Then type the letters “wq” and the enter key (the “w” means “write” and the “q” “quit”).
Now you must prepare the firewall to prevent everyone having access to your server. We will place four rules in the server.
The first rule will block all incoming connections in the server:
sudo ufw default deny incoming
Then, allow all outgoing connections from the server.
sudo ufw default allow outgoing
Now we must allow SSH to connect to the server so that we can always have access to the server. Important, I put port 22222 here because it’s the one I opened in my server, if you selected another port, please change 22222 for your port.
sudo ufw allow 22222/tcp
Finally, we will open the necessary port for the Minecraft PE server.
sudo ufw allow 19132/tcp
Now that we’re done with our firewall configuration, we need to restart the SSH service and the firewall. The order is important to avoid getting banned outside the server.
We close the firewall.
sudo ufw disable
Then restart the SSH service (You may have to reconnect).
sudo service sshd restart
And we open the firewall
sudo ufw enable
Preparing the server for Minecraft
Good, now that security has been improved on your server, you can start the installation of the necessary modules for the Minecraft PE server. We will install “PocketMine MP” as Minecraft PE server, it is easy to use and is still maintained regularly.
First, install the necessary modules for the Minecraft PE server to function properly. I will not go into the description of each module. The curious can find descriptions easily on the web. I will simply give you’re the command to enter.
sudo apt-get install build-essential libtool-bin autoconf bison screen -y
Now we must create a user under which we will run the Minecraft PE server. Creating a user improves the security of the server. I will create a user named “minecraft” with a folder in “/home/minicraft/”.
sudo useradd -d /home/minecraft -m minecraft
And then we will assign a password to the user (the system will ask you to enter the password twice.
sudo passwd minecraft
Time to install Minecraft PE Server
For the rest of the tutorial, we will use the user “minecraft” we just created. To change users, run the following command
And then, move to the directory we assigned to the user.
Once in the right place, we need to install the suite of software necessary for the Minecraft PE server to work, thankfully, this is easily done with a single command.
wget -q -O - https://get.pmmp.io | bash -s -
The installation may take a few minutes, once completed we will use the application “screen” that will allow us to run our server Minecraft PE even if we are not connected by SSH.
To start the Minecraft PE server with the “screen” application it is necessary to launch the two following commands.
script /dev/null screen ./start.sh
During the first launch, the system will ask you in which language should it start the server, accept the license and if you want to start the configuration wizard. In this tutorial I’ve kept all the default values.
After that, the Minecraft PE server will start without asking any questions.
Once the server is functional, to go back without closing your Minecraft PE server, press the “CTRL-A” keys followed by the “D” key. You will be back in the command line, but your Minecraft PE server will continue to work.
To return to the screen where the Minecraft PE server display the information, simply perform the following command.
Finally, if you want to close your Minecraft PE server smoothly, when you are on the screen displaying the Minecraft PE server status, type the word “stop” followed by the enter key.
Enjoy your new Minecraft PE game server!