How To Install Spigot on Ubuntu 20.04

Spigot is a modification of the Minecraft CraftBukkit server software. It is very well compatible with most CraftBukkit mods to make your server unique. This article will help you install Spigot correctly and quickly for your server on Debian 10

Installing the Necessary Utilities

Having installed the necessary utilities, first you need to start transport-https. This can be accomplished with the following command:

apt install wget apt-transport-https gnupg

This is followed by spoiling the AdoptOpenJDK GPG key. This can be done using wget:

wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public | sudo apt-key add -

Set up a suitable AdoptOpenJDK repository using the command below:

echo "deb https://adoptopenjdk.jfrog.io/adoptopenjdk/deb $(cat /etc/os-release | grep UBUNTU_CODENAME | cut -d = -f 2) main" | sudo tee /etc/apt/sources.list.d/adoptopenjdk.list

After that, it is recommended to update Debian packages:

apt update

Then install AdoptOpenJDK using the following command:

apt install adoptopenjdk-11-hotspot -y

Create a Swap file

To create a swap file. In the example, a 2 GB file is allocated, but you can set the value yourself as you like and use your resources

fallocate -l 2G /swapfile

You need to set permissions for the paging file. This can be done using the following command:

chmod 600 /swapfile

Allocate space needed for swap

mkswap /swapfile

Make your swap file permanent by modifying the fstab file

nano /etc/fstab

The final step for creating a swap file is to add a specific line to the end of the file:

/swapfile   none    swap    sw    0   0

Downloading and Running BuildTools

Make sure you are in the correct directory as Spigot was installed

cd ~

Then you need to create a dedicated folder for Spigot. Below we are talking about Spigot, which is loaded in version 1.16.5.

mkdir buildtools && cd buildtools
wget -O BuildTools.jar  https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
$ java -jar BuildTools.jar --rev 1.16.5

Please, Note of the name of your spigot jar file. For example spigot-1.16.5.jar

ls

Create a directory for your server

cd ~ && mkdir server && cd server

Move the jar with faucet to your server directory. Then you need to replace spigotname.jar with your file name

mv ~/buildtools/spigotname.jar ~/server/spigot.jar

Start Your Server

Create a start up script – it is necessary to start your server

nano start.sh

Then you need to paste the following into start.sh. The 4G options in -Xms4G -Xmx4G configure the Java heap space for 4GB of RAM. Change this to the amount of RAM you want to allocate for Spigot. The operating system also requires available RAM, please do not assign all available RAM to Spigot. For example, if the VPS has 8GB of RAM, you might consider installing -Xms7G -Xmx7G

#!/bin/sh
while true
do
java -Xms4G -Xmx4G -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
echo "restarting in 10"
sleep 10
done

Make start.sh executable

chmod +x start.sh

The first time it loads, it prompts you to accept the EULA and fails to load. The script then loops, and you need to type CTRL + C to exit the script at this point. Edit eula.txt.

nano eula.txt

Change eula= from false to true. Save and exit the file. Then, after successfully saving, start your server

./start.sh

Was this article helpful?

Related Articles