What is it?

The Minecraft Server Manager (MSM) is a clever tool that helps you manage hosted servers. It has an official site and everything, and the code is open source on github. That’s the good news.

Update! When I wrote this article the MSM project was unmaintained, and I included a bunch of steps to fix its brokenness. The project seems to be back on its feet and working, so I’ve updated this article accordingly. Thanks to Mika Mäntylä for the heads up!

This article walks how to install MSM on Amazon Linux. If you followed my earlier article on setting up an EC2 server, you can go right ahead with these steps.

How to install MSM on Amazon Linux

The official install docs include both an automated installer (frightening), and some excellent manual steps. We will be following the latter.

Since we are neither Ubuntu nor Redhat (the two recommended platforms) there are some adjustments to make. The numbers below match the steps in the MSM install doc - you can go ahead and just use the commands below, they are complete.

  1. Here we have no action since the Amazon Linux image already contains the tools screen, rsync, zip.
  2. Download the default config file, update the user ID, and also add the -server switch which the MSM guys omitted:

    sudo wget http://git.io/6eiCSg -O /etc/msm.conf sudo vim /etc/msm.conf # make these edits: USERNAME=”ec2-user” DEFAULT_USERNAME=”ec2-user” DEFAULT_INVOCATION=”java -server -Xms{RAM}M -Xmx{RAM}M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:+AggressiveOpts -jar {JAR} nogui”

  3. Set up the install directory and the RAM disk:

    sudo mkdir /opt/msm sudo chown ec2-user /opt/msm sudo chmod -R 775 /opt/msm sudo mkdir /dev/shm/msm sudo chown ec2-user /dev/shm/msm sudo chmod -R 775 /dev/shm/msm

  4. Get the main executable.

    sudo wget http://git.io/J1GAxA -O /etc/init.d/msm

  5. Make it executable and set it up as a new service type:

    sudo chmod 755 /etc/init.d/msm sudo chkconfig –add msm sudo chkconfig msm on

  6. Add a symlink in the path:

    sudo ln -s /etc/init.d/msm /usr/local/bin/msm

  7. Put that path in the sudoers file so it’s picked up, and then get MSM to update itself:

    sudo vim /etc/sudoers # Make this edit: Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin # Now we can update: sudo msm update

  8. Set up cron:

    sudo wget http://git.io/pczolg -O /etc/cron.d/msm sudo service crond reload

  9. Now into some MSM stuff. MSM is cool because server data (an MSM server) is kept separate from Minecraft versions (an MSM jargroup). So let’s create the jargroup which is responsible for fetching Minecraft jars (update the version number to be current!):

    sudo msm jargroup create minecraft https://s3.amazonaws.com/Minecraft.Download/versions/1.8.9/minecraft_server.1.8.9.jar

  10. Now create a new server, and hook it up to the jargroup we just made:

    sudo msm server create myserver sudo msm myserver jar minecraft

  11. To avoid an annoying warning on startup, we set this properties file. It doesn’t appear to do anything exciting:

    vim /opt/msm/servers/myserver/server.properties # make this edit: msm-version=minecraft/1.3.0 # now start the server: sudo msm myserver start

  12. On first startup, the world directory is created with all your data in it. For best results, MSM recommends you move this as follows:

    sudo msm myserver stop cd /opt/msm/servers/myserver mv world worldstorage sudo msm myserver worlds load

  13. We’re nearly there. The final hiccup: recent versions of Minecraft have a eula.txt that needs updated. So for each server, we need to:

    sudo msm stable start # this will create the eula.txt, then the server will fail to start. sudo msm stable stop vim /opt/msm/servers/stable/eula.txt # make this edit: eula=true # now start up! sudo msm stable start

That’s it! If you sudo msm myserver start now, you should have a running server.

Check /opt/msm/servers/myserver/server.log for details.

All done

You can now run a stable or snapshot server at will, and they’ll be automatically updated when you restart them.