If you run a Minecraft server, Spigot (Or PaperMC, a Spigot fork with additional performance changes, which provides their own pre-built server jar files) is the way to go when it comes to what software you use to run your server. Spigot is a high performance, constantly maintained Minecraft server that runs over 60% of all servers worldwide. This is a short guide on how to compile Spigot with their provided "BuildTools", how to allow firewall access to the default port, and how to start the server.

You can watch our terminal recording for this guide, which is the full output running on AlmaLinux 8. Otherwise, keep scrolling down for the step by step text guide.

 

First and foremost, go ahead and update all of your system packages. This isn't required, but is always a good thing to do often.

sudo yum update -y
Note: "yum" and "dnf" is the same, "dnf" is simply used in CentOS 8 and later.

Now install git and wget. Git is required to grab and compile the files, wget is needed to download BuildTools, and nano is an easy to use linux text editor.

yum install wget git nano -y

Now we need to install Java. Java 17 is required for Minecraft 1.18.X releases as of late 2021. If you want to run an older game version, you need to install Java 8. Read our Java 8 JDK install guide here to do this easily.

yum install java-17-openjdk -y

Now lets make a new directory to put our BuildTools in, to keep everything clean. In this we'll be using /root/buildtools/ as our example.

mkdir /root/buildtools/
cd /root/buildtools/

Download the latest BuildTools version using the command below, once inside the directory above.

wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

Once that's downloaded, we need to run a git command then the Jar file to start downloading and compiling the files. You need at least 1.2GB~ of free RAM to successfully run BuildTools. If you don't, it won't work!

java -jar BuildTools.jar

Once you've ran this command, it will start. It may take around 5-10 minutes to complete on your first run depending on your hardware and network connection. The output when it is completed should look something like this:
Success! Everything compiled successfully. Copying final .jar files now.
Copying craftbukkit-X-SNAPSHOT.jar to /root/buildtools/.
  - Saved as craftbukkit-X.jar
Copying spigot-C-SNAPSHOT.jar to /root/buildtools/.
  - Saved as spigot-X.jar

Now we can see our compiled Spigot jar is saved as "spigot-X.jar" (we've replaced the actual version with "X"). This will change depending on the current version of the game that it's built for. Lets make a new directory for our Spigot server to run in to keep everything clean, then move our compiled Jar file to it and change to that directory.

mkdir /home/spigot/
mv spigot-*.jar /root/home/spigot.jar
cd /home/spigot/

Once we're in the new directory with our spigot-X.jar lets create a new text file to accept the Mojang EULA, which is required to run the server.

nano eula.txt

Once you've opened the nano text editor type "eula=true" then press CTRL + X then press Y to save the file.

Now we can start the Spigot server. Run the following command to do so:

java -Xmx2G -Xms2G -jar spigot.jar

Replace "2G" with the amount of memory that you want to allocate to the server, in this we're using 2G (2 Gigabyte). Note that newer version of Minecraft require more RAM to run properly. If you are using a VPS and get a "Killed" message and your Spigot server crashes, then it's ran out of memory and was killed by the operating system OOMKiller which reserves RAM for essential OS processes.

That's it. Your Spigot server should run now and generate a world. You can connect using your servers IPv4 address.

If you aren't able to connect, you may need to add a firewall rule to allow traffic to the Minecraft port. Run the commands listed below to do this.

iptables -I INPUT -p tcp --dport 25565 --syn -j ACCEPT

Or if using firewalld.

firewall-cmd --permanent --zone=public --add-port=25565/tcp

You can stop the server by typing "stop" in your servers console and pressing enter. Once it's stopped you can edit the server.properties file to change things such as the IP address it's binded to, the port number, world type, and more.

By default your server will stop when you close your current SSH session. If you want your server to run in the background 24/7 when you aren't connected to SSH, you need to use "screen". It's easy to do. First install screen.

yum install screen -y

Then start a new screen session, we'll call it minecraft:

screen -S minecraft

Make sure the -S is uppercase above. Once you've ran this you will be entered into the new screen session. Here you can run the same command above that you started the Spigot Minecraft server with. Once you've started your Minecraft server you can press CTRL + A the press D to detach (exit) from the screen session. If you want to open the screen session in the future, just type "screen -r minecraft". To list all current screen sessions that are active type "screen -ls" in SSH.

Need a Minecraft server? Check out our website for Minecraft hosting and VPS hosting plans.

Was this answer helpful? 36 Users Found This Useful (756 Votes)