Minecraft and Minecraft Pocket Edition Servers on Ubuntu Linux

I was asked to set up some Home LAN Minecraft and Pocketmine Servers for my children, so they can play at home and online with their friends in a safe/private environment – I was also interested in the geekier side of setting these servers up and seeing what all the Minecraft fuss is about 🙂

This post covers:

  • setting up a “normal” Minecraft Server on Linux
  • setting up a Minecraft Pocket Edition Server on Linux
  • getting started with the Linux “screen” command to manage multiple Minecraft Server processes

Setting up a normal Minecraft server on Linux (and I’d imagine any other OS) is very easy – you just need Java and the minecraft server jar file which you can get here:

https://minecraft.net/download

And as that page says, just sort out Java then kick off the process like this:

 java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

Making sure you change the minecraft_server.jar  to match the name of the file you downloaded (e.g. minecraft_server.1.7.4.jar or whatever).

I originally put that command in a script and started it with nohup, but realised that you then lose the ability to interact with the process, so I have changed my approach and use the screen command which is much better – see the notes below on how that can be done, it’s easy and very useful.

Also, I think it’s safer to stop your Minecraft server/world cleanly by doing “stop” in the console, rather than Ctrl-c or killing the PID – after doing this I stopped getting these error messages in the console output:

 [ERROR] A level 8 error happened: "Uninitialized string offset: 8192" in...

 

Setting up a Minecraft Pocket Edition server… this was initially quite a contrast to the above, but it got better…

I started off by following the Pocketmine Server setup and installation instructions I found which said to simply download the install script (PocketMine-MP_Installer_XXXXX.sh) and run it:

https://github.com/PocketMine/PocketMine-MP/wiki/Setting-up-a-Server#wiki-linux

but this really didn’t work for me and led to a catalogue of vague errors and a whole load of googling which took me back to the olden times of fighting with make, configure, libraries, conflicts, missing tools and config files and installing all sorts of things based on vague hints from obscure error messages found in cryptic log files… you get the general idea I guess.

It has a simple and happy ending (below), but my experience started off something like this…

don@ubuntuserver:~/pe_minecraft$ ./start.sh
 09:43:39 [ERROR] Unable to find the pthreads extension.
 09:43:39 [ERROR] Unable to find the cURL extension.
 09:43:39 [ERROR] Unable to find the SQLite3 extension.
 09:43:39 [ERROR] Please use the installer provided on the homepage.

And that was after running the installer provided on the homepage and checking the dependencies were all there… so I debugged the steps in that script and was then on to the log files… where one thing led to another for quite a while… some of the more memorable ones are…

 “Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).”
“configure: error: C compiler cannot create executables”

tried “apt-get install build-essential” to fix that, got a bit further

/usr/include/stdc-predef.h:30:26: fatal error: bits/predefs.h: No such file or directory

tried “apt-get install libc6-dev-i386” to fix that, got a bit further

There were several other issues and no end in sight, and I realised it really shouldn’t be this frustrating, so I looked for another approach.

The Minecraft MP Server code is all hosted on github here:

https://github.com/shoghicp/PocketMine-MP?1358555786480

So I simply downloaded everything from there (you could do “git clone” or “svn export”, but I went for wget’ing the latest zip file):

 wget https://github.com/PocketMine/PocketMine-MP/archive/master.zip

extracted that then ran compile :

./src/build/compile.sh

waited a while then ran start:

./start.sh

and this time there were no problems, my Minecraft Pocket Edition MP server was up and running on the home LAN and local devices were able to connect no problem.

 

The Linux “screen” command is very useful tool for Minecraft Server Admins – please see this post for details on getting started with it:

Minecraft Server Admin tips – using the Linux screen command

it allows you to manage multiple Minecraft Server Processes and consoles easily, without having to keep multiple sessions open.

Cheers,

Don

