Deploying PocketMine on MineOS

update: MineOS node has full support for Pocketmine servers and does not require ANY of these steps; you can download php and pocketmine files from the web-ui directly. I advise any users wanting PM servers to use mineos-node instead.

I am able to successfully manage PocketMine through the web-ui. Please keep in mind, PocketMine is built on PHP–not java–using a PHP deployment technique called PHAR. Phar+pthreads support is not compiled/included by default in any mainstream distributions, so these steps require compilation of the PHP binary on your host system.

DISCLAIMER: Following are the steps to get a server running. I make no guarantees about all the functionality being available, as there are huge fundamental differences in the design of this PHP-based Minecraft server. Many things we take for granted do not necessarily translate to the mobile-tablet version so the web-ui will not feel fully integrated with this version.

You must be willing to spend some time in the command-line to do this. This is unavoidable and likely will never change because of the huge differences that exist between Java jar-based and PHP phar-based servers.

As root:

apt-get update
apt-get install build-essential libtool autoconf automake
cd /usr/games/minecraft/
git fetch
git reset --hard origin/phar

Now, as mc:

cd
mkdir pmserver
cd pmserver
wget -q -O - http://get.pocketmine.net/ | bash

It will begin downloading and compiling a version of PHP that supports PHAR filetypes. On my i7-4790 this took like 7 minutes or so; if you have a slower system–or a slower internet connection–this may take much longer. Do not do this on a server that currently has Minecraft servers running.

[*] Found PocketMine-MP Final_1.4 (build 916) using API 1.10.0
[*] This stable build was released on Fri Jan  2 00:36:11 UTC 2015
[+] The build was signed, will check signature
[*] Installing/updating PocketMine-MP on directory ./
[1/3] Cleaning...
[2/3] Downloading PocketMine-MP Final_1.4 phar... done!
[*] Checking signature of PocketMine-MP.phar
gpg: Signature made Fri Jan  2 01:18:02 2015 UTC using RSA key ID A7837F89
gpg: Good signature from "Shoghi Cervantes <shoghicp@gmail.com>"
gpg:                 aka "keybase.io/shoghicp <shoghicp@keybase.io>"
[+] Signature valid and checked!
[3/3] Obtaining PHP: detecting if build is available...
[3/3] Linux 64-bit PHP build available, downloading PHP_5.6.4_x86-64_Linux.tar.gz... checking... invalid build dete          cted, please upgrade your OS
[3/3] no build found, compiling PHP automatically
[PocketMine] PHP compiler for Linux, MacOS and Android
[INFO] Checking dependecies
[INFO] Compiling for current machine using 64-bit
[PHP] downloading 5.6.4... done!
[zlib] downloading 1.2.8... checking... compiling... installing... cleaning... done!
[mcrypt] downloading 2.5.8... checking... compiling... installing... cleaning... done!
[GMP] downloading 6.0.0a... checking... compiling... installing... cleaning... done!
[PolarSSL] downloading 1.3.8... checking... compiling... installing... cleaning... done!
[cURL] downloading curl-7_39_0... checking... compiling... installing... cleaning... done!
[YAML] downloading 0.1.4... checking... compiling... installing... cleaning... done!
[PHP pthreads] downloading 2.0.10... done!
[PHP Weakref] downloading 0.2.6... done!
[PHP YAML] downloading 1.1.1... done!
[PHP] checking... compiling... installing... generating php.ini... done!
[INFO] Cleaning up... done!
[PocketMine] You should start the server now using "./start.sh."
[PocketMine] If it doesn't work, please send the "install.log" file to the Bug Tracker.

Continuing as mc:

./start

The first run will configure Pocketmine. I used defaults by skipping the wizard, which you may likely want to go through just to get familiar with the software.

[*] PocketMine-MP set-up wizard
[*] Please select a language:
 English => en
 Español => es
 中文 => zh
 Pyccĸий => ru
 日本語 => ja
 Deutsch => de
 한국어 => ko
 Nederlands => nl
 Français => fr
 Italiano => it
 Melayu => ms
 Norsk => no
 Svenska => sv
 Suomi => fi
 Türkçe => tr
