fbpx

Most orders for IN STOCK items placed by 12PM CST M-F ship SAME DAY. Orders for custom items and prints may take additional time to process.

Setup a Raspberry Pi Minecraft Server

Minecraft is more fun when you have a server to play on. With a Minecraft server up and running, you and your friends can meet up and team up as you explore the same Minecraft world. But running a server can sometimes be a pain, too. Servers are best when they’re always on — you don’t want to shut down your shared Minecraft universe every time that you close your laptop. Having the server running on your desktop can be a burden, too, depending on how beefy your PC’s specs are. Happily, the Raspberry Pi can help us out here. Our favorite little computing device is powerful enough to run a Minecraft server, and setting up a Raspberry Pi Minecraft server means that you’ll have easy access to an always-on server. Once your Raspberry Pi Minecraft server is set up, you can just stash your Raspberry Pi somewhere out of the way without so much as a monitor or a keyboard attached. Easy!

This project requires a bit of tinkering with the Terminal. It also requires Java and — unless you’re planning to play only on a local network — requires you to set up port forwarding and run an internet-connected server. You’ll need a passing familiarity with Raspberry Pi projects and programming projects, and you’ll need to be comfortable with the inherent risks of running any kind of web-connected server (we’ll talk about some ways to mitigate those risks, too). You’ll also need all of these goodies:

Gather up all of that, and we’ll get started!

Step 1: Install the Java Runtime Environment

Installing the Java runtime environment
Installing the Java runtime environment

To run a Raspberry Pi Minecraft server, you’ll need to have a Java runtime environment set up. When we talk about the “environment” in this sense, we’re talking about what a piece of software can access and execute. Accessing and ordering around important stuff like RAM is typically something done indirectly, if at all, by software programs written in high-level languages. But we can give Java the ability to take a very hands-on approach if we install a runtime environment (RTE) for it. A RTE gives an application access to things like software libraries and system variables. Running in an RTE, Java can order around your processor and use the RAM it needs with no questions asked.

There are security risks that come with running a server with Java, which is one reason why a Raspberry Pi Minecraft server is a good idea in the first place — with a Raspberry Pi Minecraft server, you’re not running a Minecraft server on the same laptop or desktop that you use to do your schoolwork or your taxes.

As a further security measure, it’s a good idea to make a separate user account on Raspbian for your server if you plan to use your Raspberry Pi for anything besides this server.

Once you’re logged into the right user in Raspbian on your Raspberry Pi, open the Terminal. It’s good practice to run a quick check for updates with the command sudo apt-get update and sudo apt-get upgrade before we get started. Once you’re ready to go, type this command into Terminal to install the Java runtime environment (JRE):

sudo apt install openjdk-8-jre-headless

We’ve chosen to install the “headless” version of the JRE because it’s a little more lightweight. The headless package is used when you don’t have to worry about graphics, which we don’t — all the graphics stuff will be happening on devices that you and your friends play on.

Step 2: Download Minecraft’s server software

There are a few different apps that can run Minecraft servers, but we’re going to keep things official and use the one that Minecraft offers for free on its website. Head to Minecraft.net and download the latest and greatest version of server.jar.

That will land server.jar in your downloads folder, but let’s not leave it there. Go ahead and make a folder for your server within the home directory. You can do that in File Manager or just type this command into Terminal:

mkdir Minecraft_Server

The mkdir command means “make directory,” and that’s just what Raspbian will do for you. The new folder will be right where we want it: in your Raspberry Pi‘s Home Folder, which is where you are by default when you are working in Terminal.

Now, grab the server.jar file that you downloaded and put it in the Minecraft_Server folder. It’s probably easiest to do that in File Explorer, though you can use the mv command in terminal if you’d prefer.

Step 3: Read and confirm Minecraft’s end-user license agreement

Let’s get back into Terminal. While in Terminal, we’re going to navigate to our Minecraft_Server folder and files.

Assuming you didn’t do anything funny when you created your Minecraft_Server folder, we should be in that folder’s parent directory (Home) already. You can double-check with the command ls, which will list the folders and files within the directory that you’re already in. You should see Minecraft_Server in there. We want to get into our new directory before we take any further steps, so let’s type this command into Terminal:

cd Minecraft_Server

Now that we’re in the right folder, we can issue commands that impact the files within this folder. We’ll type a command that starts our server:

java -Xms1G -Xmx1G -jar server.jar

And we will promptly get error messages. It turns out that we have to confirm that we’ve read Mineraft’s end-user license agreement before we can use our server. Alright, then, let’s do that! Read Minecraft’s EULA on Minecraft.net. Then, look in your Minecraft_Server folder for a text file named eula.txt. Open it up and change the line eula=false to eula=true. You can do this in the file explorer or within the Terminal with our favorite text editor, nano, via the command nano eula.txt.

Marking the EULA as read in order to run our Raspberry Pi Minecraft server
Setting eula to “true” in eula.txt

With “eula=true” in there, go ahead and close the file (if you’re using nano, that’s Ctrl+X), making sure to save the file on your way out.

We weren’t trying to waste any time by attempting to run the server before signing the EULA, by the way: the eula.txt file only appears after you try (and fail) to start the server.

Step 4: Start the Raspberry Pi Minecraft server

With the red tape and fine print all taken care of, it’s time to start our server for real. As we do so, we’ll also allocate some RAM for server.jar to use when it runs.

A view of the Raspberry Pi Minecraft server GUI
Our Raspberry Pi Minecraft server is up and running

We’re still in the Minecraft_Server folder (if you’re in a new Terminal window for any reason, get back to the right folder with the command cd Minecraft_Server), and our next command is the same one that we used to trigger the error messages in the last step. This time around, it should actually work. Here it is again — though you might want to read the explanation below it first, just in case you have to change any numbers in your version.

