Raspberry Pi Minecraft Server

From Scientific Programs
Jump to: navigation, search

A Raspberry Pi Minecraft server is a cost-effective way to have your very own private server with your friends or just for stuffing around on.



Mine has been up for a while and I haven't had any issues. It is important that you know that this server is not capable of hosting many people.



Based on my experience, if you have more than five people, your server will get a little wonky. The optimal number of people was between two and three. However, this can be increased by tweaking the server.



We'll also be using the Spigot version of Minecraft because the default one didn't work. I found that it will crash a lot, be laggy, and is very unstable. The official Java version will likely improve over time.



This project will use Java that should already have been installed on the Raspberry Pi (if you're using Raspbian full version).



We will make a few changes to optimize the server for the Raspberry Pi 2, 3, or 4 if you have one. We will also set the Pi up so you can access the web and reboot it in case it goes offline.



Equipment



Please find the equipment that I used for making this Raspberry Pi Minecraft server below.



Recommendation



Raspberry Pi Micro SD Card Ethernet Cable or Wi-Fi (I recommend using an ethernet for the best network performance) Power Supply Optional



USB Keyboard USB Mouse HDMI Cable Raspberry Pi Case Video Tutorial



Check out my video below if you want to learn how to set it up. Otherwise, I have a detailed text explanation immediately below the video.



If you enjoy the video, please subscribe to our YouTube channel or follow us on Facebook so we can keep you up-to-date.



Installing the Raspberry Pi Minecraft Server



Firstly, we will need to install Raspbian onto the Raspberry Pi. If you haven't already done this, then check out my awesome guide on installing NOOBs Raspberry Pi. It will guide you through the entire process.



Important: Raspbian Buster will require you to have the most recent version installed. If Java isn't installed, then this will cause the server not to work. I highly recommend updating to Jessie, Stretch, or Buster.



This tutorial will be performed entirely in the terminal. It is probably best to boot straight into the terminal in order to save memory and avoid loading the GUI.



1. Let's first bring Raspbian up-to-date by entering the following.



2. We will now need a few modifications to the config. Let's bring the tool up by entering the following line.



If you need more information regarding the raspi-config tool check out our guide.



3. Let's first go to Advanced Options->Memory Split and update this to 16. This will allow for more memory to be free for the server.



4. You don't want the Raspbian desktop to be booted into, so make sure the boot option is set for the Command Line Interface (CLI). This will give the server as much processing power possible.



5. If possible, change overclocking to High.



6. If you don't have SSH enabled already, make sure to enable it. Is minecraft still a thing



7. Now go to the finish and reboot.



8. We will now need the IP Address of our Pi in order to connect with our server. Enter the hostname command for the Raspberry Pi IP Address.



To ensure that the IP doesn't change you might want to setup a static IP address.



8. Next, we must ensure that Java and Git are installed. We won't be able launch or build the server if we don't.



Enter the following command to install the default JDK package for Raspbian as well as the Git software.



9. Now we need the Minecraft server files. We'll use a Spigot builter tool to do this.



10. Now we need to run the file build tools, so it creates our Spigot Server. It will take approximately 15-30 minutes to complete.



To get the latest version, add --rev1.14.4 to the end. Make sure to change 1.14.4 to the latest version number in the command.



Important: If your Raspberry Pi B+, or B version is before the Raspberry Pi 2, the build tools will likely fail. You will need to create the spigot.jar instead on a more powerful machine.



11. To check if the Spigot server has been successfully downloaded, use ls.



Make sure you remain in the /home/pi/minecraft folder as we want all the server files to be created in here. You can't start the server from a different folder. It will create the files there.



12. Now, we are ready to launch our server. To do so, enter this command. (You may need to change the version number depending on what version you're using e.g. spigot-1.14.4.jar)



Raspberry Pi 1



Raspberry Pi 2, 3 or 4



The Raspberry Pi 4 2GB and 4GB variants allow you to increase the Xmx values even further.



The server will stop straight away as we will need to agree to the Eula. This can be done by entering the following command into the Eula.



13. You can change false to true here. Save the file and exit by pressing CTRL +X and Y.



14. Relaunch the server. It may take a while for a map to be created so allow it to run for three to five more minutes. If the map was already created, it'll only take thirty seconds to load.



15. The server should now be running and accessible over the local network.



16. You may want to modify your username now so you can access all the server commands whenever you log in. Accessing the server backend will be slightly more difficult if it is set to auto-boot at startup.



When the server launches, run the following command: Replace your username with the following command.



17. The Raspberry Pi's Minecraft server should now be running smoothly. But, it is possible to optimize the server for even better performance.



Connecting with the Minecraft Server



If you're connected to your local network, it should not be difficult to connect to the Minecraft server that runs on the Raspberry pi. To test it out, do the following steps.



Load up the Minecraft Java client on a computer within the same local network as the Pi.



Your server may appear in the local list if you go to multiplayer. If it doesn’t, go to direct connect and enter your IP address using the command hostname-I.



Port forwarding is necessary if you wish to allow access to Minecraft servers via the internet.



If you're interested in this tutorial, check out my guide to setting up Raspberry Pi port forwarding. Unless you change it in your server properties, port forwarding port number 25565 will be required to the IP address of your Pi.



Here are some tips to configure the server and get it up and running.



Optimizing the Minecraft Server



We will need to install a plugin in order to get the best performance from our Minecraft server on Raspberry Pi.



Let's first install NoSpawnChunks, which will help to stop the Minecraft server from eating up too much RAM.



You can also download other plugins that will improve performance or extend server functionality. Just use the wget command as we did above to download them to your Pi.



Editing the Minecraft Properties



Now you probably want to know how to edit the server properties. This ability to edit is very important for optimizing the server and customizing it to how you want the server to be.



You can find detailed information on each server setting here.



Enter the following line to access the server properties.



Here are some settings that can be changed to improve the performance of the server.



These settings can be changed however you wish, but the Pi cannot handle too much processing.



Startup Boot Camp



We will need to take a few additional steps in order to get the server to start on boot.



1. We will need the service file to be created for Minecraft server. Enter the command below to get started.



2. You will need to enter the text below into this file.



This file defines the services, so the service manager understands how and what to run. You should also update the spigot version every time you upgrade.



Once you are done, save the file by pressing CTRL+X followed by Y followed with ENTER.



3. Now we need to enable this service. You can enable the service by running the command below.



4. You should now be able to start the Minecraft server by simply using the following command.



5. You can check the status by using a similar command. It is very useful for debugging.



5. You can stop the server by using the following command.



Now, your server should boot. You can now test it by restarting Raspberry Pi. It will take a few minutes to startup.



If you need to access the server from the command line you will need the following steps: Shut down the server, and then load it using normal commands.



I hope this tutorial helped you set up a stable Raspberry pi Minecraft server. If you like this tutorial, then be sure to check out our many other Raspberry Pi Projects.



Feel free to leave us a comment if you have any ideas, plugins or better optimization settings. If you have any questions, please contact us below.