LOGO

Run Minecraft on Raspberry Pi: Low-Cost Block Building

October 21, 2013
Run Minecraft on Raspberry Pi: Low-Cost Block Building

Transforming a Raspberry Pi into a Minecraft Server

Previously, we detailed the process of establishing a personal Minecraft server utilizing a Windows or OSX computer. However, if you're seeking a solution that is less resource-intensive, more power-efficient, and consistently accessible for your gaming companions, consider an alternative.

Leveraging the Raspberry Pi for Minecraft Hosting

This guide will demonstrate how to convert a compact Raspberry Pi device into a budget-friendly Minecraft server. This allows for continuous operation, consuming approximately one cent of electricity daily.

The Raspberry Pi offers a compelling alternative to traditional server setups. Its small form factor and low power consumption make it ideal for always-on hosting.

Benefits of a Raspberry Pi Minecraft Server

  • Cost-Effective: Significantly lower operational costs compared to a desktop server.
  • Energy Efficient: Minimal power draw, reducing your electricity bill.
  • Always On: Capable of running 24/7 without substantial energy concerns.
  • Compact Size: Takes up very little physical space.

These advantages make the Raspberry Pi an excellent choice for individuals wanting a dedicated Minecraft server without the associated expenses and energy usage of a full-sized computer.

Setting up a server on this platform provides a consistently available gaming environment for you and your friends.

The Benefits of Hosting Your Own Minecraft Server

This guide details the process of establishing and maintaining a Minecraft server, with a specific focus on utilizing a Raspberry Pi. A primary motivation for creating a personal Minecraft server is the enhanced control and customization it provides.

You gain the ability to persistently host a world, allowing friends and family to participate even when you are offline, fostering continuous collaborative building. Furthermore, it unlocks opportunities for modifying game parameters and integrating mods, features unavailable in the standard Minecraft experience.

Expanding the Minecraft Experience

Compared to public servers, self-hosting offers a greater degree of control over the multiplayer environment. This is achieved without the ongoing expenses associated with renting a dedicated server from a remote hosting provider.

The appeal is further amplified when the server is deployed on a Raspberry Pi. This compact device boasts remarkably low resource consumption.

Raspberry Pi: A Cost-Effective Solution

Consequently, a Minecraft server hosted on a Raspberry Pi can operate continuously, 24/7, for a minimal annual cost – often less than a few dollars. The primary investment involves the initial purchase of the Raspberry Pi itself, a suitable SD card, and the time required for initial configuration.

After these initial expenses, the ongoing monthly cost is incredibly low, comparable to the price of a single gumball. This makes it an exceptionally affordable solution for dedicated Minecraft enthusiasts.

Essential Requirements

This guide details the necessary components for successful completion. Beyond the Raspberry Pi itself and a compatible SD card, all required resources are available at no cost.

  • One Raspberry Pi (a model with 512MB of RAM is recommended)
  • An SD card with a capacity of 4GB or greater

It is presumed that you possess a foundational understanding of the Raspberry Pi and have already installed Raspbian, a Debian-based operating system, onto the device.

Should you require assistance with the initial setup, our comprehensive guide, “The HTG Guide to Getting Started with Raspberry Pi,” provides detailed instructions to bring your Pi online.

Optimizing Raspbian for a Minecraft Server

Unlike other projects where a Raspberry Pi can handle multiple tasks simultaneously – such as functioning as a weather station and a print server – running a Minecraft server demands significant resources. It is highly recommended to dedicate the entire Pi to this specific operation.

Despite its simplistic appearance, Minecraft is a computationally intensive game. A substantial amount of processing power is required to deliver a smooth gaming experience. Therefore, we will modify the configuration file and various settings to optimize the Raspbian operating system for this purpose.

Initial Configuration Adjustments

The initial step involves accessing the Raspi-Config application to implement several minor adjustments. If you are performing a fresh installation of Raspbian, wait until the final step, which includes Raspi-Config. If Raspbian is already installed, open a terminal and type "sudo raspi-config" to launch it.

One of the first priorities is to increase the overclock setting. Maximizing the Pi’s performance is crucial for an enjoyable Minecraft experience. Within Raspi-Config, choose option number 7, "Overclock".

how-to-run-low-cost-minecraft-on-a-raspberry-pi-for-block-building-on-the-cheap-2.jpg

