Hosting A Modded Minecraft 1.16.4 Server on a Raspberry Pi

Part Two — Setting Up the Server

Recently, some friends and I wanted to check out the recent major updates made to Minecraft. There’s something especially inviting about diving into a new world, exploring the infinite landscape and building huge castles with friends that has captured Minecraft players for years.

What’s not particularly exciting is figuring out the complicated server hosting options. There are a plethora of options available that require a monthly fee. Some of them even allow you to use mods, but the configuration options can be limited and the fees can get expensive quickly. Instead, I decided to repurpose a Raspberry Pi 4b into a modded Minecraft server hosted on my local network. Now I can dive into the world made by my friends and me anytime, use exactly the mods we want to use and, best of all, not pay any monthly service fees.

If you haven’t followed along with Part One, make sure you check it out first! You’ll want to get Forge up and running on single player before tackling this.

You’ll need a couple of things to get started. Heads up! Some of these links are connected to my Amazon Affiliates account.

Hardware Required:

Software Required:

Game version should match your version of Minecraft Java Edition, which should also match your version of Forge.

A note about mods —

Some mods, like the very popular Optifine, are client side only. That means we won’t need to put them on the server and players are free to use them as they please. All other mods must be installed on the server and the client, so all players must have a matching mod list! If a mod doesn’t specifically say it’s client side only, assume it’s for both.

Don’t forget to go through all the steps in Part One before moving on!

Setting Up the Server

Now that you’ve got single player working with your mods, it’s time to put a server on your Raspberry Pi so your friends can join you!

The first step is to image your SD card with a copy of Raspian OS 64bit. We want the 64 bit version because we’ll be running Minecraft with as much memory as possible. You can download it here. We’ll also need to use the Raspberry Pi Imager to image our SD card with the OS. You want to select the ‘Use Custom’ option at the bottom and select the .img file of the 64bit OS.

Once the SD card is imaged, open it in Finder / File Explorer. The drive should be called BOOT. We’re going to add a single file here simply called ssh . The file is empty and doesn’t have any extension. Just make the file and drop it into BOOT. This is going to allow up to access our Raspberry Pi remotely.

Safely remove the SD card and place it in the Raspberry Pi. Connect the Pi to your WiFi router or modem with the Cat6 cable and connect it to power with a USB-C cable. The Pi should light up and, if you installed it in the active cooling case, the fan should kick on.

Connecting to the Pi Remotely

Assuming the Pi booted properly, it should now be accessible on your local network. We need to find its local IP address. To do this, you’ll need to access your router’s maintenance page. Typically, you can do so by navigating to in your browser. If that doesn’t work, you’ll have to research your particular router’s brand and model to find out how to access its web page.

Once you’re in your router’s menu, find where the devices on your network are listed, called ‘Device Table’ or something similar. You should see a list of all devices connected, including one called raspberrypi . Somewhere next to the device name is the local IP address, likely 192.168.0.XX , where XX is some number between 1 and 255.

For Windows 10 —

Unfortunately, there’s no native solution to connecting via ssh with Windows. There are free solutions, like graSSHopper, that you can use, that make it pretty easy. We’ll need to be able to transfer files and issue commands on the Pi’s CLI. Once you’ve got that figured out, come back!

For MacOS —

Macs have native ssh support right from the terminal. Open your terminal in the launchpad or by going to Applications > Utilities > Terminal. In your terminal, type ssh pi@<pi's IP address> . If all goes well, you’ll probably get a warning message about storing a certificate. Go ahead and agree. You should be prompted for the Pi’s password. By default, the password is raspberry.

Installing the Server and Adding Mods

Once you’re in, you should be treated by this command prompt in the terminal:

pi@raspberrypi:~ $

Make a new folder by typing mkdir forge_server and pressing return. Navigate into that folder by typing cd forge_server . This is where we’ll keep our server files.

We need to transfer the Forge .jar file we used to install Forge on the client earlier. Doing so isn’t quite as easy as dragging and dropping, but it’s pretty close. On Windows, use whichever SSH client you downloaded for this. On Mac, we can use the terminal.

Open a new terminal tab by pressing CMD + T. Navigate to wherever you have the server file in the terminal. If it’s on your desktop, type cd ~/Desktop . We’ll use scp to transfer the server file to our Pi. From the new terminal window, type the following command to move the server file.

scp ./<name of serverfile> pi@<Pi's IP>:/home/pi/forge_server

Before transferring, let’s rename the server file to something easy, like forgeServerInstaller.jar. The scp command for me was this:

scp ./forgeServerInstaller.jar pi@

You should be prompted for the Pi’s password, then treated to a percentage bar of the file being transferred. Go back to the Pi’s terminal window and enter ls . You should see the server file there.

