A Minecraft server, or just a game server, is a server that hosts multiplayer games for Minecraft Java Edition. Players can design personalized multiplayer experiences by running their own Minecraft Java server. Owners of servers have the ability to alter game modes, environment settings, difficulty settings, and even install mods or plugins to improve gameplay. A vast variety of gaming experiences, from inventive construction projects to survival challenges, are made possible by this adaptability.
System running in Linux Distribution like Ubuntu 22.04. You can deploy Ubuntu on a cloud server in Hostman.
Root access or user with sudo
privileges.
Minimum 4GB of RAM
After all requirements are met, proceed with the creation of Minecraft Java Server.
In order for Minecraft to function, Java must first be installed on the server. To accomplish this, perform the command below to add the PPA of the Java source and press ENTER:
sudo add-apt-repository ppa:openjdk-r/ppa
Accept this addition by updating the package sources, run command:
sudo apt update
Java installation is now ready, run the command and type “Y” to install it:
sudo apt install openjdk-17-jre-headless
Validate if java is installed, run the command:
sudo java --version
/MineCraft
in order to have a separate folder for the application. Run the command:mkdir /MineCraft
Go to the created directory, /MineCraft
, by running the command:
cd /MineCraft
To verify if you are working on the newly created directory, run the command below. It should show the path /MineCraft
in the output:
pwd
Download the installer from the Official Minecraft Server Download. Run the command below:
wget https://pistondata.mojang.com/v1/objects/8dd1a28015f51b1803213892b50b7b4fc76e594d/server.jar
When the download has finished 100%, check to see if it is successful. Verify it by running the command below. A file named server.jar
should be visible in the output.
ls -lrt
The Minecraft server is now prepared for configuration and operation, but before doing so, certain software needs to be installed in order to make sure the server continues to function even after a session ends. This software is referred to as screen
. This makes it possible for the Minecraft server to continue operating even if the session is terminated or disconnected. Install screen by running the command:
sudo apt install screen
sudo ufw status
inactive
– firewall is disabled.
active
– firewall is enabled.
Since the system will be used as a server and several clients will connect to it, it is recommended to enable the firewall for security reasons (like preventing server hacking).
First, allow port 22 for SSH access. Run the command below:
sudo ufw allow 22
Then allow port 10050 for statistics collection in the control panel.
sudo ufw allow 10050
Lastly, Minecraft uses port 25565 by default. To allow this port, run the command:
sudo ufw allow 25565
Enable firewall so changes will take effect. To do this, run the command below and type “y” to proceed with the operation.
sudo ufw enable
Verify the status of the firewall again and make sure all the ports added are now visible in the firewall table. Run the command below.
sudo ufw status
The server is now ready to configure and run the Minecraft server.
sudo screen
Once the display above is shown, just press the space bar and the session will start.
To do the initial configuration, run the command:
sudo java -Xms1024M -Xmx1024M -jar server.jar nogui
server.jar
is the jar file downloaded from the previous step.
Xms1024M
: Server starts with 1024 MB (1 GB) of RAM. Depending on user preference, the limit may be increased.
Xmx1024M
: Server is configured to consume a maximum of 1024 MB (1 GB) of RAM. Depending on user experience while playing the game, the maximum can be increased anytime if the server is running slow.
jar
: which server's jar file to launch.
nogui
: server will not start on a graphical user interface (GUI).
The error that appears below is to be expected; Minecraft does this on purpose to make sure the user have read and agreed to the EULA.
To fix this error, accept the EULA agreement. To do this, run the command below to open the file eula.txt
and change the line eula=false
to eula=true
.
sudo nano eula.txt
Click Ctrl + X, then Y and Enter to save and exit.
Now rerun the command below. The initialization will take time for initial setup. Wait for it to complete.
sudo java -Xms1024M -Xmx1024M -jar server.jar nogui
Verify if the server is up and running by typing help
. The server is up and running if the display is like below.
You can always change the setting of the server by modifying the file server.properties
. The common settings used are gamemode, motd, pvp, and difficulty.
To make sure Minecraft server is listening or accepting connections, run the command below. The output should display (LISTEN).
sudo lsof -i:25565
If everything is all set on the server, it is now time to test the server.
Click Multiplayer and Add Server.
Enter the IP address of the Minecraft server created. In this case it is 66.248.207.36. Click Done.
The server will now show on the list of servers on multiplayer.
Click to join server and wait for it to connect.
The connection was established between the Server and client. The logs will show that the user (jc) joined the game.
It is now ready to play.
In conclusion, setting up a Minecraft server creates an array of opportunities for players to interact, work together, and create in the expansive game world. Even though it might seem difficult at first, a user can successfully set up his own server and go on thrilling multiplayer adventures with friends by following the instructions in this guide. By configuring settings, inviting friends to join, and experimenting with the countless customization options available, a user can create a distinctive and immersive multiplayer environment that offers endless hours of entertainment and companionship.