RZFeeser - How to build a Minecraft server on Ubuntu[UPDATED December 2013] There is more than one way to skin a cat. So here is one way to put up a Minecraft server for you and your buddies to play on. This solution assumes you will be hosting the server on your local LAN, and therefore will need to transverse a NAT if you are to make the server available across the WAN (i.e. if you want your buddies to be able to connect to your server from their own LANs).

If you get stuck, feel free to contact me and I’ll help you out. For clarification purposes, the commands you’ll need to issue at the Ubuntu server command line are listed in bold.




Things you’ll need:

  • DD-WRT enabled router (such as the Asus N-16), or other router that is able to push updates to DNS to resolve the router’s current WAN IP
  • A virtual machine environment, or an old laptop (2 gigs RAM, 10/100 NIC, Pentium class or better) <- this will be used to host the Ubuntu Minecraft server
  • You may also need to refer to some of my other blog posts: “How to build an Asus N-16 DD-WRT enabled router” (this will be my next post), and “How to resolve your router’s IP address with Dyn.DNS.org or other similar service


Part 1: Installing Ubuntu Server 12.04 LTS

  1. Download Ubuntu Server 12.04 LTS
    1. If you are unsure which *.iso to download, download the x86 architecture (it will work on a 32-bit & 64-bit PC)
  2. Install Ubuntu Server 12.04 LTS as the base OS within a VM environment, or as the base OS on an old laptop
    1. Accept defaults during installation with the following ‘tweaks’
      1. Turn on automatic security updates
      2. Select the service SSHd to be installed (this will provide you with remote SSH access to your Minecraft server)
  3. Log into your Ubuntu Server 12.04 LTS for the first time

Part 2: Updates & NAT Traversal

  1. Log into Ubuntu Server 12.04 LTS for the first time
    1. At the terminal, type the following commands to ensure your system is fully updated
      • sudo apt-get update
      • sudo apt-get upgrade
      • ifconfig
        1. Record the MAC address for this machine. The MAC address will appear as a collection of hexadecimal characters, and formatted something like this: A0:B1:C2:D4:E5:FF.
        2. You’ll need your server to have a static IP. There are two options for statically assign an IP address to your Ubuntu server:
          • Use the MAC to statically assign an IP address to the machine in the DHCP service provided by the DD-WRT enabled router (very easy)
          • Statically define the IP address below the range of the DHCP pool at the interface itself (also easy)
          • Do one of these two things now. I don’t know how your network is setup, so it is difficult to say which one of these two solutions is ‘best’ for your application.
  2. Log into your DD-WRT enabled router (instructions to create a DD-WRT enabled router from a $70.00 Asus N-16 router)
    1. First click on Setup > DDNS
      • Provision DynDNS.org (how to use DynDNS.org, or a similar service)
    2. Click NAT / QOS > Port Forwarding, then fill out the fields as follows
      • Application write something like “MinecraftServer”
      • Protocol – TCP
      • Source Net – [blank]
      • Port From – This is the port you’d like to bring packets in from the outside world with. You’ll associate this number with DynDNS.org subdomain you created in step ##, and give this address to your friends to connect to your with, like this: subdomain.dyndns.org:port To offer some anonymity, choose something high and random, between ## and ##.
      • IP Address – [the static IP address of the Minecraft Server]
      • Port to – [place the number you chose in step ## here]
      • Enabled – [checked]
    3. At this point, anyone should be able to take the FQDN you created in step 4a and the port you chose to forward from in step 4b, and use it to reach your minecraft server… if you had a minecraft server.

Part 3: Installing Minecraft Server

  1. Type the following commands in your Ubuntu 12.04 server
    1. java -version
  2. You should see a message saying “The program ‘java’ can be found in the following packages:” followed by a list of locations.  There should be one that says “default-jre”
    1. sudo apt-get install default-jre
  3. Now install ‘screen’. Screen will allow you to open multiple terminal sessions within one window
    1. sudo apt-get install screen
  4. Create a directory for minecraft. In the main user’s home directory should be fine.
    1. mkdir minecraft
    2. cd minecraft
  5. This next command will download the minecraft server code. You can tweak this command to easily update your server as new releases come out (just change the path)
    1. It is currently set to download version 1.7.2, which is current as of the time of this posting (Updated December 2013)
      1. wget -P /home/YOURUSERNAME/minecraft/ ‘https://s3.amazonaws.com/Minecraft.Download/versions/1.7.2/minecraft_server.1.7.2.jar’
    2. screen -S “Minecraft server”
  6. Now just start your new Minecraft server!
    1. java -Xmx1024 -Xms1024M -jar minecraft_server.1.7.2.jar nogui
    2. You can exit out of the screen by pressing ctrl-a d
    3. To reattach to screen, type screen -R

I’ll continue to update and improve this posting as time goes on!