Setup Spigot on Ubuntu

Updated on May 20, 2015
Setup Spigot on Ubuntu header image

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 backwards compatible with most CraftBukkit modifications, allowing you to make your server unique. In this guide, we will setup Spigot on Ubuntu Server.

Setting up Ubuntu Server

It is recommended to run all commands as a user with sudo privileges that is not root.

Start by ensuring that your server is up to date.

sudo apt-get update && sudo apt-get upgrade -y

Install the needed packages.

sudo apt-get install git openjdk-7-jre tar -y

Create a swap file

Allocate the desired amount of memory. Replace 1G accordingly.

sudo fallocate -l 1G /swapfile

Secure the permissions of your new swap file.

sudo chmod 600 /swapfile

Allocate the swap space.

sudo mkswap /swapfile

Turn on swap.

sudo swapon /swapfile

Make your swap file permanent. Add the line below to the bottom of the fstab file.

sudo nano /etc/fstab

/swapfile   none    swap    sw    0   0

Download and use BuildTools

Ensure you are in the home directory of the user used for installing Spigot.

cd ~

Create a folder for BuildTools.

mkdir build
cd build

Download BuildTools.jar Look for updates on their Jenkins page.

wget -O BuildTools.jar  https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

Configure git.

git config --global --unset core.autocrlf

Run BuildTools.jar.

java -jar BuildTools.jar

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

ls

Make a directory for your server.

cd ~
mkdir server
cd server

Move your spigot.jar into your server directory. Replace spigotname.jar with the name of your file.

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

Starting your server

Create a start up script for your server.

nano start.sh

Make start.sh match the following, replacing -Xmx1024M with the amount of RAM installed on your server.

#!/bin/sh

java -Xms512M -Xmx1024M -XX:MaxPermSize=128M -jar spigot.jar

Make start.sh executable.

chmod +x start.sh

Start your server.

./start.sh

Optional: Run your server in the background

Install screen.

sudo apt-get install screen -y

Open an instance of screen.

screen -S "Spigot Server"

Start your server script.

~/server/start.sh 

Troubleshooting

Accept EULA.

If you are asked to confirm eula.txt, change eula to true.

nano eula.txt

BuildTools.jar wont run?

You need more RAM on your server or a larger swap file.

start.sh can't run the file command on your jar file?

Check to ensure everything is typed exactly the same, Linux IS case sensitive.

Want to download a specific Minecraft version?

java -jar BuildTools.jar --rev 1.8.4

Replace 1.8.4 with the version of your choice.