How to install Minecraft Server to Ubuntu 18
In this article, we will show you how you can easily create your own Minecraft server on VPS running Ubuntu 18.04 using Mivocloud servers.
For those who didn't know, Minecraft is the most popular game of all time, where most of the audience are children.
It is a video game in which players explore endless worlds and build structures, from simple houses to tall skyscrapers.
To run the following commands, it is assumed that you have at least a basic knowledge of Linux, that you know how to use the shell, and most importantly, that you are hosting the server on a VPS or dedicated server.
To install a Minecraft server, you must run as root (administrator), otherwise you may need to add "sudo" to the commands to gain administrator privileges.
I will show you a step by step installation of Minecraft Server on a server running Ubuntu 18.04 installed on a VPS (Virtual Private Server).
Step 1. Check the files
First, make sure that all your system packages are updated by running the following apt commands in the terminal.
sudo apt update
sudo apt upgrade
sudo apt install git build-essential
Step 2. Install the Java Runtime environment.
To install a Minecraft server, Java must be installed on your system. Run the following command to install the untitled OpenJRE 11 package:
apt install openjdk-11-jre-headless
Check the installation
java -version
Step 3. Install Minecraft Server on Ubuntu 18.04.
Create a new user for Minecraft that will run as:
sudo useradd -m -r -d /opt/minecraft minecraft
Before starting the installation process, create a Minecraft directory:
sudo mkdir /opt/minecraft/survival
sudo chown -R minecraft /opt/minecraft/survival/
Now download Java Minecraft Server and install your own Minecraft server:
sudo wget -O /opt/minecraft/survival/minecraft_server.jar https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar
Then accept the Minecraft Terms and Conditions:
sudo bash -c "echo eula=true > /opt/minecraft/survival/eula.txt"
Step 4. Create the Systemd module file.
Instead of manually starting the Minecraft server, we will create a Systemd module file and run Minecraft as a service:
nano /etc/systemd/system/[email protected]
[Unit]
Description=Minecraft Server: %i
After=network.target
[Service]
WorkingDirectory=/opt/minecraft/%i
User=minecraft
Group=minecraft
Restart=always
ExecStart=/usr/bin/screen -DmS mc-%i /usr/bin/java -Xmx4G -jar minecraft_server.jar nogui
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "say SERVER SHUTTING DOWN IN 5 SECONDS. SAVING ALL MAPS..."5'
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "save-all"5'
ExecStop=/usr/bin/screen -p 0 -S mc-%i -X eval 'stuff "stop"5'
[Install]
WantedBy=multi-user.target
Save the file and restart the systemd manager configuration:
sudo systemctl start minecraft@survival
sudo systemctl status minecraft@survival
Step 5. Configure the firewall.
Ubuntu comes with a firewall configuration tool called UFW. If your system has a firewall enabled and you want to access the Minecraft server outside the local network, you need to open port 25565:
sudo ufw allow 25565/tcp
Congratulations! You have successfully installed Minecraft. Thank you for using this tutorial on how to install Minecraft Server from Mivocloud on Ubuntu 18.04. For more help or useful information, we recommend you visit the official Minecraft website.
Offer of administration services
If you do not have time for all this if this is not your area of expertise, we offer the service "Server Administration".