Introduction
Minecraft is a popular sandbox video game that was created by Markus Persson and developed and published by Mojang Studios. In Minecraft, players explore a blocky, procedurally generated 3D world and can build structures, craft items, and engage in other activities.
A Minecraft server is a dedicated server that allows players to connect to the game over the internet or a local area network. By hosting a Minecraft server, players can enjoy Minecraft together with friends, regardless of their location. Setting up a Minecraft server can be done on various operating systems, including Windows, macOS, and Linux. This guide focuses on setting up a Minecraft server on an Ubuntu-based system 18.04 / 20.04 / 22.04.
Update the system
First, update the system to ensure all packages are up to date:
$ sudo apt update && sudo apt upgrade
Install Java 17
Minecraft server requires Java to run, so let’s install Java 17:
$ sudo apt install openjdk-17-jdk
Create a user for the Minecraft server
It’s a best practice to run the Minecraft server as a separate user for security reasons:
$ sudo adduser minecraft
Switch to the minecraft user
Now switch to the minecraft user:
$ sudo su - minecraft
Download the Minecraft server software
Download the Minecraft server software version 1.19.3:
$ wget https://piston-data.mojang.com/v1/objects/c9df48efed58511cdd0213c56b9013a7b5c9ac1f/server.jar
Start the Minecraft server
Start the Minecraft server:
$ java -Xmx1024M -Xms1024M -jar server.jar nogui
Accept the EULA
Accept the End User License Agreement (EULA) by editing the eula.txt file:
$ nano eula.txt
Change eula=false
to eula=true
and save the file.
Restart the server
Stop the server with the command stop
in the Minecraft console and then start it again:
$ java -Xmx1024M -Xms1024M -jar server.jar nogui
Edit server.properties
Edit the server.properties file to configure the Minecraft server:
$ nano server.properties
Here are some of the important settings you can configure in this file:
- server-name: The name of the server.
- server-port: The port the server listens on (default is 25565).
- level-name: The name of the world.
- difficulty: The difficulty level of the game (options are Peaceful, Easy, Normal, and Hard).
- gamemode: The default gamemode (options are Survival, Creative, Adventure, and Spectator).
Save the file when you’re done making changes.
Configure firewall rules
If you have a firewall enabled on your Ubuntu server, you need to allow incoming traffic on port 25565:
$ sudo ufw allow 25565/tcp
Test the Minecraft server
Finally, test the Minecraft server by connecting to it from another device on the same network using the IP address of the Ubuntu 18.04/20.04/22.04 server and the default port 25565.
You should now have a fully functioning Minecraft server version 1.19.3 running on Ubuntu with Java 17 and configured server.properties file.
10 thoughts on - Install Minecraft Server on Ubuntu LTS
Thanks for this, But you can only edit the server properties after you stop the mincraft from running. 🙂
After changes are made to the server.properties file, the server must be restarted for them to take effect. Another option is to use the
/reload
command in the server console or in-game, which will also allow changes to be reloaded.hey, how do you update it afterwards? i have it running and the current version is 1.20.4 or something and this is on 1.19.3
To update your Minecraft server from version 1.19.3 to 1.20.4, you’ll need to download the new server.jar file for the desired version using the
wget
command. After downloading get latest version from Minecraft server download, replace the old server.jar with the new one, accept the EULA if necessary, and start the server with the updated version. Ensure you backup your world and check plugin compatibility before updating.Hello, I have created server version 1.20.4. From other computer with ubuntu I can connect. But I can not connect from phone (there is version 1.20.51) – is it possible connect? Or problem with connection is in different numbers of versions. I am not also sure about editions (at pc I thing I have java-edition and at phone i am not sure)
Hi,
this server is working with Minecraft Java edition only.
Best regards.
Hello, I created a server on snapshot 24w13a and I can’t get any of my friends to connect. I can get in but they get timed out when they try to join. Do you have a solution?
Hi,
Can you send us the error exactly?
Best regards.
the server isnt public, how t ofix that
you need to allow incoming traffic on port 25565
Best regards.