Expect to see warnings regarding overclocking, but be assured that the Raspberry Pi Foundation officially supports it, having included it in the configuration options since 2012. Select "Turbo 1000MHz" on the selection screen.

You will receive a further warning about potential risks, specifically SD card corruption, though actual hardware damage is not anticipated. Confirm your selection by clicking OK and allow the device to reboot.

Boot and Memory Settings

Next, configure the system to boot to the command prompt instead of the desktop environment. Select option number 3, "Enable Boot to Desktop/Scratch", and ensure that "Console Text console" is chosen.

Returning to the Raspi-Config main menu, select number 8, "Advanced Options". Two critical changes, and one optional change, need to be made here. Let's address the critical changes first. Select A3, "Memory Split".

Reduce the memory allocated to the GPU to 16MB, down from the default 64MB. Since the Minecraft server will operate in a GUI-less environment, allocating more than the minimum to the GPU is unnecessary.

After adjusting the GPU memory, return to the main menu. Select "Advanced Options" again, then select A4, "SSH". Enable SSH within the sub-menu. Maintaining a direct connection to a monitor and keyboard is often impractical, and SSH allows remote access from anywhere on the network.

Optional Hostname Change

Finally, and optionally, return to the "Advanced Options" menu and select A2, "Hostname". Here, you can change the hostname from the default "raspberrypi" to a more appropriate Minecraft-themed name.

A hostname like "minecraft" is a simple option, but feel free to be creative with names such as "creepertown", "minecraft4life", or "miner-box".

Finalizing the Configuration

These adjustments to the Raspbian configuration are now complete. Select "Finish" at the bottom of the main screen to initiate a reboot. Following the reboot, you can access the terminal via SSH, or continue working directly from the Pi’s keyboard. Using SSH is strongly recommended, as it facilitates easy copying and pasting of commands. If you are unfamiliar with SSH, instructions on using PuTTY with your Pi can be found here.

Java Installation on the Raspberry Pi

As the Minecraft server relies on Java, the initial step in preparing your Raspberry Pi involves installing this crucial software. Begin by accessing your Pi through an SSH connection.

Creating the Installation Directory

Once logged in, utilize the command prompt to establish a directory specifically for the Java installation. Execute the following command:

sudo mkdir /java/

Downloading the Java Package

The next stage involves downloading the latest Java version. As of the time of this writing, the October 2013 update represents the newest release. However, it’s essential to verify the availability of a more recent Linux ARMv6/7 Java release on the official Java download page and adjust the link accordingly.

Enter this command into the prompt:

sudo wget --no-check-certificate http://www.java.net/download/jdk8/archive/b111/binaries/jdk-8-ea-b111-linux-arm-vfp-hflt-09_oct_2013.tar.gz

Extracting the Java Files

Upon successful completion of the download, proceed with the extraction process using the following command:

sudo tar zxvf jdk-8-ea-b111-linux-arm-vfp-hflt-09_oct_2013.tar.gz -C /opt/

Historically, the /opt/ directory was designated for optional software installations in early Unix systems, functioning similarly to the /Program Files/ directory in Windows.

Verifying the Installation

After the extraction is finished, confirm the installation by executing this command:

sudo /opt/jdk1.8.0/bin/java -version

This should display the version information of your newly installed Java environment, similar to this:

java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b111)
Java HotSpot(TM) Client VM (build 25.0-b53, mixed mode)

If the expected output isn't shown, attempt to re-extract the archive. If successful, clean up the downloaded file with this command:

sudo rm jdk-8-ea-b111-linux-arm-vfp-hflt-09_oct_2013.tar.gz

Ready for Minecraft

With Java now successfully installed, you are prepared to proceed with the installation of your Minecraft server.

Installing and Configuring the Minecraft Server

Having established a base for our Minecraft server, the next step involves installing the essential components. We will utilize SpigotMC, a streamlined and dependable Minecraft server build ideally suited for operation on the Raspberry Pi.

To begin, obtain the server code using this command:

sudo wget http://ci.md-5.net/job/Spigot/lastSuccessfulBuild/artifact/Spigot-Server/target/spigot.jar

This URL is designed for long-term stability, directing to the latest stable Spigot release. However, should you encounter any difficulties, the official SpigotMC download page can be found here.

Once the download is complete, execute the following command:

sudo /opt/jdk1.8.0/bin/java -Xms256M -Xmx496M -jar /home/pi/spigot.jar nogui

