Installing PocketMine MineCraft PE Server on CentOS 7



  • PocketMine is a PHP-based server for the MineCraft Pocket Edition and MineCraft Windows 10 Edition clients. In this "how to" we are going to get PocketCraft set up to run as a service on CentOS 7.

    I started this project with a minimal CentOS 7 template on a Scale HC3 cluster. In addition to the basic install, only firewalld and sysstat were added to the basic image. The image was fully updated as of the time of this writing.

    0_1453051064903_pm1.png

    For security reasons, PocketMine does not run as root and I think it would be best for it to run as its own, limited user rather than one used for any other purposes. Assuming that we stick with the default port of UDP 19132, we need to configure out CentOS firewall (firewalld and iptables) to accept traffic on this port. We start our configuration as the root user and will switch to our newly created pocket user once we have completed our root tasks.

    useradd pocket
    mkdir /opt/pocketmine
    chown pocket:pocket /opt/pocketmine/
    firewall-cmd --zone=public --add-port=19132/udp --permanent
    firewall-cmd --zone=public --add-port=19132/tcp --permanent
    firewall-cmd --reload
    sudo -i su pocket
    

    Now we have a user named “pocket” and we are acting as that user. This is much safer than using root or a standard user account.

    cd /opt/pocketmine
    curl -sL https://raw.githubusercontent.com/PocketMine/php-build-scripts/master/installer.sh | bash -s - -v development
    ./start.sh
    

    By default the system starts with 256MB of RAM assigned to the PocketMine process. As this is a beefy server I decided to go ahead and give it 512MB as a starting point and monitor from there. The start script walks you through all of your setup parameters.

    Now that we have a working server, we need to configure it to properly start on boot so that when the system reboots, the process will restart on its own without intervention. While still as the pocket user, edit the crontab with this command:

    crontab -e
    

    And enter this line:

    @reboot	/opt/pocketmine/start.sh
    

    And now you can reboot your server to test! If all is working correctly, PocketMine will be up and running and accepting requests once the server has restarts. Remember that if you are behind an external firewall that you will need to port forward UDP 19132 to the IP Address of your new PocketMine server so that clients can connect from over the Internet. If you only want to accept client connections from your local LAN you can skip this step.

    Don't forget that if you want to publish this server to the Internet without needing to hand out a raw IP Address that you will want to make a DNS entry for it as well so that your users can connect conveniently.

    PocketMine is a PHP application but is not part of a web server. So it uses the familiar PHP language platform but in a way that is foreign to most system admins, it is used as a traditional scripting language and is creating its own network services here.

    You will notice in the docs that we use the --development flag for our server. This is obviously a questionable practice. Unfortunately because of changes to the protocol used on the clients that are out of our control the --stable branch does not connect, so at this time, development is necessary.



  • The new PocketMine server is up and running and we have been testing it with users in the US and here in Greece with Amazon Fire Tablets and the Amazon Fire TV running MineCraft Pocket Edition (PE) and from a laptop with Windows 10 running MineCraft Windows 10 Edition. All of them connect and run great.



  • @scottalanmiller

    MC on WIndows - oooo... My son has been begging for it. I suppose I could.. but I am not sure. Already spend so much time on it now.
    But - this would let me play in the same world all the time.... but he has like 40 worlds on his iPad now.



  • @gjacobse said:

    @scottalanmiller

    MC on WIndows - oooo... My son has been begging for it. I suppose I could.. but I am not sure. Already spend so much time on it now.
    But - this would let me play in the same world all the time.... but he has like 40 worlds on his iPad now.

    There are two versions for Windows, so be careful. There is full Minecraft and then there is Minecraft Windows 10 Edition. Full Minecraft is the big one that runs on Java and connects to Minecraft servers, not to PocketMine servers. It is a big, heavy game with a lot going on. Windows 10 Edition is a JavaScript Metro app that works exactly like Minecraft Pocket Edition (but does not share a code base) and can only connect to PocketMine.

    Full Minecraft is $25 and currently you get Windows 10 Edition Beta for free if you own the full version.

    Minecraft Windows 10 Edition Beta is $10 on its own.



  • If NTG is running MC... would they run a fancy server with a bunch of cool mods?



  • What does it do?

    And this is PocketMine, not Minecraft, totally unrelated modding community.



  • @scottalanmiller It does a ton of things (there are many different servers to chose from) from adding quests, to new world, to armor to entire magic sets etc.

    There is a lot more then just digging in the dirt.



  • @DustinB3403 said:

    @scottalanmiller It does a ton of things (there are many different servers to chose from) from adding quests, to new world, to armor to entire magic sets etc.

    There is a lot more then just digging in the dirt.

    Does FTB have a Minecraft Pocket branch? I didn't think they did.



  • @coliver said:

    @DustinB3403 said:

    @scottalanmiller It does a ton of things (there are many different servers to chose from) from adding quests, to new world, to armor to entire magic sets etc.

    There is a lot more then just digging in the dirt.

    Does FTB have a Minecraft Pocket branch? I didn't think they did.

    I doubt it, with the amount of resources that their clients take to run....



  • PocketMine uses hardly any resources, and that's with PHP 5.6. Once we move to PHP 7 this thing will be screaming. They almost have that ready now.



  • I need to find some plugins that make it more interesting. Anyone know PocketMine plugins that would make sense for smaller kids to use?



  • I haven't ever played the pocket edition. I'd be surprised of what plugins you'd be able to add.





  • Got the first plugins working. Super simple. Just download the .phar files from the repo and drop them in the /opt/pocketmine/plugins folder and reboot. Easy peasy.

    iFriend is the first one that I am really testing. Need the kids to be able to find one another.



  • Awesome. Got it running.
    Is there a way to take already running game from iPad and move it over to this server?



  • That's a good question and I'm going to say that I am pretty sure that you cannot. But I'm going to ping @JaredBusch because he could easily know something here that I don't.



  • @scottalanmiller said:

    That's a good question and I'm going to say that I am pretty sure that you cannot. But I'm going to ping @JaredBusch because he could easily know something here that I don't.

    In theory you are supposed to be able to, but i never got it working.
    I honestly only spent one evening trying on and off to figure it out though.



  • Sounds like a good project for @Slava



  • @scottalanmiller said:

    Sounds like a good project for @Slava

    I will need to extract the files form a backup of my daughter's iPhone again and try it out sometime after i update my server



  • I have been trying to get mine to work. I am running it on a VPS from vultr and cant get my sons kindle to connect or my windows 10 minecraft. My android tablet will work. If someone wants to try the IP is 104.207.142.12



  • Now that is super weird, those devices should all be completely identical.



  • @thegillion I am logged in from an Amazon Fire tablet.



  • No one is here, this is very lonely. What mods do you have loaded?



  • @scottalanmiller Yeah I see you on there. I am using the same build you are.



  • @scottalanmiller no mods just trying to make it work.



  • Very odd that some things are not connecting. Mine has worked with five Fire tablets, a Fire TV, two Windows 10 clients, etc. Not a single issue yet.



  • All of the devices that you are testing are on the same network?



  • Yes and if you build a game on a device they can all join.



  • Any of them using things like Hola or Unotelly for network redirection?



  • @scottalanmiller

    I think I need to dump their old world and start a new one..

    No telling how much stuff is in there.

    img