Run a Minecraft server using Spigot

Minecraft is one of the most popular video games in the world today, with over 70 million purchased accounts. After playing single-player for a while, the next step most players look into is multiplayer. There are thousands of servers for Minecraft players to join, and starting your own server isn’t too difficult either. The most popular Minecraft server software is called Spigot.

Spigot is an open-source Java project that lets users run their own Minecraft server and add plugins to extend the possibilities of their server. There are over 100,000 Spigot servers in existence today. This makes Spigot one of the most stable and diverse Minecraft servers available.

Compiling Spigot

To use Spigot, you must use their BuildTools utility to build and compile Spigot from source code. In order to use BuildTools, you’ll need to install Java and git. To do this, open a terminal and run this command:

sudo dnf install java-1.8.0-openjdk git

After the command finishes, you can prepare to compile Spigot. First download the latest version of BuildTools from the Spigot Jenkins and place it into a new directory. Next, open up a terminal and change directories into the directory you placed BuildTools in. To compile Spigot, run the following commands:

git config --global --unset core.autocrlf
java -jar BuildTools.jar

The first command is important, because it ensures line endings are consistent so BuildTools works correctly.

After BuildTools finishes running, a few different JAR files now appear in the directory. These include something like craftbukkit-1.x.x.jar and spigot-1.x.x.jar, where x.x represents the current version of Minecraft. CraftBukkit is the original Minecraft server implementation, but is no longer officially maintained. (The Spigot team releases updates for CraftBukkit.) Spigot is a fork of CraftBukkit with a few performance enhancements under the hood. Therefore, you’ll want to use the Spigot JAR file.

Starting Your Server

Once you have the spigot-1.x.x.jar file ready, it’s time to move onto finally running your server! There are a variety of methods to do this. We’re going to use window manager software called tmux to allow you to run your server without needing to keep a terminal window open.

First, install tmux from the Fedora repositories. Run the following command in a terminal window:

sudo dnf install tmux

There are countless ways to use tmux and do all kinds of awesome things. For relevancy, this guide only covers basic usage. You can learn more about using tmux using this cheatsheet. For our purposes, we’ll create a tmux session, write a basic start-up script, and then run our Spigot server inside of the tmux session. Before we get rolling, you will want to write your start-up script. This can be a one-line file, and should be named something like start-spigot.sh. Its contents should look something like this:

#!/bin/bash
java -Xms1024M -Xmx1024M -jar spigot.jar

After writing this script, place it in the same directory with your Spigot JAR file. Now let’s move onto setting up tmux and running your server. Run the following commands to set up your session:

tmux new -s minecraft
cd /path/to/spigot.jar
chmod +x start.sh
./start.sh

Your Spigot server now starts running and provides more instructions on your screen for setting up your server.

Basic Configuration

There are a few basic configuration tips and guides available for how to best configure your Spigot server to meet your needs. A full configuration guide can be found on the Spigot Wiki. In this article, we will cover some of the basic and most important configuration tips. There are two configuration files we will need to work with: server.properties and spigot.yml.

server.properties

There a wide number of settings in this file, but we will only cover some of the essential parts:

  • server-ip
    • Default: <empty>
    • When blank, this assumes the localhost. If your machine does not have multiple IP addresses, leaving this blank is acceptable.
  • server-port
    • Default: 25565
    • Specify the TCP port that you want your Spigot server to listen on.
  • enable-query
    • Default: false
    • Set this to true to allow external services to ping your server for information, such as a listing website showing online players and active plugins.
  • query.port
    • Must be manually entered
    • You should set this UDP port to a different number than your server TCP port to prevent anyone on the Internet from easily finding out information about your server, if you do not wish to share it.
  • max-players
    • Default: 10
    • Specify the maximum number of players that can play on your server at the same time.
  • motd
    • Default: A Minecraft Server
    • Change this line to a server name for your Minecraft server that appears on the Multiplayer menu. You can have up to two lines on the menu; to split your MOTD, use the \n escape character.

spigot.yml

