Minecraft is an amazing game. It's longevity is matched only by its boundlessness, and whether you're a frequent player or returning ex-addict like me, there's no better feeling than spinning up a quick server with some mates for a few hours of block-based fun. But before that fun can begin, you'll need to overcome your first hurdle - getting a server up and running. Sure, you could pay some online company a few bucks to run one for a month. But where's the fun in that? A Minecraft server for a couple of people will run on just about anything, including most SBCs (single board computers) you're likely to have lying around the house. So let's do things the old-fashioned way, and set up a Minecraft server for you and your friends on an SBC.
✕ Remove Ads
For this example, we've chosen a Raspberry Pi. This is a great option since it's easy to set up and has prebuilt ARM distributions for both the OpenJDK on ARM. Your mileage may vary on other SBCs, but you'll want to ensure that distributions are available for your server of choice.
Related
5 Raspberry Pi projects you can wear
Take your Raspberry Pi everywhere you go - literally.
How to set up a Minecraft server on a Raspberry Pi
Get up and running for the first night
We'll dive straight into the setup guide, and run through some tips for optimizations later. To start with, ensure your Raspberry Pi is powered on and connected to your network via Ethernet or Wi-Fi. We'll be using Raspberry Pi OS (plenty of room to change this to Ubuntu Server if you're looking for more performance, for example). For this example, our Raspberry Pi has been configured with SSH access from the OS install stage, so we'll be using a terminal on another PC to configure the server.
✕ Remove Ads
First, ensure your Raspberry Pi is up to date by running: sudo apt-get update && sudo-apt-get upgrade
Once updated, install the OpenJDK with the command below. We'll be using OpenJDK17, which is required by the Minecraft Java Edition server. sudo apt-get install default-jre
Releases of OpenJDK in the default repositories for Raspberry Pi OS tend to lag behind Minecraft server versions. If you're encountering a LinkageError, we'd recommend either switching to Ubuntu or using an older version of the Minecraft server binary.
Create a folder to store your files in: mkdir server && cd server Once the JDK is installed, download your Minecraft server binary. There are a few options for which server you may use - common ones are the official server, Spigot, and PaperMC. The official binaries are available from this URL. Download them to your Raspberry Pi with: wget <download URL> To accept the Minecraft EULA, run the server once to generate the EULA file: java -Xmx1024M -Xms1024M -jar server.jar nogui The server will send an error and warn you that you will need to accept the EULA to continue. To do that, edit the 'eula.txt' file that's been created in your directory using a text editor of your choice (Vi and Nano are good options). Change the eula=false property to equal true.
Restart the server using the same command as before: java -Xmx1024M -Xms1024M -jar server.jar nogui Voilà - your server is up and running. You should see your world-data generating, as well as some other information. The server will run on the default port initially, so look out for this line: Starting Minecraft server on *:25565 You can stop your server with CTRL+C.
✕ Remove Ads
Editing your server properties
To configure your server, you'll notice there's a server.properties file created in your directory. Inside this file is a configuration for the official server binary. If you're using an alternative server, like Spigot or PaperMC, they will have alternative configuration options in their own config files. To make changes, edit these files and restart your server.
Running your server in the background
Now you have a server running, you might notice a problem - the server stops when the terminal is closed! In order to fix this, we can use a tool called screen to hold open a terminal session in the background, allowing us to attach and detach from it at will and leave our server running 24/7. If screen is not already installed, you can do so using the command:
✕ Remove Ads
sudo apt-get install screen
To start a new screen session, first kill your existing server process. Then, type the following to start a new screen session:
screen -S minecraft_server
The latter argument will be the name of your session, so name it appropriately (especially if you're running multiple servers). You'll see a new terminal session open and your history will clear. You can now restart your Minecraft server. Once it's started, press CTRL+A then D to detach your session. CTRL+A is what's known as a leader for screen, it's the hotkey that tells your terminal that you're interacting with the screen process. D is then the shortcut for detachment, so this hotkey will detach your terminal session but leave it running in the background.
✕ Remove Ads
You can check whether your session is still running by listing the screens running on your machine.
screen -ls
And finally, reattach to your session with:
screen -r minecraft_server
Optimizing for performance
Optimizing a Minecraft server for performance is a huge topic, so we'll only cover the basics here (and bits that are especially relevant for SBCs). Firstly, you'll want to ensure you disable the GUI on your Raspberry Pi, as this soaks up vital memory that your server will need. You can do this using raspi-config relatively easily. Secondly, you'll want to provide some more memory to your server. The JRE has a few options around memory management that are important to know. In each case below, size is replaced by an amount of memory, e.g. 1024m for 1024 Megabytes, or 2G for 2 Gigabytes.
✕ Remove Ads
-Xmx<size> - The XMX flag sets the maximum heap size for the server, or (very loosely) the maximum amount of memory that can be used by the server. -Xms<size> - The amount of memory to initalize the processes heap with, which should be the same as or less than -Xmx.
There are lots of other options to configure, but these are the two baseline ones. For our Raspberry Pi with 4G of memory, we configured 2.5G for both, which seemed to run fine.
✕ Remove Ads
Related
Someone added liquid nitrogen cooling to a Raspberry Pi 5, because why not
It broke the overclocking record for a Raspberry Pi, and it may not change hands anytime soon.
Using alternative binaries
Another thing to consider, which we've touched on above, is using alternative binaries. If you're planning on just playing Minecraft for a few hours with your friends, we'd recommend sticking with the Official Microsoft binaries. They're not better than the others, but they're a little simpler to get a grip on, have far fewer configuration options, and are very well documented. If you're planning on running a more expansive server, or are finding you're hitting performance limits, then Spigot and PaperMC are great alternatives. Spigot is probably the most common and widely documented, but options like Paper can give you extreme customization if you're looking for more advanced performance tuning options. There's a great comparison of all the popular servers on the Spigot wiki.
✕ Remove Ads
Port forwarding
Finally, if you're looking to allow your friends to externally access your server, then you might need to do some port forwarding. This exposes a specific application port, like 25565, to the outside world. There are some dangers to port forwarding, and you'll need access to your router's administrator panel to do it. Check out our other guides on XDA for more information about this. If you're only playing privately or with people you trust to access your network, you might be better off setting up a WireGuard VPN or similar, to allow external users to securely access your network.
A Raspberry Pi makes a great Minecraft server host
Provided you're not looking to run big games or blow up half the world, a Raspberry Pi makes a great Minecraft server host. It's a relatively low power machine, plus the newer models have more than adequate memory, gigabit Ethernet, and are cheap to run. They make it easy to learn about and customize your server, without needing to rely on a third party company or web interface to make the adjustments you want.
✕ Remove Ads