If you are operating on a Raspberry Pi with 256MB of RAM, adjust the command to use 128M and 256M respectively.

The server will initiate, displaying a series of on-screen messages. Allow approximately 3 to 6 minutes for the server setup and world generation to finalize. Subsequent startups will be considerably faster, typically taking 20-30 seconds.

Should unexpected issues arise during configuration or gameplay – such as the server unexpectedly spawning you in the Nether or causing immediate death – use the "stop" command in the terminal to gracefully shut down the server for troubleshooting.

Upon completion, launch Minecraft on your usual computer and select Multiplayer. Your server should appear in the list:

how-to-run-low-cost-minecraft-on-a-raspberry-pi-for-block-building-on-the-cheap-4.jpg

If the world isn't immediately detected, use the "Add" button to manually input your Pi's address.

Connecting to the server will update the status in the server list:

how-to-run-low-cost-minecraft-on-a-raspberry-pi-for-block-building-on-the-cheap-5.jpg

The server confirms we are in-game, and the Minecraft application also indicates in-game status, though it's currently nighttime in survival mode:

how-to-run-low-cost-minecraft-on-a-raspberry-pi-for-block-building-on-the-cheap-6.jpg

Starting in the darkness, unarmed and without shelter isn't ideal. However, further configuration is necessary, and instability may occur without adjustments. This initial connection serves only to verify the server is operational and accepting connections.

After confirming server functionality, shut it down using the "stop" command in the server console.

Then, enter this command:

sudo nano server.properties

Within the configuration file, implement the following changes (or utilize our provided configuration, excluding the initial name and date lines):

#Minecraft server properties#Thu Oct 17 22:53:51 UTC 2013generator-settings=#Default is true, toggle to falseallow-nether=falselevel-name=worldenable-query=falseallow-flight=falseserver-port=25565level-type=DEFAULTenable-rcon=falseforce-gamemode=falselevel-seed=server-ip=max-build-height=256spawn-npcs=truewhite-list=falsespawn-animals=truetexture-pack=snooper-enabled=truehardcore=falseonline-mode=truepvp=truedifficulty=1player-idle-timeout=0gamemode=0#Default 20; you only need to lower this if you're running#a public server and worried about loads.max-players=20spawn-monsters=true#Default is 10, 3-5 ideal for Piview-distance=5generate-structures=truespawn-protection=16motd=A Minecraft Server

To grant yourself operator status on the server (allowing for more powerful in-game commands), use the following command in the server status window:

op [your minecraft nickname]

With these adjustments, the server is becoming more usable. Now, let's proceed with plugin installation.

The first, and most crucial, plugin is NoSpawnChunks. Visit the NoSpawnChunks webpage to obtain the download link for the latest version (currently v0.3 as of this writing).

Back in the command prompt (on your Pi, not the server console – shut down the server if it's running), enter these commands:

cd /home/pi/plugins
sudo wget http://dev.bukkit.org/media/files/586/974/NoSpawnChunks.jar

Next, visit the ClearLag plugin page and download the newest version (v2.6.0 at the time of this tutorial). Enter the following command:

sudo wget http://dev.bukkit.org/media/files/743/213/Clearlag.jar

Since the files aren't compressed, the plugins are directly placed in the plugin directory. Remember this for future installations – the file must be named [pluginname].jar, so uncompress if necessary.

Restart the server:

sudo /opt/jdk1.8.0/bin/java -Xms256M -Xmx496M -jar /home/pi/spigot.jar nogui

Expect a slightly longer startup time (closer to 3-6 minutes) as the plugins modify the world map. After the process completes, type the following in the server console:

plugins

This displays a list of currently active plugins. You should see something similar to this:

how-to-run-low-cost-minecraft-on-a-raspberry-pi-for-block-building-on-the-cheap-7.jpg

If the plugins aren't loaded, a restart may be required.

Confirming plugin loading, rejoin the game. You should experience significantly improved performance, along with messages from the plugins indicating their activity:

how-to-run-low-cost-minecraft-on-a-raspberry-pi-for-block-building-on-the-cheap-8.jpg

With Java installed, the server configured, and settings optimized for the Pi, you are now ready to build and play with friends!

It's worth noting that another online resource provided some of the initial steps for Java and Spigot installation, and it's possible that article was consulted during the creation of this guide. You can find that resource here.

#Minecraft#Raspberry Pi#low-cost gaming#block building#Minecraft server#Raspberry Pi Minecraft