Today we will see how to install a Minecraft server on Debian 11. This installation is relatively simple and fast. To avoid any slowdown in the game, install it on a powerful machine. Take a look at the recommended configurations for your desired version before deploying your server.
First deploy your Debian system.
Then update your distribution with the commands :
apt update
apt upgrade
We are now going to deploy Java on the server, Java being a prerequisite for Minecraft. First of all we will search for the most updated version of the jdk with the command :
apt search jdk
Among the list look for the most recent stable version. Here open-jdk-17 :
apt install open-jdk-17-jdk
To check the good progress of the installation, you can execute the command :
java -version
To check the good progress of the installation, you can execute the command :
/sbin/adduser minecraft
Then type the password.
Add your user to the sudoers group with the usermod command :
/sbin/usermod -aG sudo minecraft
Now we can deploy Minecraft on the server.
Create a new Minecraft folder with the command mkdir :
mkdir minecraft
Then open your new folder :
cd minecraft
We will now download Minecraft. To know the last version. Go to the page :
https://www.minecraft.net/fr-fr/download/server
Modify the following command according to the version to download. Here it is 1.17.1 :
wget https://launcher.mojang.com/v1/objects/a16d67e5807f57fc4e550299cf20226194497dc2/server.jar
We are now going to create a script to start the server :
sudo nano start.sh
Here is the content to place in the startup script :
java -Xms1024M -Xmx2560M -jar server.jar nogui
Depending on the resources of your machine, you can change the Xmx value.
Then we make the script executable :
sudo chmod +x start.sh
You can now start the server with the command :
./start.sh
At the first launch, you must accept the « eula » contract.
Edit the file eula.txt :
sudo nano eula.txt
Change the value « false » to « true
eula=true
Now restart your server with the script :
./start.sh
To stop the server, simply type « stop » :
stop
If you are using a firewall on your machine like ufw, open the Minecraft port (by default 25565) :
sudo ufw allow 25565
You can now launch the game and connect to your server via the multiplayer mode :
Enter the server settings (IP address and port, the default port is 25565) :
You should then join the server. To access it from the internet, configure the port forwarding on your internet router.