How to set up a Minecraft server on Raspberry Pi?


I have a lot of experience with Minecraft, whether as a player or as a server owner (I run a French server for almost 10 years). So, naturally, I wanted to test it on my Raspberry Pi.
I will share with you the steps and tips to quickly setup a multi-player Minecraft server on your Pi.

The best way to install a Minecraft server on a Raspberry Pi is to use a solution named Spigot. It provides all the tools we need to compile the Minecraft server on the Raspberry Pi, and allow us to use plugins for a customized server.

We will now see how to do this in detail, starting with a bit of theory on Minecraft, which will help you understand more. As usual, depending on your level, do not hesitate to use the table of content to pass paragraphs that are obvious to you.

Minecraft introduction

x
Etcher vs Imager
Get My Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

What is Minecraft?

Minecraft is a sandbox game created by Mojang.
This game has no defined goal. Each player will progress in the game in his way.

At the launch of a game, the player appears in a world composed of blocks, representing the real world in a cubic form.
The player will find different biomes (meadow, beach, mountains) and various blocks such as stone, trees, water, etc …
Here is what it looks like by default:

play minecraft

The player must then reap resources to improve his stuff (tools, weapons, armor).
Monsters appear at night and in caves, so the player also need to fight for its survival along the way.

It’s an ideal game for kids, very educational and not violent (you can disable monsters for the younger ones if you want).
It is possible to play alone or with other players.
And the purpose of this article is to show you how to set up a multiplayer game, with your family or friends.

Raspberry Pi Bootcamp
Sale: 10% off today.
Take it to the next level.
I'm here to help you get started on Raspberry Pi.
Learn all the skills you need in the correct order.

Minecraft client

To play a multiplayer game, you will need two things:

  • A client
  • A server

The client is the easy part.
You can find it on the official website of Minecraft, whatever your operating system.
It allows you to launch the game, create a solo game or join a server.

The first time it will probably go through the “Options” menu, to configure the control keys, audio video settings.

Minecraft server

Mojang also provides a server for his game, but I don’t recommend it.
Indeed the server provided is minimal.

It will allow you to play multi-player on the same map, but will not let you do any modification of the game.

There are other providers of Minecraft servers, which offer the possibility to change it, thanks to plugins, we’ll see that later. In this article, we will use the Spigot server, which allows this.

Install Raspberry Pi OS

Before anything else, you will need to install an operating system on your Raspberry Pi.

Why Raspberry Pi OS?

I recommend installing Raspberry Pi OS, this is the official operating system, it works really well. I’m doing this tutorial on it for you, so it’s the best way to have the same results too 🙂

The Lite version of Raspberry Pi OS is enough if you are going to use your Raspberry Pi only as a Minecraft server (otherwise it will depend on other uses).
The advantage of the Lite version is that you’ll get more power and disk space for Minecraft, instead of using it for applications you’ll not use in this configuration.

For more advanced users, more scalable distributions, such as Arch Linux or Gentoo, may also be a good choice.

How to install Raspberry Pi OS?

I will not explain the detailed installation of a Raspberry Pi OS here.
I advise you to read this article which will explain in detail how to do this step by step.

Once the tutorial finished, you must have:

  • Raspberry Pi OS installed and up to date
  • Network and Internet access working properly
  • Access to your Raspberry Pi via SSH from your computer

I recommend you to continue following this post from your computer, connected to your Raspberry Pi via SSH
So you can copy/paste command and work in better conditions 🙂

Install a Minecraft server on Raspberry Pi

As I said before, we’ll use Spigot for our Minecraft server.
It’s free, with a large community and many plugins you can add after the installation.

Master your Raspberry Pi in 30 days
Sale: 10% off today.
Download the eBook.
Uncover the secrets of the Raspberry Pi in a 30 days challenge.
Learn useful Linux skills and practice multiples projects.

1 – Download Spigot

The first thing to do is to download Spigot.
Spigot is not a ready to use package. You have to download it from the official site and build it.

BuildTools.jar is a solution to build Bukkit, CraftBukkit, Spigot, and the Spigot-API.
We need to download it to build Spigot.

Use these commands to get the required file in a new temporary folder:

mkdir /home/pi/spigot
cd /home/pi/spigot
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

Then you are ready to start the next step.

2 – Build Spigot