java -Xms1G -Xmx1G -jar server.jar

This command starts the server. The use of “java” lets our Raspberry Pi know that this is a Java program, so a Java interpreter should be used. The bit that says “server.jar” identifies the application we’re opening. In between is where we’re allocating RAM to our server. With “-Xms1G” and “-Xmx1G,” we set how much RAM we want server.jar to start with (1 GB) and how much it’s allowed to use at the absolute maximum (also 1 GB), respectively. Minecraft’s wiki recommends using at least 1 GB for a server designed to host up to four players at once, so that’s what we’re doing. On the Raspberry Pi, we can’t spare too much more — we need to run Raspbian and other essentials, too.

If you’re using an older Raspberry Pi, you may want to tweak the amount of RAM that you allocate. Going below 1 GB isn’t necessarily great for your server’s performance, but you won’t have much of an option if you’re using a Pi that only has 1 GB of RAM total. You can check out RAM availability in the Terminal with the command free -m. If you need to use less than 1 GB of RAM, you can change the G in the command to M (for MB instead of GB, of course). Alternatively, if you have a Raspberry Pi with 4 GB of RAM (as some, but not all, Raspberry Pi 4 models have), then you might want to use 2 or even 3 GB in your server launch command. Keep in mind that there are other factors to consider, too, like render distance settings and RAM-taxing in-game builds such as mob grinders and redstone contraptions. Whatever you choose to do, make sure that you don’t set the starting RAM (“-Xms”) higher than the maximum (“-Xmx”).

Step 5: Adjust and connect to your Raspberry Pi Minecraft server

If all goes well, your server should be up and running smoothly. Now you can tweak settings on your Raspberry Pi or use another device to play Minecraft on your Raspberry Pi Minecraft server.

When you launch your server, a graphical user interface (GUI) will launch, too. You can use this screen to type in server commands and mess around with your Minecraft universe.

You don’t actually need the GUI, though. If you’d rather launch the server without it, you can append nogui to the end of the launch command, like so:

java -Xms1G -Xmx1G -jar server.jar nogui

You can also mess with default settings on your server by accessing the server.properties file within your Minecraft_Server folder. With your server shut down, just open the file with your text editor of choice. We’ll use nano:

sudo nano server.properties

Within server.properties, you can change settings like the maximum number of players and the default view distance. Just be careful not to mess up the file and break your server. When you go back and start up your server again, your new settings will be in place.

With your server up and running, you can now connect to it from another device running Minecraft.

With your Raspberry Pi still running the server, grab another device. Open Minecraft and click Multiplayer and then Add Server.

The Server Name doesn’t matter, so put anything that you’d like in that spot. As for the IP address, that will be the IP address of your Raspberry Pi. If you don’t know it, you can check it by going back to your Raspberry Pi and running the Terminal command sudo hostname -I.

Click Join Server, and you should be connected — but only if both you and your server are on the same network. If you want to make your server available beyond your local network, you’ll need to take another step.

Step 5: Set up port forwarding

Our new Minecraft server is up and running. We can connect to it from devices on the same network and play to our heart’s content. However, we can’t yet connect to our server from outside of the network. If you want your server to be connected to the internet, you’ll need to set up port forwarding.

For this part, you’re going to be working with your network router. You can access your router through your web browser by entering the router’s address and entering your administrator credentials. Routers often use 192.168.1.1 or 192.168.1.254, but your router could very well use something else. Check your router for more details — it will likely have a sticker with its address and default login information.

As with the address, your router’s user interface may vary, so we can’t tell you exactly what you’ll see when you access its user interface in your browser. One way or another, though, you’ll need to find the port forwarding settings and set them up like so:

Service Port: 25565
Internal Port: 25565
IP address: Your Raspberry Pi‘s IP address (find it in the Terminal on your Pi with the command hostname -I)
Status: Enabled
Protocol: TCP/UDP

It’s also good idea to assign your Raspberry Pi a static IP. That, too can be done through your router’s settings; just look for “static IP” or “static routes” settings and set your Raspberry Pi‘s IP to static (if you’re having trouble with any of this, try a Google search on the subject with your router’s brand name as a search term).

You should also check out your server.properties file and make sure that “Server IP” is identified as your Raspberry Pi‘s IPv4 address.

With that, you should be able to access your Raspberry Pi Minecraft server from outside of your home network by using your IP address. This time, though, you’ll be using your public IP address. To find that, just use Google (search “what’s my IP address?”) or a side like whatsmyip.com.

Of course, any time that you connect your network to the internet, you do so at your own risk. Java has had some security issues in the past, so be aware of the risks that come with setting up a web-connected server. Some Minecraft fans use VPNs to protect their privacy, though you should know that VPNs and Minecraft’s server program don’t always play nice with each other and that you may have some troubleshooting to do if you go that route.

And that’s that! Enjoy your Raspberry Pi Minecraft server.

Upgrade to Premium

If you like our content maybe consider upgrading to Premium. You’ll get access to

  • Free access to all plans
  • Member only videos
  • Early access to content
  • Ad free Experience
  • Discounts on store merch
  • Direct hotline contact form

8 Responses

  1. Thanks so much for writing this up. I have been wanting to setup a Minecraft server for my kids. I just inherited an older i3 chromebox (Asus cn60) from my dad which I installed Gallium OS on. Can I install the server on it using the same instructions? Thanks

  2. I set this up, but I can’t connect to it. It shows it’s running but even entering in the IP address and port number in Minecraft it can’t find the server. I have port forwarding set up correctly on my router and even on the same network it just can’t find the server…

  3. Uhmm I keep doing it up to the point where I can’t see any Txt document for the “agreement” set info to “true” part? The other server download is there and transferred properly but no Txt agreement file?

Leave a Reply