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-get 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-get update
Then install AdoptOpenJDK using the following command:
apt-get 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
Then, you need to turn on Swap – ON
swapon /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 ~
Next, you need to create a folder for BuildTools
mkdir buildtools && cd buildtools
The next important step is downloading BuildTools.jar. This can be done as follows:
wget -O BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
Building Spigot 1.16.5
java -jar BuildTools.jar --rev 1.16.5
Note!
Make a note of the name of your spigot jar file. For example spigot-1.16.5.jar.
ls
Then you need to create a directory for your personal server.
cd ~ && mkdir spigot && cd spigot
Then, you need to move your spigot jar into your server directory
mv ~/buildtools/spigotname.jar ~/spigot/spigot.jar
Create a start up script for 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