How To Install Paper (with Spigot) on Ubuntu 20.04

Paper is a high-performance fork of Spigot. It aims to fix inconsistencies between gameplay and mechanics. Paper has many unique features and changes, including many performance improvements not found in Spigot.

Install the required components

Paper requires the installation of the necessary components for its correct and fast operation. First, you need to install what is indicated by the command below:

apt-get install wget apt-transport-https gnupg

After successfully installing these components, you need to import the AdoptOpenJDK GPG key

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

This is followed by setting up the appropriate repositories for this imported key:

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

Update your package index

apt-get update

Install AdoptOpenJDK. This can be done using the command below:

apt-get install adoptopenjdk-11-hotspot -y
apt-get install jq -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

Install Paper

Before installing, you need to make sure that you are currently located in your home directory.

cd ~

Create a folder for Paper and download the latest build. This example downloads Paper version 1.16.5. If you need a different version, replace 1.16.5 with the version you want to download.

mkdir paper
cd paper
LATEST_BUILD = $ (curl -X GET "https://papermc.io/api/v2/projects/paper/versions/1.16.5" -H "accept: application / json" | jq '.builds [-1]' )
curl -o paperclip.jar -X GET "https://papermc.io/api/v2/projects/paper/versions/1.16.5/builds/$ {LATEST_BUILD }/downloads/paper-1.16.5-$ {LATEST_BUILD } .jar "-H" accept: application /
java-archive "-JO

Replace “BUILD_ID” in the next command with the desired assembly.

curl -o paperclip.jar -X GET "https://papermc.io/api/v2/projects/paper/versions/1.16.5/builds/ [BUILD_ID ]/downloads/paper-1.16.5- [BUILD_ID]. jar "-H" accept: application / java-archive "-JO

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

Leave A Comment?