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 9, 2018.

Are you looking for very good, powerful and cheap servers? I've been renting my servers at Contabo for 5 years now and I can highly recommend Contabo to everyone!
  1. If you havn't already done so, download the program "PuTTY".
  2. 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.
  3. For Debian 8 (no longer necessary with Debian 9): Use the command echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list to add the Debian backports repository which is needed to install Java.
  4. Update your package lists with the command apt-get update.
  5. Now install any available updates of the packages already installed on your server using the command apt-get upgrade -y.
  6. Then install Java 8. The installation command is:
    For Debian 8: apt-get install -t jessie-backports openjdk-8-jre-headless -y.
    For Debian 9: apt-get install openjdk-8-jre-headless -y.
  7. 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-get install screen -y
  8. Now add a user who will run the Minecraft Server on your Linux server. Use the following command: adduser 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").
  9. Set a secure password for your Minecraft user. There are no characters displayed during input, but this is normal. Confirm the password you set by pressing enter. You can skip all further information such as the name, telephone number, etc. by pressing enter as well.
  10. Confirm your entered information by pressing enter again.
  11. Now use the command su minecraft to switch to your Minecraft user.
  12. 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".
  13. Then use the command wget https://cdn.getbukkit.org/spigot/spigot-1.13.2.jar to download the latest version of Spigot. If you want to use Craftbukkit, the command is wget https://cdn.getbukkit.org/craftbukkit/craftbukkit-1.13.2.jar.
  14. After the download is completed, you should see the downloaded JAR file using the command ls.
  15. 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.13.2.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.
  16. Now save the start script by pressing CTRL + X, then hit the "Y" key and press enter.
  17. 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.
  18. 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
  19. Then run the start script to start your Minecraft server. Use the command ./start.sh
  20. The first time you start the Minecraft server, it will be stopped immediately. This is normal since you now need to open the newly created file called "eula.txt" with the command nano eula.txt and change the value of "eula" from "false" to "true" to accept the license terms. After you have done this, save this file by pressing CTRL + X, then hit the "Y" key and press enter.
  21. Now start the Minecraft server again by running the start script with the command ./start.sh. Your Minecraft server is now running in the background.
  22. To get into the Minecraft server console, you need to open the screen background process. To do this, execute the command screen -r minecraft. This only works if you either close PuTTY, reopen PuTTY, connect to your root server or VPS/vServer and then log in directly with the user "minecraft" instead of "root" or if you run the command script /dev/null first. To exit the Minecraft server console, hold down the CTRL key and press the "A" and "D" keys one after the other.
  23. Your Minecraft server is now ready to use. You can start and stop it at any time. Just log in to your root server or VPS/vServer as the Minecraft user (either directly at the SSH login in PuTTY or with the command su minecraft). Then go to the Minecraft server directory (using the command cd /home/minecraft) and execute the start or stop script (./start.sh or ./stop.sh).