14 thoughts on “Minecraft and Minecraft Pocket Edition Servers on Ubuntu Linux”

  1. I’m wondering is it possible to connect to a Minecraft Server using Minecraft Pocket Edition (on an Android device for example)?

    I tried but it apparently kept looking for the server, I didn’t get any useful error neither on the Android game nor the Minecraft Server…

    Using the PocketMine Server worked, but it has some disadvantages (graphic glitches, some items don’t work,…)

    1. Hi Alex,

      I looked in to this too – it doesn’t look like it’s possible as, despite looking very similar, the two games are fundamentally different.

      There are many features in the PC version that aren’t in the PE one, making it unlikely they will ever be able to play side-by-side.

      It should be possible to all play together on a PE Server if your PC clients ran something like Bluestacks (like an Android emulator), but then you’d all be playing without the advantages of the PC version – sorry! If you find any other options please let me know.

      Cheers,

      Don

  2. Hi Don,

    I just followed your instructions above (simple version, i.e. I got master.zip from github and unzipped it), but there is no directory

    ./src/build

    and no

    compile.sh

    in the unzipped archive. Can you give me another hint, please?

    I’m using Ubuntu 14.04 LTS.

    Regards,
    Thomas

    1. Hi Thomas,

      Just had a look at this, and there have been some decent changes since the last version (and when I wrote the above).

      I managed to download and install a new PE Server using this command:

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

      That script automatically fetched and installed everything that was required, and the server started up via the ./start.sh script as before.

      Here is my console output (Ubuntu 14.04 too) in case it helps you…

      don@ubuntuserver:~/newdir$ wget -q -O - http://get.pocketmine.net/ | bash
      [*] 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 GMT 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 02 Jan 2015 01:18:02 GMT using RSA key ID A7837F89
      gpg: requesting key A7837F89 from hkp server pgp.mit.edu
      gpg: key 2280B75B marked as ultimately trusted
      gpg: key 33DABBE5: public key "Shoghi Cervantes " imported
      gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
      gpg: depth: 0 valid: 1 signed: 1 trust: 0-, 0q, 0n, 0m, 0f, 1u
      gpg: depth: 1 valid: 1 signed: 0 trust: 1-, 0q, 0n, 0m, 0f, 0u
      gpg: Total number processed: 1
      gpg: imported: 1 (RSA: 1)
      gpg: Good signature from "Shoghi Cervantes
      "
      gpg: aka "keybase.io/shoghicp
      "
      [+] 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... regenerating php.ini... done
      [*] Everything done! Run ./start.sh to start PocketMine-MP
      don@ubuntuserver:~/newdir$

      then…


      don@ubuntuserver:~/newdir$ ./start.sh
      [*] 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:23:13 [WARNING] Non-packaged PocketMine-MP installation detected, do not use on production.
      16:23:13 [INFO] Starting Minecraft: PE server version v0.10.4 alpha
      16:23:13 [INFO] Loading pocketmine.yml...
      16:23:13 [INFO] Loading server properties...
      16:23:13 [INFO] Starting Minecraft PE server on 0.0.0.0:19132
      16:23:13 [INFO] This server is running PocketMine-MP version 1.4-916 "絶好(Zekkou)ケーキ(Cake)" (API 1.10.0)
      16:23:13 [INFO] PocketMine-MP is distributed under the LGPL License
      16:23:14 [INFO] ----- PocketMine-MP Auto Updater -----
      16:23:14 [INFO] It appears you're running a Beta build, when you've specified that you prefer to run Stable builds.
      16:23:14 [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:23:14 [INFO] ----- -------------------------- -----
      16:23:14 [NOTICE] Level "world" not found
      16:23:14 [INFO] Preparing level "world"
      16:23:14 [NOTICE] Spawn terrain for level "world" is being generated in the background
      16:23:14 [INFO] Starting GS4 status listener
      16:23:14 [INFO] Setting query port to 19132
      16:23:14 [INFO] Query running on 0.0.0.0:19132
      16:23:14 [INFO] Default game type: SURVIVAL
      16:23:14 [INFO] Done (10.68s)! For help, type "help" or "?"

      If that doesn’t work for you then check you have installed the listed dependecies:
      perl gcc g++ make automake libtool autoconf m4.

      And as mentioned on http://www.pocketmine.net/, if you want to compile from x86_64, you might have to install gcc-multilib too.

      Hope that helps?

      Don

  3. Hello Thomas and Don.
    Thanks for the efforts of you both.
    On my Ubuntu installation the instruction of Don worked perfect:
    wget -q -O - http://get.pocketmine.net/ | bash.
    Saved me probably a lot of time and frustration.
    Jelle.

  4. Informative, clear and detailed article about Minecraft Pocket Edition server. Thanks for both support from Don and Thomas. I followed and did it successfully. Keep working, my buddies!

  5. I just have a few questions.

    Where would be a safe place to run this server? is /srv/pocketMine a good choice?
    Is running the server as a user with sudo privs safe?

  6. ./start.sh
    Couldn’t find a working PHP 7 binary, please use the installer.

    I got this error message when trying to run it after downloading with

    wget -q -O – http://get.pocketmine.net/ | bash

    I do notice that I got a different version:

    [*] Found PocketMine-MP Final_1.4.1 (build 9180 using API 1.11.0

  7. Yep, I’m getting the same PHP 7 binary missing error, and no easy way to install PHP 7.0, other than someone’s PPA, for which the installation fails.

  8. How do you configure ubuntu/pocketmine so that the pocketmine server query info comes up in the client app in the server list area? If i just put my server IP it shows all the query info and motd etc but if i use my domain name it just says “locating server” without populating any info. Connecting is no problem and I believe everything is configured properly in my DNS as I have the A records and the domain resolves. Thanks!

Leave a Reply