How to Turn Your Raspberry Pi into a Minecraft Server

Minecraft Turn Your Raspberry Pi Into Server

Minecraft is the second best-selling video game of all time, with 122 million people logging on during September 2019 alone. Although you can explore the world of Minecraft solo, some things are more fun with friends! By creating your own Minecraft server, you’ll have complete control over your world: you can set your own rules, install mods and invite all your friends to explore Minecraft with you!

In this tutorial you will learn how to set up and host a standalone Minecraft server on your local Wi-Fi network using Raspberry Pi. Once this server is up and running, you’ll be able to play with anyone else who is connected to your network – ideal if your children or roommates are obsessed with Minecraft!

Some things are more fun with friends, so why not create your own Minecraft server?

If you want people to connect to your Raspberry Pi remotely, then you’ll need to complete a few extra steps, which you’ll learn about throughout this tutorial.

What you’ll need

To complete this tutorial, you’ll need:

  • A Raspberry Pi running Raspbian. If you don’t already have Raspbian, then you can grab the latest version and flash it using Etcher
  • A power cable that’s compatible with your Raspberry Pi
  • An external keyboard and a way to attach it to your Raspberry Pi
  • An HDMI or micro HDMI cable, depending on your model of Raspberry Pi
  • An external monitor
  • Ethernet cable if not connecting over Wi-Fi 
  • A laptop or computer running Minecraft Java Edition.

Once you’ve assembled your tools, you’re ready to build your Minecraft server. 

Make sure you’re running Raspbian 

If you haven’t already, attach your external keyboard, monitor and any other peripherals to your Raspberry Pi, and then plug it into a power source.

Attach all of your peripherals to your Raspberry Pi.

Once your Raspberry Pi has booted, you’ll need to ensure that your version of Raspbian is up to date. Launch a new Terminal window by clicking the Terminal icon in the Raspbian toolbar, and then run the following commands: 

Raspbian will now download and install any available updates. If prompted, reboot your Raspberry Pi using the following command:

Update Raspbian’s memory split

Next, you need to tell Raspbian how it should use the available memory using the config tool. 

You can launch this tool using the following Terminal command: 

In the window that appears, navigate to “Advanced Options ->Memory Split” and enter the value “16.” Save your changes by clicking “OK.”

Optional: Allowing SSH connections

If you ultimately want people to be able to connect to your server remotely, then now is the perfect time to enable SSH:

1. In the toolbar, select the Raspberry Pi icon.

2. Navigate to “Preferences -> Raspberry Pi Configuration.”

Allow remote connections, by navigating to “Preferences -> Raspberry Pi Configuration.”

3. Select the “Interfaces” tab. 

4. Find “SSH” and select its accompanying “Enabled” radio button. 

You can connect over SSH, by selecting the "Interfaces" tab and then selecting "SSH: Enabled."

5. Save your changes by clicking “OK.” 

6. Reboot Raspberry Pi by clicking the little icon in the upper-left corner and navigating to “Shutdown -> Reboot” or by running the reboot command in the Terminal.

Create a Spigot server

We’re going to build our server using Spigot, which is a modified Minecraft server that includes some useful performance optimizations.

The first step is making sure that Java is installed on the Raspberry Pi. You can install the default JDK package for Raspbian using the following command: 

Next, you need to build the Minecraft server file. For the sake of ease, this tutorial uses the builder tool that’s provided by Spigot. In the Terminal window, run the following three commands: 

Create your Spigot server:

Note that in the above command, Spigot 1.15.2, which at the time of writing was the latest release, is used. If a newer release is available, then update --rev to reference the latest version. 

Once Spigot has downloaded, you can launch your server:

Remember to modify the above command if you’re using any version other than Spigot 1.15.2!

Before launching, the server will ask you to agree to the Eula (end-user license agreement). 

You'll need to agree to the end-user agreement before you can use your Minecraft server.

You can open the Eula in Raspbian’s Nano text editor: 

Inside this file, change “FALSE” to “true,” and then save your changes using the Ctrl + X shortcut followed by y. Finally, press the Enter key on your keyboard.

Inside the eula.txt file, change FALSE to TRUE.

Now you need to relaunch the server, so reboot Raspberry Pi by entering the reboot command into the Terminal.

Your Raspberry Pi will now reboot, and when it’s back up and running, you’ll be ready to connect to your server! 

Connecting to your Minecraft server 

To connect to the Raspberry Pi server, you need to know its IP address. To retrieve this information, open the Terminal and run the following command: 

Launch Minecraft Java Edition on your laptop or computer.

Launch Minecraft: Java Edition, as normal.

Select “Play -> Multiplayer.” 

Select the "Multiplayer" button.

