Setting up the server software is the longest step, but also the most important. We will be spending a lot of time entering a bunch of boring Linux commands. Don't let that intimidate you! As long as you can copy and paste you can get through this part.

A Minecraft server is fairly complex, and running it on a computer as small as a Raspberry Pi requires some streamlining. I started out with this fantastic tutorial by James Chambers, because he has several great tips on maximizing server performance. I am going to summarize his installation process below, and highlight some changes and updates I've made, but I strongly recommend you give his page a read for more details.

Now that you've logged back in using the default "pi" and your new password, we can start entering the commands to install the server files.

Important - Lots of these commands are long and complex and would be a real pain to type into the terminal window. So don't do it! Highlight the command text in this window, copy it with ctrl-c, and then in your terminal window just right-click with your mouse to paste the text. See, that mouse is good for something after all!

For the rest of this step, you'll be copying each of the commands in these code text boxes. I'll give short explanations of what we are doing along the way.

We'll start by getting our software all up to date.

sudo apt-get update && sudo apt-get upgrade

Whenever you see a request for installation approval, type "y" and hit enter to accept and continue.

Minecraft runs on Java, but our "Lite" Rasbian install didn't include it, so let's grab that.

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u161-b12/2f38c3b165be4555a1fa6e98c45e0808/jdk-8u161-linux-arm32-vfp-hflt.tar.gz

Note ** When Java gets updated to a newer version that command may become outdated. If you receive an error message you'll need to update the command for the latest version. Visit Oracle's Java downloads page, click the "Accept License Agreement" button, and then right click the link to the latest linux-arm32 file and select copy link. You'll need to use that updated link to replace the text in the above command, starting at http. **

Now we can install the Java files we just downloaded.

sudo mkdir /usr/java

cd /usr/java

If you had to change the download link for a new version, make sure you change the version number in these next commands to match.

sudo tar xf ~/jdk-8u161-linux-arm32-vfp-hflt.tar.gz

sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_161/bin/java 1000

sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_161/bin/javac 1000

cd ~

And finally, the main event you've been so patiently waiting for, let's install the Minecraft server. This is a specialized version of the server called Paper, and it is full of optimizations to improve performance.

mkdir Paper

wget https://github.com/TheRemote/RaspberryPiMinecraft/archive/master.zip

unzip master.zip -d Paper

mv ~/Paper/RaspberryPiMinecraft-master/* ~/Paper/

cd Paper

chmod +x start.sh

wget https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/artifact/paperclip.jar

java -jar -Xms512M -Xmx800M paperclip.jar

That last command will start the server for the first time, and after a few moments you'll receive an error that says you must agree to the EULA. Open the EULA with the next command:

nano eula.txt

Change the line that says "eula=false" to "eula=true". Save your changes by hitting ctrl-x, then Y, then enter.

Note ** James Chambers mentions a method for overclocking your SD card at this point of his guide. I have not personally tried that step, because it requires a high quality card and the one I had available to use is not anything special. I believe that the overclocking would certainly improve performance further, but even without overclocking the server runs well enough that I've gotten no complaints from the kids playing on it. **

Let's quickly take a look at the Server Properties and make a couple of changes.

nano server.properties

There is a long list of things you can change about your server here, such as personalizing the server name and MOTD, changing the gamemode, or enabling PvP or command blocks. You can change things to your preference now, or you can open this file to make more changes later, but there are two changes we will make immediately.

max-players=8

server-port=25565

Eight players is the highest I would recommend, any higher and you are very likely to see server performance get laggy, even with all the optimizations made to run things on the Pi.

Server port should be changed because like the default "raspberry" password, everyone knows the default port of 25565. Even a minor change to 26565 will help keep your server secure. Jot down the port number next to where you saved the Pi's IP address. You'll need both of those later.

Once you have finished updating your settings, save the changes by hitting ctrl-x, then Y, then enter.

The next step in preparing your server is also going to take the longest amount of time once it starts, probably about an hour. These commands will pre-generate your world, which means the server won't have to do all this work later while you and your friends are exploring.

cd ~/Paper/plugins

wget --content-disposition -E https://dev.bukkit.org/projects/worldborder/files/latest

sudo apt-get install screen

cd Paper

./start.sh

It won't look like it anything happened, but your server has now started! In order to interact with the server we need to use this command

screen -r minecraft

And then we will pre-generate the world:

wb world set 1000 spawn

wb world fill 1000

wb fill confirm

This is the part that will take a long time. Go grab a snack and check back later! When the process is done, shutdown the server with a very simple command

stop

This will save and close the server and return you to the Raspberry Pi terminal.

Our final task is setting the server to start automatically when the Raspberry Pi is plugged in or restarted. We can do this by creating a simple script.

cd ~

nano startup.sh

We've used nano to edit a couple files before, but this time we are creating one from scratch, so the window will be empty. Copy these two lines into the file:

cd /home/pi/Paper screen -dmS minecraft java -server -Dfile.encoding=UTF-8 -Xms512M -Xmx800M -XX:NewSize=300M -XX:MaxNewSize=500M -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=4 -XX:+AggressiveOpts -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:SurvivorRatio=16 -XX:TargetSurvivorRatio=90 -jar /home/pi/Paper/paperclip.jar nogui

Then save your new script by hitting ctrl-x, then Y, then enter.

chmod +x startup.sh

chmod +x /etc/rc.local

sudo nano /etc/rc.local

The very last line of the rc.local file says "exit 0". Directly above that line we are going to add this:

su pi -c /home/pi/startup.sh

And once more we save the file changes with ctrl-x, then Y, then enter.

sudo reboot

You'll get a message that the connection has closed, and you can close the Putty window.

That's it! You've made it through the boring bit! Now we're ready to test our server!