In this article, we will have explained the necessary steps to install and configure Minecraft Server on Debian 9. 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 popular games of all time. It is a sandbox video game about building various structures and going on adventures.
Install Minecraft Server on Debian 9
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
Step 2. Install Java Runtime Environment.
Install the required dependencies. You will need at least Java 7, but Java 8 is HIGHLY recommended. OpenJDK is fine:
Verify the installation by printing the java version:
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 Debian.
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 27 03:33:56 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 nano 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:
Congratulation, you have learned how to install and configure Minecraft on Debian 9 Stretch. If you have any question, please leave a comment below.