How to set up a Minecraft server on Linux

I’ve been playing Minecraft for a couple of months. It’s a fantastic sandbox game but if you want to play with other people and keep your own persistent world, you’ll need to setup your own server.

First things first:

  • Don’t bother trying to run Minecraft on an OpenVZ host. I tried this and was plagued with java.lang.OutOfMemoryError – this was with 1GB RAM and around three players connected at once.
  • My current server is one of our beta KVM virtual servers with 2GB RAM and it’s been working without a hitch for the last few weeks.
  • I wouldn’t recommend going with any less than 2GB of RAM.
  • Mine is running on 64bit Ubuntu Server 10.10 although you can use any Linux distro.

Minecraft server setup:

1. First thing to do is install Java:

me@myserver:~$ sudo apt-get install openjdk-6-jre-headless

(if this doesn’t work, try a sudo apt-get update first)

2. Next we need to create a directory for it (I did this in /home/greg) and download the minecraft server:

me@myserver:~$ mkdir minecraft

me@myserver:~$ cd minecraft

me@myserver:~$ wget

OK that’s the installation done, time to fire it up:

me@myserver:~$ java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui

You can tweak the amount of RAM to allocate to Java with the flags above, -Xms sets the initial memory allocation and -Xmx sets the maximum memory limit. It’s best to allocate as much RAM as possible because Java can be quite RAM hungry. On my KVM with 2GB RAM I set them both to 1496M and haven’t had any problems.

Have fun!

This entry was posted in Tutorials. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>