Installing an Ubuntu Minecraft Server

Minecraft has a lot of servers which you can connect to and play online with others. I wanted to setup a private server for my son so that I have some control over who he gets to play.  I hope you find my experience on setting up a server useful.

  1. All the steps below assume Ubuntu 12.04 LTS, you can probably use similar versions of Ubuntu as well.
  2. The authoritative server  twiki is here http://www.minecraftwiki.net/wiki/Server, so do read that, however you will find the below instructions easier than the twiki since I have condensed them down for Ubuntu based server. If you need to install Minecraft server for different platforms use the steps here http://www.minecraftwiki.net/wiki/Setting_up_a_server.
  3. To start off look at the bare minimum server requirements here http://www.minecraftwiki.net/wiki/Server/Requirements. My server is running as a VM guest with 2GB RAM, and 1 VCPU. The VCPU is on a host/hypervisor that has a single Quad Core Xeon processor which is multi-threaded. I also allocated 10GB disk space for my VM. You can run the server on your laptop if it meets the minimum requirements, as long as you open up the Minecraft port through the firewall. The only problem with running it on your laptop is that the server will be down when your laptop is turned off so you may not get many friends who want to join your server. My server is hosted online with a co-location provider. I would suggest looking at Amazon EC2 if you want to get your own server here http://aws.amazon.com/ec2/.
  4. You need this package in order to run apt-add-repository later: sudo apt-get install software-properties-common -y
  5. sudo apt-get install python-software-properties -y
  6. sudo apt-add-repository ppa:webupd8team/java
  7. sudo apt-get update
  8. sudo apt-get install oracle-java7-installer -y
  9. java -version
  10. I am running my server as user ‘minecraft’ which has no login shell for security. sudo adduser –system –no-create-home –home /home/minecraft-server minecraft
  11. sudo mkdir /home/minecraft-server
  12. sudo chown -R minecraft minecraft-server/
  13. Next is to add user ‘minecraft’ to ‘games’ group, so edit the group file by running  ‘sudo vi /etc/group’ and in the games line add user ‘minecraft’ or you can use the usermod command as well
  14. sudo chgrp -R games minecraft-server/
  15. I want all files in the minecraft directory to belong to the games group so run: sudo chmod g+s minecraft-server/
  16. It is a good idea to have start and stop scripts that start/stop minecraft when the server reboots, so in the next step I created a file which allowed me to specify that. In terms of the Xms sizes, adjust the size based on how much RAM you have, I decided to give the JVM 1.5GB RAM.
  17. $cat /etc/init/minecraft-server.conf
     chdir /home/minecraft-server
     exec su -s /bin/sh -c 'exec "$0" "$@"' minecraft -- \
     /usr/bin/java -Xms1536M -Xmx1536M -jar \
     minecraft_server.jar nogui > /dev/null</pre>
     start on runlevel [2345]
     stop on runlevel [^2345]
     
  18. Now download the server itself : cd /home/minecraft-server; sudo wget http://s3.amazonaws.com/Minecraft.Download/versions/13w18c/
  19. sudo mv  minecraft_server.13w18c.jar minecraft-server.jar
  20. sudo vi server.properties and look here to see which entries to modify
  21. Test starting the server usingjava -Xms1G -Xmx1G -jar minecraft_server.jar nogui
  22. Once the server is up and running view the server commands which can be run by joining the server here http://www.minecraftwiki.net/wiki/Server_commands
  23. sudo stop minecraft-server && sudo start minecraft-server && ps axu | grep -i mine 
  24. That’s it, you are not ready to use this server. Start a minecraft client, and type in this server name in multiplayer mode. The server name is the hostname of the server.

How has your experience been with setting up Minecraft? Share your comments below.

2 thoughts on “Installing an Ubuntu Minecraft Server

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s