The spigot.yml file contains default configuration specific to the Spigot server. There are several options that can be changed here. If performance is a concern, you can tweak settings to maximize performance on even the oldest system. A full Spigot configuration guide can be found on their wiki. However, like before, we’ll cover some basic configuration options here.

  • settings > restart-on-crash
    • If your server should ever crash, you can have it automatically restart by calling the start script you created earlier. This is especially useful if you want to run your server long-term. Just ensure your start script is specified in the following line for this setting.
  • world-settings > anti-xray
    • There are plenty of hacks and cheats in Minecraft. One of the most popular is the x-ray hack. This cheat allows players to see through “useless” blocks and immediately find more valuable blocks behind them, such as diamonds and gold. Spigot has its own anti-xray protection built-in to try to counter this.
    • There are two different engine modes: 1 and 2. Mode 1 is a lighter protection that isn’t as effective, but conserves resources. Engine Mode 2 requires more computing power but attempts to obfuscate all non-visible blocks on the fly to block x-ray hacks. Try playing around with the settings to find what works best for you!
  • world-settings > dragon-death-sound-radius
    • This is just one example of the tweaks available in Spigot. You can adjust the range of the dragon death sound for all players on your server. By default, anyone online can hear the sound if a player slays the dragon. This setting allows you to set a radius to limit the range of the death noise.
  • world-settings > arrow-despawn-rate
    • This setting is more of a performance-oriented tweak. If you lower the default rate for arrows to despawn, you can reduce the load on your server to render these items. If players on your server are always shooting bow-and-arrows at each other, this can be a very useful tweak to gain performance.

Plugins

In addition to the default configuration options, Spigot comes with a rich API that Java developers can use to write their own plugins and modifications for Spigot. If you want to find more plugins, Spigot hosts a wide number of user-submitted plugins on their Resource Manager. Searching for plugins that interest you is a great way to expand the potential of your server, and to make it more interesting for your players. Try playing around with a few different plugins to find what works best for you and your players.

In no time, you’ll be up and running your Spigot server for the world to play on!

Fedora Project community Using Software

9 Comments

  1. minetest is so much easier to setup… both the client and the server… are are stock Fedora packages. Since Fedora prefers FOSS over proprietary software, why not talk about a very popular alternative to the very popular Minecraft?

    • Minetest is a free and open-source alternative to Minecraft, but the work that the Spigot community produces (and many young developers who have their first experiences with FOSS by writing plugins extending the Spigot API) is a significant accomplishment in itself, and there is a very large community behind Spigot as well. Even if Minecraft is a proprietary game, I do not think this discounts the work of those behind Bukkit/Spigot. I might look into writing about Minetest in the future, that popped up on my radar a few weeks ago!

    • FWIW, we have talked about Minetest (and the fork of it Voxelands) in the past here on the Magazine

      Also, just discovered this other Minecraft-like called Terasology that seems pretty interesting. I havent tried it out yet, but the screenshots and screencasts look pretty amazing.

  2. Jason Brooks

    What’s the license for Spigot? I have a thing about knowing the license when something is labeled “open source”, especially since the minecraft client is proprietary.

    I didn’t see a link to the source code in this post, but the Spigot web site says that most (??) of the source lives here (https://hub.spigotmc.org/stash/projects/SPIGOT). The Spigot dir contains no license file. The BuildTools dir contains a BSD-looking license.

    I’m +1 to talk of minetest, it’s surprisingly good, but you need to install some mods to make it into an actual game — the project styles itself as a sort of a game-building platform, and this makes for a poor first experience for someone installing it from the Fedora repos. I tried to get my kids interested in checking out minetest, but they haven’t quite developed a thirst for software freedom yet. 🙂

  3. I wrote a Blogpost that does the setup for a server on a much deeper base. like creating a systemd unit, creating an update script (needs to be adjusted for other servers though) and setting up the firewall correctly to let the traffic through:

    See: setup Minecraft using systemd

    I think the setup works really well in a “server environment” and allows to sandbox and restrict the minecraft service nicely.

    Regarding minetest:
    minecraft is simply the standard so if you have a server and someone asks you to run minecraft on it and you say ok but its actually minetest then they say “ok I’ll ask someone else”.

  4. The Spigot license is very mixed.

    The Spigot project is a set of modifications to the proprietary Minecraft server. The patches are GPL licensed, but the resulting server jar cannot be redistributed as it is a derivative of both the GPL licensed patches and the proprietary server.

    So yes the Spigot project is open source, but the resulting Spigot server is not open source.

    The bulk of the server sources are proprietary decompiled sources of the original server. The decompilation done as part of the build procedure and the GPL parts and proprietary parts are then combined by the user to avoid any distribution of the modified work.

  5. Brain Ashforth

    I had know idea about minetest until I saw this post! Fantastic open source game however it can be a bit limited with the mods and plugins. Any idea if Minetest has a dedicated server setup?

    • I don’t know if I’ve seen any hosts out there, but there may be a few. I’m sure there are ways you can run it on a dedicated server, though? You might have to check out the resources for their project to get an answer about that.

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions