Setup Spigot Minecraft Server on AlmaLinux / Rocky Linux / CentOS
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.
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!
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.
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.
Then start a new screen session, we’ll call it 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.
How to Install Spigot Minecraft Server on Ubuntu
If you are fond of video games, there is a high chance that you have heard the name “Minecraft”. Since coming out back in 2011, Minecraft has become one of the most popular and the most played games in the world. In 2020, it was estimated that about 131 million people in the world had played it.
You can play the game in both the single and multiplayer modes. For the multiplayer mode, you need to create online servers to play. Once servers are created, other players can join in, and you can have fun playing with your friends or other people online. There are multiple server softwares available, with Spigot being one of the most popular.
Spigot is an open-source server based on CraftBukkit. Some of the added advantages of Spigot servers include multiple plug-ins available that can make your server unique and improve the experience. There are also a variety of pre-built servers that you can use to host games.
If you are a user of Ubuntu or other Linux distros and wish to install Spigot Minecraft server to enhance your gaming experience, look no further. This is a comprehensive step-by-step guide to help you achieve just that.
Step 1: Install Java and Git.
For Spigot to work, you need to have Java and Git on your system, so, your first step is to install both programs. But before that, update your system to repositories, so you get the latest versions of the packages you are installing.
Use the following commands on the terminal to install Java and Git.
$ sudo apt install openjdk-17-jre-headless
Next, we move on to configuring the firewall.
Step 2: Configuring the Firewall.
On your Ubuntu system, you have the UFW firewall (Uncomplicated FireWall). You need to enable it before running Spigot. Follow these steps to configure UFW.
Use this command to check whether UFW is working or not.
You will see such an output in case it is not enabled.
Allow your SSH port so that the UFW does not break the enabling connection.
Next, you need to open port 25565.
The final step is to enable the UFW firewall.
You will see this message when you enter the command.
Step 3: Install Spigot.
The next step of how to install Spigot Minecraft server on Ubuntu is to download the Spigot server on your system. Follow these steps.
First, you will add the BuildTools.jar application. You can do this through this command.
$ wget -O BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
Next, using BuildTools, create a Spigot server using the following command.
$ java -jar BuildTools.jar --rev latest
This process could take a while so be patient while the server is being built.
Make a note of the Spigot file that is created. You can do this using the $ls command. After noting the filename, put your Spigot server into a new directory.
$ mkdir Spigot && cd Spigot $ mv ~/source directory ~/Spigot
With this, you are done with installing Spigot. The next step is to start the Spigot server.
Step 4: Starting the Spigot Server.
To initialize and use the Spigot server, it’s required to make sure that it can accept various Java parameters. For this, we will make edits to the startup script of Spigot. Enter the following command in your Terminal:
When the file opens, the following code is to be pasted there. After adding the code, save and exit the file.
#!/bin/sh java -Xms3G -Xmx3G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar spigot.jar nogui
Spigot Minecraft Server on Ubuntu
Next, using the $chmod command, make the Spigot startup script executable.
There are different combinations and ways you can use the $chmod command in Linux. You can click the link to go through a comprehensive guide on the $chmod command.
Now, we make an important edit to the “ eula.txt ” file. Run the following command in your Terminal.
Change the value of “eula” to true. Once you are done with this, you won’t have any problem starting the Spigot server. However, to use Minecraft and Spigot simultaneously, you need to make Spigot run in the background as well. This can be done in the next step.
Step 5: Run Spigot as a Service.
The first step involves creating a Spigot service file. You can do that by running the following command.
$ sudo nano /etc/systemd/system/spigot.service
Once it is opened, the following code is to be pasted there.
[Unit] Description=SpigotMC After=network.target [Service] Type=forking User=minecraft Group=minecraft ExecStart=/usr/bin/screen -d -m -S minecraft /home/minecraft/server/spigotstart.sh ExecStop=/usr/bin/screen -S minecraft -p 0 -X stuff "stop$(printf \\r)" WorkingDirectory=/home/minecraft/server [Install] WantedBy=multi-user.target
Once you are done with this, run the following commands to reload, enable and start the Spigot service
$ sudo systemcl-daemon reload $ sudo systemcl enable spigot $ sudo systemcl start spigot
After running all of the above commands, you can now use Spigot servers with Minecraft.
Now we’ve reached the end of our guide on how to install Spigot Minecraft server on Ubuntu and other Linux distros. We looked at the different necessary steps to successfully create a Spigot server. There are various things you need to set up and enable first before starting the Spigot server, so make sure you follow all the steps clearly.
We hope that we were able to help you out so you can finally enjoy the Spigot Minecraft experience. For further queries, please let us know in the comments.
If this guide helped you, please share it 😊
Author
Well-versed with most things Linux, and motivated to share whatever I’ve learned with the rest of the world.