[?] Language (en):
[*] English has been correctly selected.
Welcome to PocketMine-MP!
Before starting setting up your new server you have to accept the license.
PocketMine-MP is licensed under the LGPL License,
that you can read opening the LICENSE file on this folder.

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

[?] Do you accept the License? (y/N): y
[?] Do you want to skip the set-up wizard? (y/N): y
16:35:52 [WARNING] Non-packaged PocketMine-MP installation detected, do not use on production.
16:35:52 [INFO] Starting Minecraft: PE server version v0.10.4 alpha
16:35:52 [INFO] Loading pocketmine.yml...
16:35:52 [INFO] Loading server properties...
16:35:52 [INFO] Starting Minecraft PE server on 0.0.0.0:19132
16:35:52 [INFO] This server is running PocketMine-MP version 1.4-916 "絶好(Zekkou)ケーキ(Cake)" (API 1.10.0)
16:35:52 [INFO] PocketMine-MP is distributed under the LGPL License
16:35:53 [INFO] ----- PocketMine-MP Auto Updater -----
16:35:53 [INFO] It appears you're running a Beta build, when you've specified that you prefer to run Stable builds.
16:35:53 [INFO] If you would like to be kept informed about new Beta or Development builds, it is recommended that           you change 'preferred-channel' in your pocketmine.yml to 'beta' or 'development'.
16:35:53 [INFO] ----- -------------------------- -----
16:35:53 [NOTICE] Level "world" not found
16:35:53 [INFO] Preparing level "world"
16:35:53 [NOTICE] Spawn terrain for level "world" is being generated in the background
16:35:53 [INFO] Starting GS4 status listener
16:35:53 [INFO] Setting query port to 19132
16:35:53 [INFO] Query running on 0.0.0.0:19132
16:35:53 [INFO] Default game type: SURVIVAL
16:35:53 [INFO] Done (8.662s)! For help, type "help" or "?"
stop
16:36:03 [INFO] CONSOLE: Stopping the server...
16:36:03 [INFO] Unloading level "world"
16:36:03 [INFO] Stopping other threads

Note, I manually typed in ‘stop’ to turn the server off. The server must be started and stopped with the MineOS web-ui in order to be managed by the web-ui.

Switch to root:

mv /home/mc/pmserver /var/games/minecraft/servers/

Now, in the WEBUI:

  1. Go to Manage Profiles. Create a stock profile for “pocketmine14” (this will exist only in the new git branch you switched to in the first steps)
  2. Update the profile and verify the checkmark in the server
  3. Go to the server.config for the new pocketmine server, pmserver and type in “pocketmine14” in the Minecraft profile field
  4. Start the server
  5. Verify the mc logs are reported in the server console and it works.
  6. Open up the new server port in iptables, default 19132.
2 Likes

Note, the server status will not accurately reflect the actual server status. At the very least, the following things will be wrong:

  1. Players online–PocketMine does not seem to support this yet (or may never). This could be a side-effect of Pocketmine using UDP rather than TCP.
  2. Heap Usage–Php does not create uniquely identifiable subprocesses in screen as best as I can figure out. This means that heap usage will always be 0/256. 256 may not even reflect your servers allocated memory, since PocketMine uses its own config in server.properties.
  3. Everything labelled ‘java’ in server.config has no effect whatsoever.

2 Likes

If you use these instructions and successfully or unsuccessfully get PocketMine running, please do report back to me, preferably in this thread. If I can get enough feedback from the community that PocketMine’s inclusion/changes to the code base are not having adverse effects, it can be merged into the master git branch.

Thanks for the detailed explanation and all the time and effort you put into this!

Will do my best to give this a go, the coming week.
My kids would be happy if I can get this up and running :slight_smile:

its really cool!
but without players online very bad, maybe edit several lines of code in distr…
At the same time and update vebmin to 1.730 and this bootstrap theme:http://theme.winfuture.it/

I got the error “install make”
This is a clean install of MineOS Turnkey.
How do I install “make”?

