LinuxTutorialsUbuntu

How To Install Spigot on Ubuntu 20.04 LTS

Install Spigot on Ubuntu 20.04

In this tutorial, we will show you how to install Spigot on Ubuntu 20.04 LTS. For those of you who didn’t know, Spigot is a modification of the Minecraft server software, CraftBukkit. Spigot optimizes server resource usage, ensuring your players have the best experience and is also backward compatible with most CraftBukkit.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Spigot on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Prerequisites

  • A server running one of the following operating systems: Ubuntu 20.04, 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Spigot on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade
sudo apt install wget apt-transport-https gnupg

Step 2. Installing AdoptOpenJDK.

Now we import the AdoptOpenJDK GPG key:

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

Next, add AdoptOpenJDK’s apt repository:

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, run the following commands to install AdoptOpenJDK:

sudo apt update
sudo apt install adoptopenjdk-11-hotspot

Step 3. Configure Swap File.

Now we 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

Set the permissions of the swap file:

sudo chmod 600 /swapfile

Next, allocate the swap space:

sudo mkswap /swapfile
sudo swapon /swapfile

Make your swap file permanent by modifying the fstab file:

nano /etc/fstab

Add this line to the bottom of the file:

/swapfile   none    swap    sw    0   0

Step 4. Installing Spigot on Ubuntu 20.04.

First, we create a dedicated folder for Spigot. Below we are talking about Spigot, which is loaded in version 1.16.5:

cd ~
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

Make note of the name of your spigot jar file. For example, spigot-1.16.5.jar:

ls

Next, create a directory for your Ubuntu server:

cd ~ && mkdir server && cd server

Then, move your spigot jar into your server directory. Replace spigotname.jar with the name of your file:

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

Next steps we create a startup script:

nano start.sh

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
./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:

nano eula.txt

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

./start.sh

Congratulations! You have successfully installed Spigot. Thanks for using this tutorial for installing the Spigotl in Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you to check the official Spigot website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button