How To Turn Your Raspberry Pi Into A Minecraft Server

From E-learn Portal
Jump to: navigation, search

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!



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.



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.



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." Again



3. Select the "Interfaces" tab.



4. Find "SSH" and select its accompanying "Enabled" radio button.



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 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.



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. Xwcb To retrieve this information, open the Terminal and run the following command:



Launch Minecraft Java Edition on your laptop or computer.



Select "Play -> Multiplayer."



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. - Click "Done." You should now be successfully connected 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, we'd love for you to share your experiences with setting up your Minecraft server and how it's allowing you to create unique and exciting Minecraft worlds.