Instructions How to make a MCPE server on VPS

Discussion in 'General discussion' started by Levi, Aug 15, 2017.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Hey guys, today I'll teach you how to setup your own server hosted on VPS (Virtual Private Server)

    We'll be using Ubuntu 16.04 (Linux)

    Tools we'll be using:

    I recommend PuTTY & Filezilla since they are very easy to use.

    First step, open the SSH console and type this command:

    PHP:
    mkdir mcpe // this will make a new folder named "mcpe" and this folder is where your server files is gonna be.
    Step 2, run this command:

    PHP:
    cd mcpe
    Step 3, run these commands:

    PHP:
    apt-get update
    PHP:
    apt-get install gcc g++ make automake libtool autoconf bison
    Step 4, get the latest PocketMine version by running this command:

    PHP:
    wget --https://raw.githubusercontent.com/pmmp/php-build-scripts/master/installer.sh | bash -s - -r
    Step 5, start up the server!

    PHP:
    ./start.sh
    You will have to setup the server by your own now. Don't worry because nothing's gonna be hard from now.

    How to install plugins?!

    This is where we'll need Filezilla. Open it.

    The folder "mcpe" aka where our server files is usually located in /root folder, so search for /root/mcpe. From there you'll ser a folder called "plugins", open it and just drop your plugins inside!

    How to use my own/custom software?

    It's very easy. First of all, stop the server completely and go to filezilla again and find the .phar file called "PocketMine-MP.phar" then delete it. Get your custom software src folder of it and drop it to where the PocketMine-MP.phar was (the one we just deleted). If your Custom software is a .phar file, rename it to PocketMine-MP.phar and drop it to where the old PocketMine-MP.phar was.

    How do I keep my server running 24/7 even if my PuTTY is closed?

    Pretty easy, run this command first:

    PHP:
    apt install screen
    Now run this command:

    PHP:
    screen ./start.sh
    All to go. Now do CTRL + A + D to detach or close the console but server will continue running. If you want to go back to the console, just run:

    PHP:
    screen -r
    Then you're done ( ͡° ͜ʖ ͡°)

    Hope this helps, somehow :p
    Fee free to move this to facefalm cuz i probably posted this on a wrong forum XD
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    this is fundamentally wrong, firstly NEVER EVER RUN PMMP as root, actually NEVER RUN ANYTHING as root
    unless you INTENDED to and UNDERSTAND THE CONSEQUENCES and how DANGEROUS it is, dont try it

    let me tell you why, running ANYTHING as root means you allow it to do literally ANYTHING, included but not limited to removing EVERYTHING in your VPS, which is bad considering you might be downloading 3rd party plugins that is not created by yourself, or tested in a way that can guarantee the safety of the server(glitch/exploit proof)

    what if there's already another screen running? you cannot expect someone to dedicate screen just for one task
    and you also have to take in consideration that someone might not know anything better, like that other X tutorial said to use screen too, and now i can only pick one!


    Personal feedback, personally i feel like it's more of a "instruction" then "tutorial" it just say do X then Y then Z, not like do X because if you dont problem Y or Z may occur, and do A to download PMMP, and do apt-install B C D because we will need these to do E
     
    EdwardHamHam, SOFe and HimbeersaftLP like this.
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
     
  4. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    I tried ;-; sry m8
     
  5. ProjectDefect

    ProjectDefect Creeper

    Messages:
    5
    Eh, I don't trust this method. It probably will work, but as @Thunder33345 said, it is dangerous. Kudos for trying though
     
  6. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    it works 150%, i don't see anything dangerous if you move the server folder to /home
     
  7. EdwardHamHam

    EdwardHamHam Skeleton

    Messages:
    962
    GitHub:
    edwardhamham
    But you're still running it as root. One time, someone (I forget who) created a plugin that claimed to do something, but it actually tried to delete your server and remove "/". If you ran the server with root, and installed that plugin it could succeed at removing / and break your VPS.

    Really, root is just for making modifications. If you want to run a program, use a normal user. Leave root alone, unless you're making system wide modifications.
     
    HimbeersaftLP and Thunder33345 like this.
  8. sharletsings123

    sharletsings123 Baby Zombie

    Messages:
    116
    GitHub:
    sharletk
    As said its better to install as a user than root.
    It is also mentioned in the PMMP Documentation that using root is dangerous and to install PMMP using a user.

    Kind regards,
    /shar
     
    HimbeersaftLP likes this.
  9. EdwardHamHam

    EdwardHamHam Skeleton

    Messages:
    962
    GitHub:
    edwardhamham
    Well technically, root is a user. It just access to everything, software-wise.
     
    sharletsings123 likes this.
  10. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,401
    GitHub:
    HimbeersaftLP
    150%, so you'll get a server and a half?
     
  11. sharletsings123

    sharletsings123 Baby Zombie

    Messages:
    116
    GitHub:
    sharletk
    Lel

    /shar
     
    Levi likes this.
  12. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    why server and a halF?
     
  13. EdwardHamHam

    EdwardHamHam Skeleton

    Messages:
    962
    GitHub:
    edwardhamham
    Because %100 of something is whole, and %50 is half.
     
    HimbeersaftLP likes this.
  14. sharletsings123

    sharletsings123 Baby Zombie

    Messages:
    116
    GitHub:
    sharletk
    Lel.
    You mentioned 150% saying it works 150%, so we made a joke #So you get a server and a half.

    /shar
     
    HimbeersaftLP likes this.
  15. EdwardHamHam

    EdwardHamHam Skeleton

    Messages:
    962
    GitHub:
    edwardhamham
    Math!
     
  16. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Just want to clarify some comments.
    Running a pocketmine server as a non-root user is not "better". It's just much safer. If you are new to Linux or having doubts on this topic, don't run pocketmine as a root user.
    It's not recommended to use root unless you know the consequences you'll be dealing with. The root user has privileges to everything on the system. In other words, it's a very sensitive user.

    You can still run pocketmine as a root user. You'll be facing the dangers only due to your consequences!

    Use this command instead and make the most of it:
    Code:
    wget -q -O - https://raw.githubusercontent.com/pmmp/php-build-scripts/master/installer.sh | bash -s -
    
    Another thing, it's gonna be hard to get back to a specific screen if you have multiple servers running on each screen.
    Give a unique name to your screens
    Code:
    screen -dmS screenname ./start.sh
    
    You can get back to your screen using:
    Code:
    screen -x screenname
    
    And remove the screen using:
    Code:
    screen -X -S screenname quit
    
     
  17. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    Or make a bash script to do that!
    because i am very lazy
    Code:
    #!/bin/bash
    
    TMS="pmmpbot"
    DIR="/home/pmmp/pm/"
    SCRIPTUSER="pmmp"
    CURRENTUSER=$(whoami)
    
    if [ "$CURRENTUSER" !=  "$SCRIPTUSER" ]
        then
        echo "Please Run This Script as User: $SCRIPTUSER NOT User:$CURRENTUSER"
        exit
    fi
    
    start(){
        tmux list-session 2>&1 | grep -q "^$TMS:" || tmux new-session -s $TMS -d
        tmux send-keys -t $TMS:0 "cd $DIR" C-m
        tmux send-keys -t $TMS:0 "echo Waiting for 3 seconds..." C-m
        tmux send-keys -t $TMS:0 "sleep 3" C-m
        tmux send-keys -t $TMS:0 "./start.sh -l" C-m
    }
    
    pmstop(){
        tmux send-keys -t $TMS:0 "save-all" C-m
        tmux send-keys -t $TMS:0 "stop" C-m
    }
    
    stop(){
        tmux kill-session -t $TMS
    }
    
    
    case "$1" in
    
        start|r)
        start
        ;;
    
        stop|h)
        pmstop
        stop
        ;;
    
        restart|rs)
        pmstop
        stop
        start
        ;;
    
        attach|s|j)
        tmux a -t $TMS
        ;;
    
        pmstop|pms)
        pmstop
        ;;
    
        *)
        echo "$(basename $0) <start(r)|stop(h)|restart(rs)|attatch(a)|pmstop(pms)>"
        ;;
    
    esac
    exit 0
    
    i had posted another one which is annotated but cant really find it,
    maybe i should put this on git lol
    also it uses TMUX not screen
     
  18. VCraft

    VCraft Witch

    Messages:
    60
    GitHub:
    VCraftMCPE
    u mean pogogo "SmoothChunks"
     
  19. sharletsings123

    sharletsings123 Baby Zombie

    Messages:
    116
    GitHub:
    sharletk
    Also, to keep something in mind.
    If you have a firewall enabled on your VPS such as `UFW` you will have to allow the port so you can connect over the server or disable the firewall.

    Let's say we use port 19232:
    To enable the firewall...
    Code:
    ufw enable
    
    To allow a port...
    Code:
    ufw allow 19132
    
    You can allow connections in many ways even including the IP Address.

    To deny a port..
    Code:
    ufw deny 19132
    
    and finally to disable the firewall....
    Code:
    ufw disable
    
    Also keep in mind that you can replace 19132 with the port you want and allow either UDP or TCP connections and allow IPAddress and Port connections as well.

    For more info I recommend going through a tutorial explaining the firewall UFW.
    https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-16-04

    Also to make all this work you should have UFW Installed...
    Code:
    sudo apt-get install ufw
    
    And to remove and purge it if you don't want it...
    Code:
    sudo apt-get remove --purge ufw
    
    Hope its help full, if I had done something wrong please report would be help full.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.