How to Install Spigot Minecraft Server on Ubuntu

Figuring out 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. 

So, let’s step right in!

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.    

$ sudo apt update

Use the following commands on the terminal to install Java and Git.

$ sudo apt install openjdk-17-jre-headless
install
$ sudo apt install git
Spigot Minecraft Server on Ubuntu

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. 

$ sudo ufw status

You will see such an output in case it is not enabled. 

Spigot Minecraft Server on Ubuntu

Allow your SSH port so that the UFW does not break the enabling connection.

$ sudo ufw allow OpenSSH

Next, you need to open port 25565.

$ sudo ufw allow 25565
allow

The final step is to enable the UFW firewall. 

$ sudo ufw enable

You will see this message when you enter the command. 

sudo


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
Spigot Minecraft Server on Ubuntu

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.

Spigot Minecraft Server on Ubuntu

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:

$ sudo nano spigotstart.sh

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

Spigot Minecraft Server on Ubuntu

Next, using the $chmod command, make the Spigot startup script executable. 

$ chmod +x spigotstart.sh

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

$ sudo nano eula.txt

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

Leave a Reply

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