In this article, we will have explained the necessary steps to install and configure Minecraft Server on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
Minecraft is one of the most famous building games in the world developed by Microsoft Studious. In this game, you are allowed to build anything you need and explore it in a 3D world. If you host your own Minecraft server, you decide the rules, and you and your friends can play together in this interactive adventure game.
Install Minecraft Server on Ubuntu
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
Step 2. Install Java.
In order to run a Minecraft server, we will need Java on the server. Install the latest version:
Now, confirm the Java installation:
Step 3. Creating Minecraft User.
The next step is to create a new system user and group with home directory /opt/minecraft that will run the Minecraft server:
Step 4. Install Minecraft on Ubuntu.
First, before starting with the installation process, make sure you switch to minecraft user:
Now create three new directories inside the user home directory:
- The backups directory will store your server backup. You can later synchronize this directory to your remote backup server.
- The tools directory will be store the mcrcon client and the backup script.
- The server directory will contain the actual Minecraft server and its data.
Then, Downloading and Compiling mcrcon.
Start by navigating to the ~/tools directory and clone the Tiiffi/mcrcon repository from GitHub using the following command:
Next steps, downloading Minecraft Server.
wgethttps://launcher.mojang.com/v1/objects/3737db93722a9e39eeada7c27e7aca28b144ffa7/server.jar -P ~/server
Once the download is completed, navigate to the ~/server directory and start the Minecraft server:
When the server is started for the first time it executes some operations and creates the server.properties and eula.txt files and stops:
As you can see from the output above you’ll need to agree to the Minecraft EULA in order to run the server. Open the eula.txt file and change eula=false to eula=true:
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://account.mojang.com/documents/minecraft_eula).
#Thu Dec 10 03:46:53 PST 2019
Next, enable the rcon protocol and set the rcon password by editing the server.properties file. You can use these details to connect to the Minecraft server using the mcrcon tool:
Step 5. Creating Systemd Unit File Minecraft.
Open your favorite text editor and create a file named minecraft.service in the /etc/systemd/system/:
Start and enable the Minecraft server by executing:
Step 6. Configure firewall
If your server is protected by a firewall and you want to access Minecraft server from the outside of your local network you need to open port 25565:
Step 7. Accessing Minecraft Console.
To access the Minecraft Console you can use the mcrcon utility. The syntax is as follows, you need to specify the host, rcon port, rcon password and use the -t switch which enables the mcrcon terminal mode:
That’s all you need to do to install Minecraft on Ubuntu 18.04 Bionic Beaver. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.