Setting up the server software is often considered the most time-consuming step when creating your own Dedicated Minecraft Server. However, it’s also the most crucial. While it may involve using several Linux commands that might seem daunting at first, rest assured that if you can copy and paste, you can successfully navigate this part of the process.
Running a Minecraft server, especially on a compact computer like a Raspberry Pi, requires optimization. This guide is inspired by the excellent tutorial created by James Chambers, which offers valuable insights into maximizing server performance on a Raspberry Pi. While this article summarizes the installation process and incorporates some updates, it’s highly recommended to review James Chambers’ original guide for a deeper understanding.
Once you’ve logged into your Raspberry Pi using the default username “pi” and your chosen password, you’re ready to begin installing the necessary server files.
Important Tip: Many of the commands in the following steps are lengthy and complex. Manually typing them can be prone to errors and inefficient. Instead, simply highlight the command text in this guide, copy it using Ctrl+C
(or Cmd+C
on macOS), and then right-click within your terminal window to paste the command. This copy-paste method will make the process much smoother and error-free.
For the subsequent steps, you will be copying and pasting each command from the code blocks provided. Brief explanations will be given along the way to clarify what each command accomplishes.
Let’s begin by ensuring your Raspberry Pi’s software is completely up to date. This is a best practice to avoid potential compatibility issues and ensure you have the latest security patches.
sudo apt-get update && sudo apt-get upgrade
Whenever you are prompted for installation approval during these steps, simply type “y” and press Enter to confirm and proceed.
Minecraft operates on Java, which isn’t included in the “Lite” version of Raspberry Pi OS. Therefore, we need to download and install Java to proceed with setting up our dedicated Minecraft server.
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
Important Note: Java versions are updated periodically. The command above might become outdated if a newer version of Java is released. If you encounter an error message during this step, you’ll need to update the download link to reflect the latest version. To do this, visit Oracle’s Java downloads page, click the “Accept License Agreement” button, then right-click on the link for the most recent “linux-arm32” file and select “copy link address”. Replace the existing link in the command above (starting with http
) with this new, updated link.
Now that we have downloaded the Java archive, we can proceed with the installation. First, we’ll create a directory to house the Java installation.
sudo mkdir /usr/java
cd /usr/java
If you had to update the download link for a newer Java version in the previous step, ensure that you modify the version number in the commands below to match the version you downloaded.
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 ~
Finally, we’re at the main event – installing the dedicated Minecraft server software! We’ll be using a specialized server version called Paper. Paper is known for its optimizations that significantly enhance server performance, making it an excellent choice for running a smooth Minecraft server on Raspberry Pi.
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
This last command initiates the server for the first time. After a brief period, you’ll likely encounter an error message indicating that you need to agree to the Minecraft End User License Agreement (EULA). To do this, open the eula.txt
file using the following command:
nano eula.txt
Within the eula.txt
file, locate the line that reads eula=false
and change it to eula=true
. Save your modifications by pressing Ctrl+X
, then Y
, and finally Enter
.
Optional Optimization: James Chambers’ guide mentions a technique for overclocking your SD card to further improve performance. While this can potentially boost your server’s responsiveness, it’s important to note that it requires a high-quality SD card. Overclocking might provide additional performance gains, but even without it, the server should run smoothly enough for a small group of players.
Now, let’s quickly review the server.properties
file and make a couple of essential adjustments to configure your dedicated Minecraft server.
nano server.properties
The server.properties
file contains a comprehensive list of settings that allow you to customize various aspects of your Minecraft server. You can personalize your server name and MOTD (message of the day), adjust the game mode, enable or disable PvP (player versus player combat), and activate command blocks, among many other options. You can modify these settings now or revisit this file later to make further adjustments. However, there are two specific settings that we recommend changing immediately for optimal performance and security.
max-players=8
server-port=26565
max-players=8
: For a Raspberry Pi-based server, it’s advisable to limit the maximum number of players. Eight players is a recommended upper limit. Exceeding this number could lead to noticeable server lag, even with the performance optimizations provided by Paper.
server-port=26565
: The default Minecraft server port, 25565, is widely known. Changing the server port to a less common number, such as 26565, adds a minor layer of security to your server. Make sure to note down this new port number alongside your Raspberry Pi’s IP address, as you’ll need both to connect to your server later.
Once you’ve adjusted these settings and any other customizations you desire, save the changes to server.properties
by pressing Ctrl+X
, then Y
, and Enter
.
The next step, pre-generating your Minecraft world, will take a significant amount of time, potentially around an hour or more depending on the world size you choose. World pre-generation is highly recommended for dedicated Minecraft servers as it reduces server load during gameplay by generating the world terrain and chunks in advance. This results in a smoother player experience, especially during exploration.
cd ~/Paper/plugins
wget --content-disposition -E https://dev.bukkit.org/projects/worldborder/files/latest
sudo apt-get install screen
cd Paper
./start.sh
Initially, it might seem like nothing has happened after running ./start.sh
, but rest assured that your server has started in the background. To interact with the server console and execute commands, we’ll use the screen
utility:
screen -r minecraft
Now we can initiate the world pre-generation process using the WorldBorder plugin:
wb world set 1000 spawn
wb world fill 1000
wb fill confirm
The wb world fill 1000
command, in particular, is the step that will take a considerable amount of time to complete. Feel free to take a break and return later. Once the world pre-generation is finished, you can gracefully shut down the server with the simple command:
stop
This command will save the current world state, properly close the server application, and return you to the Raspberry Pi terminal prompt.
Our final task is to configure the dedicated Minecraft server to start automatically whenever the Raspberry Pi is powered on or restarted. This ensures your server is always available without manual intervention. We can achieve this by creating a simple startup script.
cd ~
nano startup.sh
You might have used nano
to edit files previously, but this time we are creating a new file from scratch. The nano
window will appear blank. Copy and paste the following 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
Save the new script by pressing Ctrl+X
, then Y
, and Enter
.
chmod +x startup.sh
chmod +x /etc/rc.local
sudo nano /etc/rc.local
The /etc/rc.local
file is executed during the Raspberry Pi’s startup process. Locate the very last line in this file, which should be exit 0
. Directly above this line, add the following line:
su pi -c /home/pi/startup.sh
This line instructs the Raspberry Pi to run our startup.sh
script as the pi
user during boot. Once again, save the changes to rc.local
with Ctrl+X
, Y
, and Enter
.
sudo reboot
You will receive a message indicating that the SSH connection has been closed. You can now close the Putty window (or your SSH client).
Congratulations! You have successfully completed the setup of your dedicated Minecraft server on a Raspberry Pi. The more technical part is now behind you! You are now ready to test your new server and invite your friends to join your Minecraft world.
Close-up of a Raspberry Pi board highlighting its compact size, relevant for a guide on setting up a dedicated Minecraft server on a Raspberry Pi.