Setup Spigot Minecraft Server on CentOS

If you run a Minecraft server, Spigot is the way to go when it comes to what software you use to run your server. Spigot is a high performance, constantly maintained Minecraft server that runs over 60% of all servers worldwide. This is a short guide on how to compile Spigot with their provided "BuildTools", how to allow firewall access to the default port, and how to start the server.

First and foremost, go ahead and update all of your system packages. This isn't required, but is always a good thing to do often.

sudo yum update -y

Now install git and wget. Git is required to grab and compile the files, wget is needed to download BuildTools, and nano is an easy to use linux text editor.

yum install wget git wget nano -y

Now we need to install Java. This isn't required for BuildTools, but we will need it later on to run the Minecraft server. Read our Java 8 JDK install guide here to do this easily.

Now lets make a new directory to put our BuildTools in, to keep everything clean. In this we'll be using /root/buildtools/ as our example.

mkdir /root/buildtools/
cd /root/buildtools/

Download the latest BuildTools version using the command below, once inside the directory above.

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

Once that's downloaded, we need to run a git command then the Jar file to start downloading and compiling the files. You need at least 1.2GB~ of free RAM to successfully run BuildTools. If you don't, it won't work!

java -jar BuildTools.jar

Once you've ran this command, it will start. It may take around 5-10 minutes to complete on your first run depending on your hardware and network connection. The output when it is completed should look something like this:
Success! Everything compiled successfully. Copying final .jar files now.
Copying craftbukkit-1.9-R0.1-SNAPSHOT.jar to /root/buildtools/.
  - Saved as craftbukkit-1.9.jar
Copying spigot-1.9-R0.1-SNAPSHOT.jar to /root/buildtools/.
  - Saved as spigot-1.9.jar

Now we can see our compiled Spigot jar is saved as "spigot-1.9.jar"! This will change depending on the current version of the game that it's built for. Lets make a new directory for our Spigot server to run in to keep everything clean, then move our compiled Jar file to it and change to that directory.

mkdir /root/spigot/
mv spigot-*.jar /root/spigot/spigot.jar
cd /root/spigot/

Once we're in the new directory with our spigot-1.9.jar lets create a new text file to accept the Mojang EULA, which is required to run the server.

nano eula.txt

Once you've opened the nano text editor type "eula=true" then press CTRL + X then press Y to save the file.

Now we can start the Spigot server. Run the following command to do so:

java -Xmx1G -Xms1G -XX:+UseConcMarkSweepGC -jar spigot.jar

Replace "1G" with the amount of memory that you want to allocate to the server, in this we're using 1G (1 Gigabyte).

That's it. Your Spigot server should run now and generate a world. You can connect using your servers IPv4 address.

If you aren't able to connect, you may need to add a firewall rule to allow traffic to the Minecraft port. Run the commands listed below to do this.

iptables -I INPUT -p tcp --dport 25565 --syn -j ACCEPT

You can stop the server by typing "stop" in your servers console and pressing enter. Once it's stopped you can edit the server.properties file to change things such as the IP address it's binded to, the port number, world type, and more.

By default your server will stop when you close your current SSH session. If you want your server to run in the background 24/7 when you aren't connected to SSH, you need to use "screen". It's easy to do. First install screen.

yum install screen -y

Then start a new screen session, we'll call it minecraft:

screen -S minecraft

Make sure the -S is uppercase above. Once you've ran this you will be entered into the new screen session. Here you can run the same command above that you started the Spigot Minecraft server with. Once you've started your Minecraft server you can press CTRL + A the press D to detach (exit) from the screen session. If you want to open the screen session in the future, just type "screen -r minecraft". To list all current screen sessions that are active type "screen -ls" in SSH.

Need a Minecraft server? Check out our website for Minecraft hosting and VPS hosting plans.

  • 20 Users Found This Useful
Was this answer helpful?

Related Articles

ARK: Survival Evolved Windows Server Setup

This guide will show you how to successfully setup an ARK: Survival Evovled game server on...

ARK: Survival Evolved Linux Server Setup

The ARK developers have releeased a short guide on how to setup the dedicated server for Linux...

Install ownCloud on CentOS 6

We will be setting up ownCloud on a fresh CentOS 6.6 64-bit installation. ownCloud is an open...

Install PPTP / PPP Proxy Server on CentOS 6

PPTP Proxy is an easy to setup proxy server that can be used as an OpenVPN alternative, and many...

Install VNC Server and Desktop on CentOS 6

Install the desktop environment that we will use:yum groupinstall Desktop -yInstall the TigerVNC...

Powered by WHMCompleteSolution