At this point, we need to get Java installed on the Pi. In the Pi’s terminal window, type these two commands.

sudo apt update
sudo apt install default-jdk

The first will update the Pi, the second will install OpenJDK. Once it’s finished, type java --version , you should see something like this.

Ok! It’s finally time to install the server. Run the following command.

java -jar forgeServerInstaller.jar --installServer

You should be treated to a somewhat lengthly install process. Once complete, enter ls again to see the generated files.

You won’t have all of these, that’s ok. The most important things here are eula.txt , forge-1.16.4.jar , , world , and mods .

You’ll have to edit the eula.txt file before we continue. Enter sudo nano eula.txt . It should open in an editable interface. Simply change false to true . Press ctrl + x to close, agreeing to save in the process. is where you can edit your server rules. Feel free to edit it in the same way, or leave it all on default.

world is the folder that acts as your world’s save file. You can move this between servers if you want to save the landscape all the buildings that you’ve made with your friends, or periodically back this up with scp to avoid losing progress.

mods may not exist. If it does, we’re actually going to remove it to make things easier. If you have a mods folder, remove it by entering rm -rf mods. This is where we’ll move all of our downloaded mods .jar files. If fact, let’s do that now.

Go back to your other terminal window (the one pointed at your desktop). Place all of your downloaded mods in a folder called mods on your desktop. In the terminal, enter this:

scp -r ./mods pi@<Pi IP address>:/home/pi/forge_server

After entering the Pi’s password and waiting, the mods folder should be on the server. Awesome! Our mods are installed.

Finally, forge-1.16.4.jar is the file we’ll use to start the server. I like to copy this file with a new name to make things easier.

cp ./forge-1.16.4.jar ./forge.jar

This will make a new file called forge.jar that we can use instead. Totally optional.

Starting the Server

Here’s the big moment. Run this command to start the server.

java -Xmx7G -jar forge.jar

What are we actually doing here? We’re using Java to run the .jar file like an executable, but there’s an extra flag in there too, -Xmx7G . We’re explicitly allowing Java to use as much RAM as it needs up to 7GB. It’s also why we needed the 64bit version of Raspian, since the 32bit version won’t allow this memory allocation.

The Pi we’re using has 8GB of RAM, so we’re reserving 1 for the OS. If your Pi is the 4GB model, adjust accordingly, but I highly recommend upgrading for this project.

Cross your fingers and watch the terminal. You should see some messages roll past about the mods you’re using, a progress bar of the world being created, then finally a blank line with the occasional message populated.

Yes! It worked! If it didn’t, you’ve got some trouble shooting to do. Fortunately, the error messages are well documented and you’ll find plenty of help online by copy / pasting them into Google.

Playing on the Server

At this point, you should be able to join a game on your server. Launch Forge from your Minecraft launcher. Remember that the mods you’re using need to exactly match those on the server, with the exception of client-side only mods.

Select multiplayer, then direct connection. Type the local IP address of your Pi into the field and press Join Server. If you’re able to connect, you should see a message in the terminal saying ‘Player <player name> connected’.

That’s it! You’re now playing on a server you created and are hosting on a Raspberry Pi! Pretty cool. There are two more things we need to do to get your friends online though.

First, you’ll need to establish port forwarding in your router’s configuration. This will expose the IP address of the Pi to the internet so people outside your local connection can access it. WARNING: port forwarding can be dangerous. Don’t ever give this IP address to people you don’t trust.

How to do this exactly will depend on your router, but open up the settings page in the same way you did before. For my router, the configuration is under Advanced > Security > Port Forwarding. Set up port forwarding for your Pi’s IP address, the port number is 25565.

Once port forwarding is established, we need the global IP address of the Pi. The easiest way to do this is by going to the Pi’s terminal window, killing the server by typing ctrl + c, then entering the following:


You should be returned with the IP address of your Pi. You can use that to access the server from outside your network.

The last step is to run the server as a background process. Right now, if you exit the ssh session of the Pi, the server will stop running. To run it as a background process, start the server like this instead:

nohup java -Xmx7G -jar forge.jar&

If it goes well, you won’t see anything happening. So how can you verify that the server is running? Use the top command to see a list of running processes. You should see one labeled java using a fair amount of resources.

If you want to kill the server, use top to find the PID of the service running the server. It should be a three to five digit number. Once you’ve found it, exit top using ctrl + c, then enter kill <PID>. This will kill the server process.

Run the server again, then enter exit to leave the ssh session. Your Pi will continue to happily run the server.

That’s it! You and your friends can now play whenever you want without needing to pay monthly fees. If your server ever crashes, follow the steps to ssh into the Pi and restart the server. Enjoy!

Web Developer and Tech Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store