This tutorial explains how to set up a Minecraft server using Spigot on Arch Linux.
This tutorial assumes that you are a normal user (not-root) and have sufficient rights to sudo. This is because using the AUR to build packages should not be done as root, but as a normal user.
Using the AUR package “spigot” is a great way to install Spigot as it builds a package that is tracked by pacman. This allows you to remove it quickly and upgrade it quickly. Plus, the package uses systemd and tmux to manage the server, and it has all of the scripts ready for you to use.
Before we begin building the package, we need to install some dependencies first.
sudo pacman -Sy base-devel jdk8-openjdk jre8-openjdk fontconfig tmux git
Now with those installed, we can begin to build the spigot package. Using curl, download the tarball for the package.
curl -O https://aur.archlinux.org/packages/sp/spigot/spigot.tar.gz
After the download finishes, extract it and change into the spigot folder.
tar -xvzf spigot.tar.gz cd spigot
Now, using makepkg, build the package. This can take a few minutes.
If you didn’t pass the
-i flag to the makepkg command, you use pacman to install it.
sudo pacman -U *.pkg.tar.xz
Start your server for the first time to gain access to the
eula.txt file. Then, immediately stop it.
sudo systemctl start spigot sudo systemctl stop spigot
After that’s done, open the file
/srv/craftbukkit/eula.txt and change the line
eula=true. This provides you with a working server, but you may still want to modify the
/srv/craftbukkit/server.properties file. Information about this file can be found on the Minecraft Wiki.
Once you are happy with your settings, fire up the server!
sudo systemctl start spigot
To start it on boot:
sudo systemctl enable spigot
You now have a working Spigot server!
The contents of the server are located in
/srv/craftbukkit/ and are owned by the user craftbukkit and group craftbukkit. You must make sure when installing plugins or other files that they are owned by craftbukkit:craftbukkit.
If you want to access the server console, run the following command (assuming that you have the correct sudo permissions).
sudo -u craftbukkit tmux attach
To close out of the server console, press Ctrl + B, then D.
Another thing to consider is if you want to allocate more RAM to the server. If so, run the following command. The
$newram placeholder is where you specify the new value. This will also create a backup file in case you need to revert to it.
sudo -u craftbukkit sed -i.bak 's/1024M/$newram/g' /srv/craftbukkit/spigot.sh
If you put in a bad value for the new amount of ram, you can revert by running this command.
sudo -u craftbukkit mv /srv/craftbukkit/spigot.sh.bak /srv/craftbukkit/spigot.sh