Hint: You can use the Tab key to autocomplete all filenames and directories, so you don't have to type in the complete file or directory name manually.
This tutorial was last checked and updated on December 21, 2020.
- If you havn't already done so, download the program "PuTTY".
- Connect to your root server or VPS/vServer via SSH using PuTTY. To do this, open PuTTY and enter the domain or IP address of your server in the text box named "Host Name (or IP address)". Then click the "OK" button below.
- Update your package lists with the command
- Now install any available updates of the packages already installed on your server using the command
apt upgrade -y.
- Then install Java. The installation command is:
For Debian 10 and Ubuntu:
apt install openjdk-11-jre-headless -y
For Debian 9:
apt install openjdk-8-jre-headless -y
- Install the software "screen". You'll need this to let the Minecraft server run in the background later, so you can close the PuTTY window without causing the Minecraft server to stop. Use the following command for the installation:
apt install screen -y
- Now add a user who will run the Minecraft Server on your Linux server. Use the following command:
adduser --disabled-login minecraft. In this example the user is called "minecraft". You can use a different name, but make sure to always use your own chosen user name instead of "minecraft" when you follow the next steps of this tutorial (e.g. "mcserver").
- You can skip all further information such as the name, telephone number, etc. by pressing enter as well.
- Now use the command
su minecraftto switch to your Minecraft user.
- Go to the home directory of this user by executing the command
cd. The home directory is named exactly like the user himself and therefore the path is "/home/minecraft".
- Then use the command
wget https://cdn.getbukkit.org/spigot/spigot-1.16.4.jarto download the latest version of Spigot. If you want to use Craftbukkit, the command is
- After the download is completed, you should see the downloaded JAR file using the command
- Next, create a start and a stop script. These two scripts let you start and stop your Minecraft server later. To create the start script named "start.sh", use the command
nano start.sh. Now the nano text editor opens. Here you need to enter the following command:
screen -AmdS minecraft java -Xms4096M -Xmx4096M -jar /home/minecraft/spigot-1.16.4.jar. Make sure you enter the correct filename of your previously downloaded JAR file. Instead of "4096", you can specify the amount of RAM in MB that you want to reserve for your Minecraft server. Important: Keep enough memory for the system and other software running on your Linux server.
- Now save the start script by pressing CTRL + X, then hit the "Y" key and press enter.
- Now create the stop script as well by executing the command
nano stop.sh. Within the nano editor you need to write the following command into your script:
screen -r minecraft -X quit. Save the stop script just like the start script by pressing CTRL + X, then hit the "Y" key and press enter.
- After that you have to assign execution permissions for these two scripts. You do that with the following command:
chmod +x start.sh stop.sh
- In order to be able to start the Minecraft server, you must first accept the license terms. To do this, execute the command
echo "eula = true" > eula.txt. This creates a file which indicates that you accepted these license terms.
- Then run the start script to start your Minecraft server. Use the command
- To get into the Minecraft server console, you need to open the screen background process. To do this, execute the command
screen -r minecraft. Under Debian 9, however, you must execute the command
script /dev/nullbefore using the screen command. If you are logged in as the user "root", you must first switch to the Minecraft user by executing the command
su minecraft. To exit the Minecraft server console, press CTRL + A and then press the "D" key.
- Your Minecraft server is now ready to use. You can start and stop it at any time. Just log in as the Minecraft user by executing the command
su minecraft, go to the Minecraft server directory using the command
cd /home/minecraftand execute the start or stop script (