I have logged in as root and downloaded make from http://ftp.gnu.org/gnu/make/, but how do I make it install?

Did you run the first two commands–the ones with apt get and update/install?

I thought I did, and thought all went well.
Is it okay for me to re-do all the instructions? I wasn’t sure if I can repeat steps.
Sorry, novice with Unix.

I repeated this from the beginning and watched more carefully. There is an error at the first step of apt-get update

Failed to fetch http://cdn.debian.net/debian/dists/wheezy/main i386 Packages
404 Not Found [IP: 46.4.205.44 80]
Failed to fetch http://cdn.debian.net/debian/dists/wheezy/contrib i386 Packages
404 Not Found [IP: 46.4.205.44 80]
Failed to fetch http://cdn.debian.net/debian/dists/wheezy/main/binary-i386 Packages
404 Not Found [IP: 46.4.205.44 80]
Failed to fetch http://cdn.debian.net/debian/dists/wheezy/contrib/binary-i386 Packages
404 Not Found [IP: 46.4.205.44 80]

Hexparrot, im concerned with this line.
I have a server (metal) running my minecraft games now.
Are you saying that I shouldnt do this on my currently running server (metal not VM)?
Or are you saying to turn off the running minecraft servers before starting the install of the pocketmine stuff?

1 Like

To elaborate on step 6:

As root:
iptables -A INPUT -p tcp --dport 19132 -j ACCEPT
iptables -A INPUT -p udp --dport 19132 -j ACCEPT

1 Like

I advise not doing his on a production server because the make (compiling php) could potentially use up all the cpu cycles on your machine. If people are playing on your other, non-pocketmine servers, they may experience slowness, lag and other undesirable issues…but otherwise, there’s no danger: just potential game disruption.

Got ya.
I will just shut down the server overnight, as its just family that plays and see if I can take a wack at it over the weekend.

Brian L

Just got this up and running on my MineOS VM. Thanks for the write-up hex!

Mine seems to be bombing out during the php compile, not sure what the error means.

Here’s the console output.

mc@core ~/pmserver$ wget -q -O - http://get.pocketmine.net/ | bash
[*] Found PocketMine-MP Final_1.4.1 (build 980) using API 1.11.0
[*] This stable build was released on Wed Mar 18 03:00:47 AEST 2015
[+] The build was signed, will check signature
[*] Installing/updating PocketMine-MP on directory ./
[1/3] Cleaning...
[2/3] Downloading PocketMine-MP Final_1.4.1 phar... done!
[*] Checking signature of PocketMine-MP.phar
gpg: Signature made Wed Mar 18 03:16:17 2015 AEST using RSA key ID A7837F89
gpg: Good signature from "Shoghi Cervantes <shoghicp@gmail.com>"
gpg:                 aka "keybase.io/shoghicp <shoghicp@keybase.io>"
[+] Signature valid and checked!
[3/3] Obtaining PHP: detecting if build is available...
[3/3] Linux 32-bit PHP build available, downloading PHP_5.6.8_x86_Linux.tar.gz... checking... invalid build detected, please upgrade your OS
[3/3] no build found, compiling PHP automatically
[PocketMine] PHP compiler for Linux, MacOS and Android
[INFO] Checking dependecies
[INFO] Compiling for current machine using 32-bit
[PHP] downloading 5.6.9... done!
[zlib] downloading 1.2.8... checking... compiling...mc@core ~/pmserver$

It’s bombing out on the zlib compile.

Here’s the install.log