Your server should appear in the local list automatically, but if you can’t locate it:

  • Select “Add server.”
  • Enter the IP address of your Raspberry Pi.
Enter all the information about your Raspberry Pi Minecraft Server.
  • Click “Done.”

You should now be successfully connected to your Minecraft server. 

You should now successfully connect to your Minecraft server.

Boot your server automatically 

Why go to the hassle of launching your server manually when you can set it to start automatically?

To start your server at boot, you’ll need to create a new service for the Minecraft server, so open a Terminal window on your Raspberry Pi and run the following command:

In the Nano text editor, enter the following:

Save this file using the Ctrl + X keyboard shortcut, and then press the y and Enter keys when prompted.

You can now enable the service using the following command:

And finally, you can start your Minecraft server: 

Your server should now start automatically every time you power up your Raspberry Pi.  

You can now customize every part of your Minecraft world, and play with friends and family. Currently, your server is only accessible over the local network, but you can allow people to connect to your server from the outside using port forwarding.

Have you set up your own Minecraft server? If so, then we’d love to hear how you’re using your server to create unique and interesting Minecraft worlds.

Related:

38 comments

      1. Hi I found that out to stop it’s just stop to start its java -Xms512M -Xmx1008M -jar /home/pi/minecraft/spigot-1.15.2.jar nogui

        Chang the version based on what you are setting up

  1. you should add this :
    before starting your server, create a file ops.txt in /home/pi/minecraft and add your username (to be admin and stop the server)

  2. When I do sudo systemctl start minecraftserver.service, it says minecraftserver.service has a bad unit file setting. I don’t know why. Please Help.

    1. A bad unit error usually means there’s an issue with your service file. Are you able to post the contents of your service file? Also, can you let me know what model of Raspberry Pi and version of Raspbian you’re using?

      1. I am going to restart, I am new to programming and I messed up somewhere. I doesn’t take me very long to redo everything. Thank you for the help though.

        1. Okay – hopefully it works for you this time around! Please let me know if you have anymore questions :)

          1. I do have one, after I accept the eula, should I do java -Xms512M -Xmx1008M -jar /home/pi/minecraft/spigot-1.15.2.jar nogui again, or should I reboot?

    1. Hi, just to clarify are you asking how to launch the Terminal on your Raspberry Pi, or how to run console commands within Minecraft, e.g https://minecraft.gamepedia.com/Commands ?

      1. Hi, Not the same guy but I was wondering how I access the command screen to run console commands for minecraft once minecraftserver.service has been started.

        1. This varies between platforms, but on Mac or PC you enter commands via the chat window. To open this window, make sure the Minecraft window is selected and then press either the T or / key. This opens a little grey bar along the bottom of the Minecraft window where you can enter your commands – all commands needs to be prefixed by the / character.

  3. currently having problems with port forwarding and get an error stating io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: any suggestions?

    1. Are you trying to connect to your Minecraft server from inside your home network, or externally? If you want to access the server from outside your network, then you’ll need to setup port forwarding rules on your router. Every ISP is different, so you may need to look up the instructions for your particular router.

      If you’re trying to connect from inside your network, then it seems that either a firewall on the server or the client is blocking the port, and preventing your from communicating with your server. It’s also possible the server may not currently be running (run “sudo systemctl start minecraftserver.service” to start the server) or the sever may not be running on the expected port.

      1. I am having the same issue. I had the server running but my friends could not connect to it so I set up port forwarding and a static IP for the pi. ever since I did so I have been getting that error. any ideas how to fix this?

  4. i need help: after i did sudo systemctl enable minecraftserver.service a error came: Failed to enable unit: File minecraftserver.service: Invalid argument
    plss help fast .D

    1. Can you open the file manager and check that the “minecraftserver.service” file has been created in the correct location (/lib/systemd/system/)?  You may also want to open the minecraftserver.service file (sudo nano /lib/systemd/system/minecraftserver.service) and make sure there aren’t any typos/errors in the text. Finally, are you using Raspbian as your operating system? 

  5. I’m having trouble launching the server

    running java -Xms512M -Xmx1008M -jar /home/pi/minecraft/spigot-1.15.2.jar nogui gives me an error unable to access jarfile /home/pi/minecraft/spigot-1.15.2.jar

    I did notice that it does appear the minecraft_server.1.15.2.jar is located in my /home/pi/work folder

    I’m just a simple dad hacking around on a Raspberry Pi 3 trying to set one up for my 6-yr old. Any suggestions on a fix?

    1. If your jar file is located in /home/pi/work then the “java -Xms512M…” command should point at this location. The following should work:

      java -Xms512M -Xmx1008M -jar /home/pi/work/minecraft/spigot-1.15.2.jar nogui 

  6. Hi, great tutorial! I was able to install and get the server running (as far as I can tell), but when I try to connect to it with my iPad, it says “Unable to connect to world”. The Rpi is wired, and the iPad on the wifi. I’m using the port 25565 (that appears in server.properties).
    Any suggestions? I’m starting to doubt whether the iPad can connect to this server. I was able to connect to online servers though.
    Thanks!

    1. Spigot is designed to be used with Minecraft Java Edition, and not the Minecraft mobile app (Bedrock Edition/Pocket Edition). If you want to setup a server for Minecraft on the iPad, then you could try installing Nukkit on your Raspberry Pi (https://ci.nukkitx.com/job/NukkitX/job/Nukkit/job/master/)

  7. Hi
    Im trying to set up a minecraft server for me and my friends but im struggling as it says “bash: java: command not found” when i type in “java -Xmx1024M -jar BuildTools.jar –rev 1.15.2” and i don’t know what to do.
    thanks

    1. It sounds like Java isn’t installed on your Pi. To check, try running “java -version” in the Terminal. If it returns an error, then you can install Java with the following: 

      sudo apt update
      sudo apt install default-jdk

    1. If you’ve created the minecraftserver.service service, then run the following in your Terminal:

      sudo systemctl start minecraftserver.service

      Alternatively, if you don’t want to start your server automatically using the minecraftserver.service service, then you can run the following in the Terminal:

      java -Xms512M -Xmx1008M -jar /home/pi/minecraft/spigot-1.15.2.jar nogui

    1. Hi – Are you getting any error messages that you can share?

      If you’ve created the minecraftserver.service service, then you can check that your server is running using the following:

      sudo systemctl status minecraftserver.service

  8. Hi, i am having an issue with where once i have put in this command java -Xms512M -Xmx1008M -jar /home/pi/minecraft/spigot-1.15.2.jar nogui it says error: unable to access jarfile /home /pi/minecraft/spigot-1.15.2.jar

    Any help would be greatly appreciated

    1. Hi – Can you check that “spigot-1.15.2.jar” is located in your /home /pi/minecraft folder? Open the file manager app and then navigate to your  /home/pi/minecraft folder – if the jar isn’t located in that folder then you’ll either have to move your jar there, or update the Terminal command to reflect spigot-1.15.2.jar’s location on your Raspberry Pi. 

      If spigot is located in this folder then it could be a permissions issue, so try running:

      sudo java -Xmx1024M -jar BuildTools.jar –rev 1.15.2

  9. I am having issues with the server of https://torrent-mac.com/ while editing some articles on it… can you help me out?

  10. Hi. Thanks for the tutorial. I have a relatively complicated issue involving an error message that pops up when I launch when server and the spawn area has loaded. (Please note that the file path to get to the server has updated since this tutorial was released, and I had to find the jar file: “/home/pi/minecraft/work/minecraft_server.1.16.1.jar” Anyways, when the spawn area finally finished preparing, it says this following error message:
    [16:50:55] [Server thread/INFO]: Preparing spawn area: 99%
    [16:50:55] [Server thread/INFO]: Time elapsed: 136965 ms
    [16:50:55] [Server thread/INFO]: Done (137.666s)! For help, type “help”
    [16:51:01] [Server thread/WARN]: Can’t keep up! Is the server overloaded? Running 6653ms or 133 ticks behind

    and basically repeats that, with larger amounts of ticks it can’s keep up with (e.g. 618, 1278)
    I have connected to the server via my laptop, and I join the world. I walk over to a tree and try to break it, and it flashes, but never drops the log. A couple of moments later, the server console says
    [16:51:10] [Server thread/WARN]: Can’t keep up! Is the server overloaded? Running 2999ms or 59 ticks behind
    [16:51:13] [Server Watchdog/FATAL]: A single server tick took 60.00 seconds (should be max 0.05)
    [16:51:14] [Server Watchdog/FATAL]: Considering it to be crashed, server will forcibly shutdown.
    [16:51:16] [Server Watchdog/ERROR]: This crash report has been saved to: /home/pi/minecraft/work/./crash-reports/crash-2020-07-27_17.03.16-server.txt

    I don’t know what to do… It has done this every time I have booted the server. PLEASE HELP!!!

    –Also another question, How do you make it where you can change your gamemode and have admin capabilities? When I go the in game command bar, nothing works… Thanks!!!!!

    1. I turned off the server and tried turning it back on, but it gave me a error “Failed to start the Minecraft server” sessionlock exceptionworldconflict already locked

      Any solutions?

  11. I have been running into a issue and idk how to fix.

    I have the ip of the server but i cant connect to it
    ‘i have everything working so far

    Another side question, how do increase the ram of the server

Leave a Comment

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.