How to Set Up a Spigot Minecraft Server on Linux

Posted on December 15th, 2015



Awhile ago, I wrote an article about how to setup a Vanilla Minecraft server on Linux. I received some questions from readers about how they could add mods to their server. The most popular plugins are known as Bukkit Plugins. In order to use these plugins, you need to be running a server that allows plugins to be installed, such as a Spigot server.

In this tutorial, I will show you how to setup a Spigot Minecraft Server on Linux (Ubuntu Server 14.04).

Installing the Minecraft Server Requirements

First, let's make sure our server is up to date:

sudo apt-get update
Once updates are complete, check to see if Java is installed on our server:

java -version
If no Java version gets displayed, you will need to install it before preceeding:

sudo apt-get install default-jdk


Setup a Minecraft User:

Now that our server is up to date, let's setup a minecraft user:

sudo adduser minecraft

Now let's login as the minecraft user:

sudo su - minecraft

Install the Spigot Minecraft Server

First, let's download and build SpigotMC (do this from /home/minecraft):

mkdir build
cd build
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
java -jar BuildTools.jar

Now we will move the .jar file that was created to a server folder.

mkdir ../server
cd ../server
mv ../build/spigot-1.*.jar spigot.jar

Next we will create a short script that will launch our Minecraft server. To create it in Nano, do the following:

sudo nano minecraft.sh

Once the editor is open, put the following lines into the script. Once done, save the file, and close Nano.

#!/bin/bash
cd /home/minecraft/server

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

The flag Xmx specifies the maximum memory allocation pool for a Java Virtual Machine, while Xms specifies the initial memory allocation pool. I would adjust the Xmx flag accordingly, depending on how much RAM is available on your machine. I would not recommend using the maximum amount of RAM available to you.

Now we have to make sure to make our new file executable before continuing:

sudo chmod +x /home/minecraft/server/minecraft.sh

Launching our Minecraft Server

Finally, to run the server, simply execute the script you previously made.

./minecraft.sh

You are going to see a message that says something along the lines of "You need to agree to the EULA in order to run the server..." Open eula.txt and set the value to true:

# /home/minecraft/server/eula.txt
eula=true

You should now be able to run ./minecraft.sh again, and launch your server.

Modifying the Server Properties

In order to modify the server properties, edit the file located at /home/minecraft/server/server.properties

One of the values you will want to change is the "gamemode" value. Here are the available values
  • 0 - survival
  • 1 - creative
  • 2 - adventure
  • 3 - spectator
Difficulty can also be adjusted:
  • 0 - peaceful
  • 1 - easy
  • 2 - normal
  • 3 - hard
Installing Plugins

To add plugins to our server, you need to download the .jar file for the plugin and place it in the /home/minecraft/server/plugins directory:

wget -P /home/minecraft/server/plugins/ --content-disposition [plugin_url]
Here is an example:

wget -P /home/minecraft/server/plugins/ --content-disposition http://www.curse.com/bukkit-plugins/minecraft/permissionsex/882992

Once the plugin is downloaded, you will need to restart your server in order for it to take effect. You can hit CTRL+C to stop your server.

Here is a great list of some of the top plugins available:


Please feel free to leave any questions or comments below!

comments powered by Disqus
Andrew Backes

A Software Engineer living in Milwaukee, WI. Passionate about web/software development, tech, open source, and gaming.