mc@core ~/pmserver$ cat install.log
Sat Jun  6 10:32:23 AEST 2015
Linux core 3.2.0-4-686-pae #1 SMP Debian 3.2.68-1+deb7u1 i686 GNU/Linux
make is /usr/bin/make
autoconf is /usr/bin/autoconf
automake is /usr/bin/automake
libtool is /usr/bin/libtool
m4 is /usr/bin/m4
wget is /usr/bin/wget
getconf is /usr/bin/getconf
gzip is /bin/gzip
bzip2 is /bin/bzip2
wget is /usr/bin/wget
gcc is /usr/bin/gcc
Checking for shared library support...
Building shared library libz.so.1.2.8 with gcc.
Checking for off64_t... Yes.
Checking for fseeko... Yes.
Checking for strerror... Yes.
Checking for unistd.h... Yes.
Checking for stdarg.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for attribute(visibility) support... Yes.
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o example.o test/example.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o adler32.o adler32.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o crc32.o crc32.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o deflate.o deflate.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o infback.o infback.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o inffast.o inffast.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o inflate.o inflate.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o inftrees.o inftrees.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o trees.o trees.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o zutil.o zutil.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o compress.o compress.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o uncompr.o uncompr.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o gzclose.o gzclose.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o gzlib.o gzlib.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o gzread.o gzread.c
gcc -O2 -fPIC -march=native -mtune=native -fno-gcse -m32   -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN   -c -o gzwrite.o gzwrite.c
gcc-ar rc libz.a adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
make: *** [libz.a] Error 56

I had no problems logging in as root, getting all the packages installed, and doing the git stuff.

Any ideas peeps?
Thanks.

The pocketmine script shows this. What OS are you using–has it been updated recently?

I’m running Turnkey.

mc@core ~/pmserver$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 7.7 (wheezy)
Release:        7.7
Codename:       wheezy

Alrighty, upgrading to jessie did the trick.

mc@core ~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.1 (jessie)
Release:        8.1
Codename:       jessie

mc@core ~$ uname -a
Linux core 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) i686 GNU/Linux

Here’s the successful pocketmine output.

mc@core ~$ wget -q -O - http://get.pocketmine.net/ | bash
[*] Found PocketMine-MP Final_1.4.1 (build 980) using API 1.11.0
[*] This stable build was released on Wed Mar 18 03:00:47 AEST 2015
[+] The build was signed, will check signature
[*] Installing/updating PocketMine-MP on directory ./
[1/3] Cleaning...
[2/3] Downloading PocketMine-MP Final_1.4.1 phar... done!
[*] Checking signature of PocketMine-MP.phar
gpg: Signature made Wed Mar 18 03:16:17 2015 AEST using RSA key ID A7837F89
gpg: Good signature from "Shoghi Cervantes <shoghicp@gmail.com>"
gpg:                 aka "keybase.io/shoghicp <shoghicp@keybase.io>"
[+] Signature valid and checked!
[3/3] Obtaining PHP: detecting if build is available...
[3/3] Linux 32-bit PHP build available, downloading PHP_5.6.8_x86_Linux.tar.gz... checking... regenerating php.ini... done
[*] Everything done! Run ./start.sh to start PocketMine-MP

I followed the instructions and everything seemed to go well, however I could not start the server from the webui. The console would say that the server had been started and would then immediately shutdown for some reason. I was able to start the server manually by using Putty and entering the command ./start.sh.

I then realised that a new version of Minecraft PE was released in the last week, so my client wouldn’t be able to connect to the server anyway. I downloaded the dev build of the 1.5 PM server, copied into the MineOS “pmserver” folder and renamed it “PocketMine-MP.phar”. I can start the server by entering the command ./start.sh and my client can connect to it too.

I am still not able to start/stop the server from the webui. Any ideas?

(I realise that using a dev build of the server is not ideal, but now that my iPhone has automatically upgraded the client to the latest version, I can’t go back, so I have no choice but to use the dev build of PocketMine).

Just to add to this you’ll need to save the new iptables rules so that the don’t dissapear after reboot, see http://minecraft.codeemo.com/mineoswiki/index.php?title=Iptables

For this part I had I had to type ./start.sh to get it running.

I’m also having problems starting pocketmine through the webui, the webui seems to think the commands been sent but the server never starts. I can start the server manually using ./start.sh and this updates the log in the webui.

As my phone is on MC:PE 0.11.1 unfortunately I can’t connect to 1.4 so will have to update to the development build.

Can’t wait to have a play on this at the weekend, didn’t even know there was a server for MC:PE!