Minecraft PE Server on a Pi 3 (PocketMine)

As college students, this pool of stress had to be dumped somewhere. And what better place to do that than Minecraft PE. It’s a great choice (for us, anyways). Multiplayer, portable, can be LAN-only, and just chill.

The longer we played, the more obvious this specific problem is. Usually, we would play together when everyone was around. But what if someone was missing? What if the host was not around?

Thus the need for an always-available server. We could, in theory, just leave a sacrificial PC/phone, but then there’s electricity bills. Further, that would just be a waste of a gadget. Oh, and I have an extra Raspberry Pi 3.

Where this came from

Researching on the best software to use, I was really left with only two choices. PocketMine-MP and NukkitX. But then, developer activity and personal experience (the NukkitX generated world was quite bland and outdated) swayed me to PMMP.

The more I researched, the more I realized there was no proper guide for this. It was all bits and pieces of information, with errors on the Pi since the guides were meant for PCs.

The Thing (Installation Guide)

Operating System

First problem: PocketMine-MP needs a 64-bit operating system. Raspbian and almost all others are 32-bit, and they will not work.

Error: PocketMine-MP is not supported on 32-bit systems.

Error message encountered while compiling on 32-bit systems.

There are limited options, but the best I found is pi64 since this was legitimate Debian, not Arch or something.

Download the latest lite version. Simply uncompress pi64-lite.zip file and burn the .img file to a microSD card.

Pi64 First Boot Setup
Pi64 First Boot Setup

Once setup is done and you are logged in (pi:raspberry), update the kernel using pi64-update. You can then update the system using sudo apt-get -y update && sudo apt-get -y upgrade. Reboot if necessary.

PHP 7.2 – Compile and Setup

Why do this manually? PMMP provides a script that automatically installs the PHP it needs. However, this is for x64 PCs and not for an ARM Raspberry Pi 3.

gcc: error: unrecognized command line option ‘-m64’

Yeah, this isn’t x64. We’re ARM64.

We will need to compile PHP 7.2 with Zend Thread Safety (ZTS) and various extensions for PMMP. Later, we’ll compile and install pthreads and yaml

First, install the prerequisites. As of writing, the command below works.

sudo apt-get install wget git autoconf bison build-essential libssl-dev openssl libzip-dev libcurl4-openssl-dev libreadline-dev libyaml-dev libpng-dev libgmp-dev pkg-config

Grab the latest stable PHP source from php.net. At the time of writing, it’s 7.2.9. Extract, cd into the extracted folder, then execute the configure command.

You can then make and sudo make install. This will place the php binaries in /usr/bin on install, which should be totally fine.

./configure --prefix=/usr --with-config-file-path=/etc/php/7.2/cli --with-config-file-scan-dir=/etc/php/7.2/cli/conf.d --disable-all --with-openssl --with-gmp --with-zlib --with-curl --with-pic --enable-phar --enable-ctype --enable-sockets --enable-shared=no --enable-static=yes --enable-shmop --enable-maintainer-zts --enable-pcntl  --enable-mbstring --enable-calendar --with-tsrm-pthreads --enable-bcmath --enable-cli --enable-zip --enable-ftp --with-gd --enable-opcache=yes --enable-hash --enable-json

make
sudo make install

While you’re still in the PHP source directory, it would be a good idea to create the PHP configuration folders. After that, copy the template over.

sudo mkdir /etc/php/
sudo mkdir /etc/php/7.2/
sudo mkdir /etc/php/7.2/cli
sudo mkdir /etc/php/7.2/cli/conf.d

sudo cp php.ini-production /etc/php/7.2/cli/php.ini

PHP done. Next,

Phreads compile and install

Not much could be said about Pthreads in this context aside from it’s required by PMMP.

Clone the Pthreads Git repository, then cd into it. Prepare to compile the extension by running phpize.  After that, ./configure and install.

git clone https://github.com/krakjoe/pthreads.git
cd pthreads
phpize
./configure
make
sudo make install

Once that’s done, edit php.ini and add extension=pthreads.so in there somewhere. I just placed mine near the top before the banner.

pthreads extension in php.ini
pthreads extension in php.ini

YAML Compile and Install

Again, nothing much to say. Go get the latest stable here. At the time of writing, it’s 2.0.2.

Extract the package. cd into the extracted directory. phpize, ./configure , make, then make install.

wget https://pecl.php.net/get/yaml-2.0.2.tgz
tar xvf tar xvf yaml-2.0.2.tgz
cd yaml-2.0.2/
./configure
make
sudo make install

Also add extension=yaml.so into php.ini.

Anywhere within the file is fine.

PocketMine Itself

Once you’ve done everything properly, PocketMine should just launch without issues. With that said,

Create a directory for PocketMine. Get the latest .phar from their Github releases page. Also grab the starter script from their repo (start.sh).

You may need to chmod +x start.sh in case the script is not executable.

When you run it for the first time, a wizard should ask you to make basic configuration stuff like what language to use. Advanced config can be found on server.properties.

mkdir pocketmine
cd pocketmine
wget https://github.com/pmmp/PocketMine-MP/releases/download/3.1.4/PocketMine-MP.phar
wget https://raw.githubusercontent.com/pmmp/PocketMine-MP/master/start.sh
chmod +x start.sh
./start.sh

Have fun!

7 thoughts on “Minecraft PE Server on a Pi 3 (PocketMine)”

  1. Could i add a map i have already played on before or does it have to be one that the software generates. Thanks Wil

    1. Heya,
      I did try that, but it won’t use it for some reason. It would always generate a new one, replacing the one I got from my phone. Maybe I did something wrong.
      For safety reasons, I used the one the software generated. However, it’s admittedly bland (back in 2018, not sure now).

Leave a Reply to pandalion98 Cancel reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.