Monday 26 October 2015

Running an McMyAdmin Minecraft Server on Linux Mint

Why Would I Want To Do This?

McMyAdmin allows you to run and manage a Minecraft server (relatively) simply. 

This is how I went about installing it on a box running Linux Mint 17.2

Add A New User 

Note: You can choose not to do this step if you like but from a security and backup point of view I find it helps
  • Go to User and Groups (via the Linux Mint menu) and add a new user without admin permissions
I called mine "minecraft" but "mcmyadmin" or whatever you like will work just as well. 

Install Supporting Files

This needs to be done as an admin user.
  • Change directory with cd /usr/local 
  • Download the supporting zipped file sudo wget http://mcmyadmin.com/Downloads/etc.zip 
  • Unzip the downloaded file sudo unzip etc.zip
  • Remove the zipped file sudo rm etc.zip

Install McMyAdmin Itself

This needs to be done as the user you created in the first step
  • First create a directory for McMyAdmin mkdir ~/McMyAdmin
  • Change directory with cd ~/McMyAdmin
  • Download the zipped file wget http://mcmyadmin.com/Downloads/MCMA2_glibc26_2.zip
  • Unzip the downloaded file unzip MCMA2_glibc26_2.zip
  • Remove the zipped file rm MCMA2_glibc26_2.zip

Configure McMyAdmin With An Admin Password

  • Run the executable with the -setpass and -configonly options ./MCMA2_Linux_x86_64 -setpass [YOURPASSWORD] -configonly

Running McMyAdmin For The First Time

  • Change to the McMyAdmin directory cd ~/McMyAdmin 
  • Run the executable ./MCMA2_Linux_x86_64
Note that you must change to the directory McMyAdmin is installed to before running it. You cannot run it using a relative or absolute path.

Adding McMyAdmin To Upstart

Having an McMyAdmin server running is a good start but you don't want to have to restart it manually every time you reboot your server. That is where Upstart helps out. 

In order to configure Upstart to start up your server you must do the following...

Create Config File

Create a new config file called something like minecraft.conf or mcmyadmin.conf
  • cd /etc/init 
  • sudo touch minecraft.conf 
Paste in the following code into your conf file making sure to change the path in the cd command to match the location of your McMyAdmin install

<---------------start cutting below this line--------------->

# /etc/init/minecraft.conf
description "Minecraft server"

start on runlevel [2345]
stop on runlevel [^2345]

#change /home/minecraft/McMyAdmin if you put McMyAdmin somewhere else
exec su minecraft -s /bin/bash -c 'cd /home/minecraft/McMyAdmin;./MCMA2_Linux_x86_64'


<---------------stop cutting above this line---------------> 
To check if this has worked run

  • initctl reload-configuration 

which will load your new config file.
 
Test the service status (which should not yet be running)

  • sudo service minecraft status

Start the service

  • sudo service minecraft start 

Test the service status again (which should now be running)

  • sudo service minecraft status 

And then stop the service 

  • sudo service minecraft stop 

Once you are happy that the service starts and stops at your command. Reboot the computer. Once it is back up and running  recheck the service status and confirm it restarted automatically on reboot.

Port Forwarding for your server


The example is for the Huawei hg533 router but while the exact naming of the settings may differ on other routers the principles will be the same.
Go to the router page on your LAN. This is normally 192.168.1.1 but you may have changed it.
Login as the admin user using your password
  1. Go to the Advanced NAT, Port Forwarding section 
  2. Click on new to create a new rule
  3. Set type to Customization
  4. Protocol to TCP
  5. External Start and End Ports to 25565 (or whatever port you want your users to access your Minecraft server on)
  6. Internal Host to the local IP address of your server
  7. Internal Port to 25565 (or whatever port you have set your McMyAdmin server Minecraft instance to)
  8. Mapping Name to a suitable name. Mine is set to "Minecraft" 

1 comment:

  1. Just admiring your work and wondering how you managed this blog so well. It’s so remarkable that I can't afford to not go through this valuable information whenever I surf the internet!
    Minecraft Server

    ReplyDelete