McMyAdmin is a web administration control panel that lets you easily install, configure and run a Minecraft server. This guide covers getting McMyAdmin up and running on Slackware Linux 14.1.
The first thing we will do is create a minecraft
user and group. This will
allow us to run the server without exposing unnecessary permissions(for
example, the minecraft
user won't be able to run rm -rf /
):
mkdir /srv/minecraft groupadd minecraft useradd -d /srv/minecraft -g minecraft -s /bin/bash minecraft chown minecraft:minecraft /srv/minecraft
Minecraft depends on Java, which we can install using a SlackBuild. First, you'll need to grab the SlackBuild's archive:
mkdir ~/builds; cd ~/builds wget http://slackbuilds.org/slackbuilds/14.1/development/jdk.tar.gz tar xfz jdk.tar.gz cd jdk
Next we'll need to download the source, but Oracle requires you to first agree
to their download terms, so you will have to manually grab it from the Java
Download Page. Once you've got it on your computer, you can use
rsync
or scp
to copy it to your server:
# On your workstation
scp jdk-*.tar.gz me@myserver:~
Then we can compile and install the package:
# Back on your server mv ~/jdk-*.tar.gz ~/builds/jdk/ cd ~/builds/jdk ./jdk.SlackBuild installpkg /tmp/jdk-*_SBo.tgz
Finally we'll have to add the Java executable to our PATH
:
ln -s /usr/lib64/java/jre/bin/java /usr/bin/java
If you are compiling McMyAdmin for a 32-bit system, you need to have
configuration files for Mono in /usr/local/etc
. Run the following as
the root
user:
cd /usr/local wget http://mcmyadmin.com/Downloads/etc.zip unzip etc.zip; rm etc.zip
Next we'll log in as the minecraft
user we created earlier in order to
install McMyAdmin:
su minecraft cd /srv/minecraft mkdir McMyAdmin cd McMyAdmin wget http://mcmyadmin.com/Downloads/MCMA2_glibc25.zip unzip MCMA2_glibc25.zip rm MCMA2_glibc25.zip ./MCMA2_Linux_x86_64 -setpass <password> -configonly ./MCMA2_Linux_x86_64
You should now be able to test out the web interface by visiting
http://yourserversip:8080
. The default username is admin
.
In order to get McMyAdmin2 to run as a daemon at boot, we can add the following
rc.minecraft
file to /etc/rc.d/
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | #!/usr/bin/bash # /etc/rc.d/rc.minecraft NAME='McMyAdmin' # Server handle for the screen session USER='minecraft' # User that this will be running under. DIR='/srv/minecraft/McMyAdmin' MCPID="$DIR/minecraft_server.pid" PWD=`pwd` CMD="/usr/bin/screen -S $NAME -A -d -m ./MCMA2_Linux_x86_64" RETVAL=0 service_start() { if [ -f /var/run/$NAME.pid ]; then if [ "$(ps -p `cat /var/run/$NAME.pid` | wc -l)" -gt 1 ]; then echo -e "Cannot start $NAME. Server is already running." else rm -rf /var/run/$NAME.pid service_start fi else cd $DIR su $USER -c "$CMD" cd $PWD sleep 1 ps -ef | grep SCREEN | grep "$NAME" | grep -v grep | awk '{ print $2}' > /var/run/$NAME.pid echo "$NAME started." fi } service_stop() { if [ -f $MCPID ]; then echo "Stopping Minecraft server." kill `cat $MCPID` rm -rf $MCPID echo "Minecraft server stopped." else echo "Minecraft server not running." fi if [ -f /var/run/$NAME.pid ]; then echo "Stopping $NAME." kill `cat /var/run/$NAME.pid` rm -rf /var/run/$NAME.pid echo "$NAME stopped." else echo -e "Cannot stop $NAME. Server is not running." fi } case "$1" in 'start') service_start ;; 'stop') service_stop ;; 'restart') service_stop sleep 5 service_start ;; *) echo "Usage $0 start|stop|restart" esac |
This script launches the web server in a screen
session, so make sure you
have it installed:
slackpkg install screen
Make the script executable, then edit rc.local
and rc.local_shutdown
so
that the server is started/stopped at boot/shutdown:
chmod +x /etc/rc.d/rc.minecraft
# /etc/rc.d/rc.local if [ -x /etc/rc.d/rc.minecraft ]; then /etc/rc.d/rc.minecraft start fi
# /etc/rc.d/rc.local_shutdown if [ -x /etc/rc.d/rc.minecraft ]; then /etc/rc.d/rc.minecraft stop fi
We can use apache to make a proxy from port 80
to port 8080
so that we can
access McMyAdmin from http://minecraft.yourserver.com
instead of
http://yourserver.com:8080
.
First start off by installing and enabling httpd:
slackpkg install httpd chmod +x /etc/rc.d/rc.httpd
Then edit /etc/httpd/httpd.conf
, adding a new virtual host:
<VirtualHost *:80> ServerName minecraft.yourserver.com ProxyRequests Off ProxyPreserveHost On <Proxy *> Order allow,deny Allow from all </Proxy> ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost>
Now that McMyAdmin is setup, we can easily install the Minecraft server. Head
to http://minecraft.yourserver.com
and login with the username admin
and
the password you used when setting up McMyAdmin. Then head to Configuration ->
Server Settings -> Server Type
, select the server type you want and press
Install
.
Comments
Sergey 5 years, 12 months ago
./MCMA2_Linux_x86_64 -setpass admin -configonly
Link | Replybash: ./MCMA2_Linux_x86_64: cannot execute binary file
LOL
SleepAnarchy 5 years, 12 months ago
./MCMA2_Linux_x86_64 -setpass admin -configonly
Link | Replybash: ./MCMA2_Linux_x86_64: cannot execute binary file
LOL
This usually means you're trying to run a 64-bit executable on a non-64-bit OS.
New Comment