Minecraft Server Installation

How Can We Help?

Minecraft Server Installation

You are here:
< Back to the Wiki

Do you want to host your own Minecraft server? This article will explain installing a Minecraft 1.20.2 Vanilla server using SpigotMC. This article will probably also work for plain vanilla, PaperMC, and others.

Choose Your Server

There are different Minecraft Servers available. More information can be found at . Below is a list of popular servers.

  • Vanilla: Plain Minecraft server from the creators (minecraft.net)
  • Bukkit: Was a set of community-built, open-source tools envisioned and developed to ease the creation of multiplayer plugins (discontinued)
  • SpigotMC: A fork of the popular Bukkit server mod. Spigot is meant to increase performance and efficiency while maintaining compatibility with Bukkit plugins (spigotmc.org)
  • PaperMC: Improves Minecraft’s ecosystem with fast, secure software and an expanding plugin API, providing quick releases and helpful support as the most widely used, performant, and stable software available. (papermc.io)

In this article, we will cover the installation of a SpigotMC server.

For future notice, the Minecraft Java Edition changelog can be found at minecraft.fandom.com.

Prerequisites

According to the server requirements (minecraft.wiki), Minecraft requires the following resources:

  • One core for Minecraft is enough, however, more does not hurt, so we used 4 CPUs
  • At least 1GB of RAM, however, this relies upon the amount of players, interactions, and mods, so we used 4GB
  • Minecraft runs by default on port 25565 using TCP, so make sure to port forward this port

For future notice, the SpigotMC changelog can be found at spigotmc.org.

Installation

Java

Minecraft runs on Java, so we have to install that first. Since we only use Java we do not need the Java Development Kit (JDK), so we install the Java Runtime Environment (JRE). For Minecraft we need JRE 17, so type apt-get install openjdk-17-jre.

SpigotMC Minecraft Server

For this article we will download version 1.20.2 from getbukkit.org, however, it is also possible to build the jar file using the official BuildTools, more information at spigotmc.org. To download SpigotMC run:

wget https://download.getbukkit.org/spigot/spigot-1.20.2.jar

No start the server by running java -jar spigot-1.20.2.jar.

This will fail since you have to accept the EULA, do this by changing false to true in eula.txt.

No run the server again using java -jar spigot-1.20.2.jar. This will start your Minecraft server. To stop it type stop in the console.

Service

Now, we have a Minecraft server, however, this requires manual interaction, therefore, we have to create a service.

To do this open /etc/systemd/system/minecraft.service, and add the following:

[Unit]
Description=Minecraft Server
After=network.target

[Service]
RemainAfterExit=yes

WorkingDirectory=/mnt/minecraft

ExecStart=/usr/bin/screen -dmS minecraft /usr/bin/java -jar -Xms512M -Xmx4G -DIReallyKnowWhatIAmDoingISwear=true spigot-1.20.2.jar nogui

ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN IN 15 SECONDS..."\015'
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN IN 10 SECONDS..."\015'
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "say SERVER SHUTTING DOWN IN 5 SECONDS..."\015'
ExecStop=/bin/sleep 5
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "save-all"\015'
ExecStop=/usr/bin/screen -p 0 -S minecraft -X eval 'stuff "stop"\015'
ExecStop=/bin/sleep 5

[Install]
WantedBy=multi-user.target

Save the file. Take note that the start command uses some parameters, most of which are explained in the section Server Tweaks. However, also note that it mentions the software called screen. This enables us to run Minecraft in a screen and go back and forth between the console interface. Install this using apt-get install screen.

Now, reload the system daemon using systemctl daemon-reload. Start the service using systemctl start minecraft.

To connect to the screen with the server output run screen -rd minecraft. Once in the screen use CTRL + A + D to go back to your normal terminal.

If everything works fine run systemctl enable minecraft to enable the service.

Server Tweaks

To run the Minecraft server you can simply run java -jar minecraft-server.jar, however, you can tweak this as follows:

  • -Xms512M: This gives Minecraft an initial memory size of 512M
  • -Xmx4G: This allows Minecraft to use a maximum of 4G
  • -DIReallyKnowWhatIAmDoingISwear=true: Only use this if you know what it does
  • nogui: Run Minecraft without a GUI

More information can be found at minecraft.wiki.

It is also recommended to modify your server.properties.
If you want to make the server available for only your friends make sure to set enfore-whitelist=true. To add someone to the whitelist type whitelist add __PLAYER__. To make someone server operator type op __PLAYER__.

More information can be found at minecraft.fandom.com.

To modify the Spigot configuration, edit the spigot.yml, more information can be found at spigotmc.org.

Sources

2 Responses

  1. Charline says:

    I found some fresh ideas in the post. The author have delivered it well. Thank you for educating me.

  2. Millard says:

    Your writing approach is captivating. I enjoy myself completely absorbed in your articles.

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents