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 April 3, 2023.

Are you looking for very good, powerful and cheap servers? I've been renting my servers at Contabo for more than 10 years 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. Update your package lists with the command apt update.
  4. Now install any available updates of the packages already installed on your server using the command apt upgrade -y.
  5. Next, install the packages needed for future installations in this tutorial by executing the following command: apt install gnupg curl dirmngr nano unzip -y
  6. Next, install Java:
    For up to Debian 10:
    1. Use the command apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 73C3DB2A to add the key needed for the Java repository.
    2. Add the repository by executing the command echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu focal main" | tee /etc/apt/sources.list.d/java.list.
    3. Now update your package lists again with the command apt update.
    4. Install Java with the following command: apt install oracle-java17-installer -y
    5. Accept the license terms by selecting the "OK" button using the Tab key, confirming the selection with Enter, selecting the "Yes" button using the arrow keys, and then pressing Enter again.
    For Debian 11:
    1. Install Java with the following command: apt install openjdk-17-jre-headless -y
    For Ubuntu:
    1. Install the package for managing repositories using the following command: apt install software-properties-common -y
    2. Add the repository by executing the command add-apt-repository ppa:linuxuprising/java and pressing enter.
    3. Now update your package lists again with the command apt update.
    4. Install Java with the following command: apt install oracle-java17-installer -y
    5. Accept the license terms by selecting the "OK" button using the Tab key, confirming the selection with Enter, selecting the "Yes" button using the arrow keys, and then pressing Enter again.
  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 install screen -y
  8. 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").
  9. You can skip all further information such as the name, telephone number, etc. by pressing enter as well.
  10. Now use the command su minecraft to switch to your Minecraft user.
  11. 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".
  12. Then use the command wget https://download.getbukkit.org/spigot/spigot-1.19.4.jar to download the latest version of Spigot. If you want to use Craftbukkit, the command is wget https://download.getbukkit.org/craftbukkit/craftbukkit-1.19.4.jar.
  13. After the download is completed, you should see the downloaded JAR file using the command ls.
  14. 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.19.4.jar nogui. 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.
  15. Now save the start script by pressing CTRL + X, then hit the "Y" key and press enter.
  16. 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.
  17. 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
  18. 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.
  19. Then run the start script to start your Minecraft server. Use the command ./start.sh
  20. 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/null before 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.
  21. 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/minecraft and execute the start or stop script (./start.sh or ./stop.sh).