Now that we have downloaded the jar, we need to launch the build of the latest version of spigot:

  • Get back to your build folder if needed:
    cd /home/pi/spigot
  • Install prerequisites (Git and Java):
    sudo apt-get install git openjdk-11-jre-headless
  • Configure git:
    git config --global --unset core.autocrlf
  • Run Buildtools:
    java -jar BuildTools.jar
    It might take a little while depending on your Raspberry Pi model (around 10min on Pi4, and something like 30 to 60 minutes on a 3B+).
    Be aware that you can add the –rev option to build a specific version of Spigot (ex: –rev 1.16.5).
    At the end of the process, you should get a success message like this:
  • Make sure your Minecraft server is ready to use in the destination folder:
    ls -latr /home/pi/spigot/*.jar
    In my case, the file I will use later is “/home/pi/spigot/spigot-1.16.5.jar”.

Now that Spigot is ready, we can move to the next step.

Note: Make sure to have a compatible Java version for the Minecraft version you try to build. You’ll get an error if it’s not the case. Read this article to learn how to install any Java version on your Raspberry Pi.

3 – Create the Minecraft server file tree

It is not mandatory, but I recommend creating a folder dedicated to your Minecraft server installation.
This allows you to group everything in the same folder, to know the files concerned and to simplify the backups for example.

Type the following commands to create a folder and move our Spigot file inside.

mkdir /home/pi/minecraft
mkdir /home/pi/minecraft/server
cp /home/pi/spigot/spigot-1.16.5.jar /home/pi/minecraft/server

Don’t forget to change the spigot filename if you build another.

4 – Start the Minecraft Server

Now we can move to the server folder and start Spigot for the first time.

cd /home/pi/minecraft/server/
java -jar spigot-1.16.5.jar

This start will fail, it’s normal.
It will display something like this:

You have to first agree to the Minecraft EULA before running your server.
Your first start just created a file named “eula.txt” in the server folder.
Edit this file and set it to true:
nano eula.txt
Replace “false” with “true”

Then start your server one more time.
The server will create the basic needs:

  • Folders tree
  • First worlds generation (overworld, nether, and the_end)
  • Configuration files

This will take a few minutes.
When the server console display “Done” you can stop it with this command:
stop

CTRL+C is also working but use “stop” if it works.

stop spigot server

Technically, our server is already working.
But first, we’ll have a look at the available configuration before moving on to play Minecraft.

Note: At this point I got an error in a recent test (with Java 11), that I didn’t get while writing this tutorial with Java 8:
[STDERR]: java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk
-armhf/lib/libawt_xawt.so

I fixed it with:
sudo apt-get install openjdk-11-jdk

Configure Spigot

Spigot allows us to configure everything, to create the perfect Minecraft server.
We will see in detail what it is in each configuration file and what you can do with it.

Firstly, you’ll see that almost all the configuration files are in YML format.
This format is easy to read, but it is important to respect the syntax.
Tabs must be replaced by spaces, and characters such as single quotes often generate errors.

Master Python on Raspberry Pi
Sale: 10% off today.
Get the eBook.
Do more with your Raspberry Pi, learn the useful concepts and take the shortcuts.
You miss half of the fun of using a Raspberry Pi if you don’t know anything about Python.

Server.properties

The first file that can help you to configure the server basic settings is server.properties.
This file comes from the original server from Mojang, Spigot keep it for more compatibility.

Open the file to see what’s in it:
nano server.properties

As you can see, the file is easy to read: one parameter = one value.

Now I will explain the most important options from this file, that you’ll probably use:

  • server-port: By default, the Spigot server can be accessed to the port 25565, but you can change it with this parameter
  • level-seed: Each world is generated from a seed, if you want a specific world, you can enter a seed here, delete the world folder and restart the server to get this exact world. There is a lot of website giving you examples of seed. MinecraftSeedHQ is one of them
  • hardcore: Do you want to make the game more complicated? The hardcore mode will ban the players at their first respawn 🙂
  • pvp: (Players vs Players) You can disable this option to avoid PVP on your server
  • difficulty: By default, the server will be in EASY mode. You can increase this value to make it more difficult (values between 0 and 3)
  • gamemode: By default, the server will be in Survival mode. You can change this value to play in another game mode (0=Survival, 1=Creative, 2=Adventure, 3=Spectator)
  • spawn-monsters: You can disable this if you want to play without monsters
  • motd: It’s the name of the server that will display in your server list. You can change it to know that it’s your Raspberry Pi server 🙂

You can find all the other options in the Minecraft wiki but most of the time you’ll not need others.

Spigot.yml

Spigot.yml is the first configuration file added by Spigot to customize your Minecraft server.
It will allow you to change game settings and server settings.

For example, you can change in this file the hoppers speed or the log file behavior.

Most of the time for a home server, you will not need this kind of options.
You could probably spend a little time in this file to improve the performance for your Raspberry Pi, but it’s not mandatory.
If you want further information about this file, you can find it in the Spigot wiki.

Bukkit.yml

Spigot is based on Bukkit. Bukkit was a similar project, to extend the multi-player Minecraft server.
Spigot decided to keep the bukkit.yml file that contained all the options for Bukkit servers.

This file contains pretty much the same kind of options as spigot.yml.
It is also often complicated to know in which file we will find which option.

In the same way, as for the Spigot.yml file, it is unlikely that you need to go to edit bukkit.yml.
However, if you want to know more, help is available on their wiki.

Offline mode

I would now like to talk a bit about the online-mode option that you may have seen in the server.properties file.

Remember that Minecraft is a paid game, which can be bought on the official website.
In fact, you can often find it at a lower price on Amazon (check this link for example), if you want to save a few dollars on it 🙂
But there are “crack” versions, with launchers that allow you to play solo, or join cracks servers without ever logging into a Mojang account.

The online-mode parameter can be set to allow crack launchers to access the Minecraft server.
You set it to false, crack launchers will be able to connect to your server.

I do not necessarily encourage you to do this, but as part of a closed server available only at home to play with your family, this seems like a good option.
Shiginima is a good launcher to use with this option.

Connect to the server

Take your time to finish the server configuration, and we can continue to test the server access.

Don’t forget to restart the Spigot server with your new configuration files:
java -jar spigot-1.16.5.jar

Get the game launcher

For a paid version, you have to download the launcher from the official website.
Log in to your account, and click the Download link:

If you want to try the game with a cracked launcher, you can download Shiginima from the link below, or any other launcher from your choice.

Then follow instructions to install it.

Start the launcher

Official launcher

If you are using the official launcher, it will ask you to log in on the first start:

Enter your credentials and submit the form.
Then you will get the Play button:

But before clicking the play button, you need to check that the game will start with the same version as your server.
Most of the time when a new Minecraft version is available, the server developers will need some days/weeks to update the server, so there is often a gap between the two versions.

For example, if the server is in 1.16.5, but the launcher start in 1.17, you need to change this first.
So, to change it:

  • Go to “Installations” in the menu
  • Click on “New”
  • Enter a friendly name (ex: 1.16.5)
  • Choose the same version as your server
  • Save

If you come back to the launcher home, you will see that the Play button changed, and you can now select which version you want to use:

Shiginima launcher

The Shiginima launcher uses the method of the old official launcher, so it’s a bit different.

The first thing to do is to choose the name you want to use.
There is no account needed.

shiginima launcher

Then press Play and access to the launcher interface.

Then you have to check that the game version display in the bottom right is the same as your server.
For example, if the server is in 1.16.5, and the launcher start in 1.17, you have to fix this first.
So, you can change it following these steps:

  • Click on the Edit Profile button in the bottom left
  • In the Use version dropdown list, choose the correct game version (ex: 1.16.5)
  • Click on Save Profile

The game version at the bottom right should have changed.
You can now click “Play” to start the game.

Add the server

Whatever the chosen launcher you should now find yourself on a screen like this:

If you have not done it yet, take a look at the game’s options to adjust controls, audio and graphics options to suit your needs.

Then we’ll add our server and connect to it:

  • Click on the Multiplayer button
  • Click on the Add server button
  • Enter a server name (whatever)
  • Enter your Raspberry Pi IP address
    • If you changed the default port, you have to put it in this field following the format [IP]:[PORT], for example, 192.168.1.200:12345
      connect minecraft server
  • Click on the Done button
  • Your server should now display in the server list like this:
minecraft server list

Double-click on it to connect to your server!
If you check the server console, you’ll see your player name logged in

minecraft player login

We now have a basic functional server.
You can already play with your family or friends.

But we chose Spigot to be able to add plugins, not to get a simple server.
So, that’s what we’re going to see now.

Install plugins on your Minecraft server

What are plugins?

As I said before, plugins can improve or change the behavior of Spigot.

I will give you some examples of features that plugins can bring.
It will be clearer:

  • Add commands, for example, the ability to return to the server spawn with /spawn
  • Give you rewards based on what you do in the game
  • Add permissions, such as not being able to break another player’s house

There are thousands of plugins that are already full of things.
And the possibilities are almost endless, develop a new plugin to add any functionality that you have in mind.

Download plugins

Spigot lists most public plugins on its website, in the Resources category.
You can search for a plugin through the Categories menu or with the search engine.

For a family server, you don’t really need to add plugins.
If you trust the people who access the server, the basic version may be enough.
But if you want more security or more features, do not hesitate to add a few ones.

Here is a list of the main plugins found on the majority of multi-player servers:

  • Essentials: Essentials will add all the most useful commands to your server. For example, you can create checkpoints with /sethome and come back to this place with /home
  • PermissionsEx: PermissionsEx will add permissions to your server. Players will only be able to do what you have decided. You can create groups of players, like Admins with all access, and players with only the minimum permissions.
  • WorldGuard: WorldGuard will allow you to create protected regions in your world. For example, you can preserve the spawn of the server, to avoid its destruction by new players
  • WorldEdit: WorldEdit works well with WorldGuard, it allows you to make the selection of a region, and transformation of the world (copy/paste for example)
  • Multiverse: Multiverse-core is a plugin to manage multiple worlds in your servers. For example, you can have a resource world and a build world
  • Vault: Vault allow players to use money in the game
  • Lockette: Lockette is a simple plugin to protect chests or doors. If you put a private sign on your chest, nobody can open it except you

There are many others, which may be useful depending on what you want to do, but those are part of the essential plugins.

Plugins are java files in a .jar format.
To download one, go to the plugin page (ex: Multiverse), click Download and recover the .jar file.

We’ll see next how to install them on your Spigot server.

Install plugins

To add new plugins on Spigot, you have to put the .jar file in the “plugins” subfolder.

Transfer it from your computer

If you have downloaded the plugin file on your computer, you have to transfer it via SSH to your Raspberry Pi:

  • On Mac/Linux: use scp or rsync command:
    scp Multiverse-Core-2.5.jar pi@192.168.1.22:/home/pi/minecraft/server/plugins/
    Don’t forget to change the IP address of the Raspberry Pi.
  • On Windows: use the WinSCP software
    • Create a new site with your Raspberry Pi settings:
      winscp settings
    • Then click Save and Login
    • The right tab is the Raspberry Pi folder tree.
      Go to /home/pi/Minecraft/server/plugins
    • Drag and drop the plugin from the left to the right
    • You should get something like this:
      winscp files

Direct download

Another way to do this is to download the file directly to the Raspberry Pi.
This way is not always possible, but when you have the plugin’s direct link you can use wget to download the file:
cd /home/pi/minecraft/server/plugins/
wget [LINK] -o [PLUGIN].jar

Apply changes

Whichever method you use, you must now restart the server to apply the changes.

  • Return to the server console in your SSH client
  • Stop the server:
    stop
  • Then restart the server:
    java -jar spigot-1.16.5.jar

On the next start, the plugin will be installed and available in the game.

Configure plugins

Most of the time, when you install a new plugin, a new folder will be created in the “plugins” folder.
This folder contains the plugin configuration.

├── Multiverse-Core
│   ├── config.yml
│   ├── scripts
│   │   └── scripts.bin
│   └── worlds.yml
├── Multiverse-Core-2.5.jar

If necessary, edit these files by referring to the documentation of each plugin.

Go further

These tips are not mandatory to play Minecraft on your server.
But it can help you to have a more stable server.

Use screen

As you’ve probably noticed, the server you launch in your SSH console stops if you are disconnected from the Raspberry Pi or if your computer goes to sleep …

We have to start the Spigot server on the Raspberry Pi directly.
For that, I recommend you to use screen:

  • Install screen:
    sudo apt-get install screen
  • Create a new screen for your Minecraft server
    screen -S minecraft
  • Start the server:
    cd /home/pi/minecraft/server java -jar spigot-1.16.5.jar
  • Quit the screen with CTRL+A followed quickly by CTRL+D

This time even if you disconnect your SSH session the server will continue to run.
To return to the screen, use the following command:
screen -r minecraft

Start server script

For now, we have started our server manually, but it is advisable to create a script for that.

A simple script

Here is the most basic script you can create to start your Minecraft server.

  • Go to your server directory:
    cd /home/pi/minecraft/server
  • Use nano to create the script:
    nano start.sh
  • Paste this lines:
    #!/bin/bash
    java -jar spigot-1.16.5.jar
  • Save and exit (CTRL+O, Enter, CTRL+X)
  • Add the execution permission:
    chmod +x start.sh
  • Start the server:
    ./start.sh

As you maybe notice in the spigot.yml configuration file, if the server crashes, Spigot will look for a start.sh script to restart the server, so it’s important to call this script exactly like this.

Options

Most of the time, we start servers with additional parameters.
Java can take many options, and Spigot too.

You maybe noticed that in the server start, they recommend using another command, so we will edit out the script to add these options:

#!/bin/bash 
java -Xmx1024M -Xms1024M -jar spigot-1.16.5.jar
  • -Xmx specifies the maximum size, in bytes, of the memory allocation pool
  • -Xms specifies the initial size, in bytes, of the memory allocation pool

Auto restart

The last thing we can add to this script is an auto-restart.
We saw that in case of a crash, Spigot would try to restart the server.
But it does not always work, and if you stop the server yourself accidentally, you have to go and restart it.

For the server to restart automatically, modify your startup script so that it looks like this:

#/bin/bash
while true
do
  java -Xmx1G -Xms1G -jar spigot-1.16.5.jar
  echo Reboot
  #You can add other commands to do at each reboot here
  #(backup or log rotation for example)
  sleep 5
done

Start on boot

Finally, if your Raspberry Pi is dedicated to your Minecraft server, you can launch it automatically at every boot.

For that add the script in the crontab this way:

  • Edit the crontab:
    crontab -e
  • Paste this line at the end
    @reboot /home/pi/minecraft/server/start.sh
  • Save and exit (CTRL + O, Enter, CTRL + X)

Backups

If you spend a lot of time playing, setting up a backup at least once a day can be a good idea.

For minimum security, you can install a backup plugin like this.
This plugin will create backups at defined intervals and allow you to restore them easily.

For a more valuable server, it will probably be necessary to put in place a more advanced strategy.
For example, you can create a compressed archive of the server folder, keeping a few days of archives.
This article might be useful to do this.

Access from Internet

As you have seen your Minecraft server is accessible via an IP and a port.
It is therefore quite possible to open this port on the Internet, adding a NAT rule on your internet box

This firewall rule will allow you to invite friends to play on your server.
But in this case, think about the security of your server, adding the plugins recommended above because anyone can come on your server 🙂

How to Install and Use No-IP on Raspberry Pi? (Dynamic DNS)

Video

Get My Cheat Sheet!
Grab your free PDF file with all the commands you need to know on Raspberry Pi!

If you want to see a summary of all the first steps to install Minecraft Server on your Raspberry Pi, you can watch this video:

If you have any comment, suggestion or just want to chat with us about this tutorial,
you can post your messages in the community on Patreon. See you there!

Conclusion

You now know how to set up an advanced Minecraft server on a Raspberry Pi at home.

Minecraft is an infinite universe, whether in the game or its community, its plugins, its improvements possibilities.
If you didn’t know it you shouldn’t be disappointed, and if you have already played solo, the discovery of the multiplayer mode should revolutionize your games 🙂


This tutorial doesn't work anymore? Report the issue here, so that I can update it!

minecraft server

Patrick Fromaget

I'm the lead author and owner of RaspberryTips.com. My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with a web developer experience.

Recent Posts

Master your Raspberry Pi in 30 days

Download this eBook and discover:
1. Secrets from my 20-years Linux experience 2. Many step-by-step projects for your Raspberry Pi 3. How to save time by learning the right way
DOWNLOAD YOUR COPY
10% OFF FOR A LIMITED TIME WITH THIS LINK
DON'T MISS IT!
close-link
Master your Raspberry Pi - 10% off