drew.d.lenhart

programming, software, technology, anything on my mind...

Starting your own Minecraft server on Ubuntu 14.04

2014/07/16

I first started playing Minecraft when the game was released in beta many years ago. Since then, I've played on very small multiplayer servers over the years. After a years abscence of playing, I recently got into Tekkit.  Tekkit is a custom Minecraft launcher allowing you to easily manage the hordes of Mod packs out there. Minecraft has really come a long way over the years.

Although the MC community has created a lot of goodies, lets walk through how to set up your own Minecraft server!  This post will walk through how to create the basic MC set up, or "Vanilla" server. So brush up on your Linux commands and let's get started.

mc

The Server

If you have a decent machine that can be dedicated to MC then you are ready to get started. You can get away with running MC on a box with a gig of ram, but I recommend at least 3gigs. 2 gigs allocated for MC, and the rest for the system.

Step 1: Download and install Ubuntu Server. To install Ubuntu Server you will need an active network connection to complete the installation. You will of course need a keyboard & Monitor to install. I wont go into how to install Ubuntu OS. But you can follow this tutorial to get the OS on your system. After installation is complete, on the command prompt, type:

ifconfig

eg:

pi@ubuntucraft:~$ ifconfig
em1 Link encap:Ethernet HWaddr 3c:d9:2b:06:d5:26
inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::3ed9:2bff:fe06:d526/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3565798 errors:0 dropped:55 overruns:0 frame:0
TX packets:9498648 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2566142317 (2.5 GB) TX bytes:12535889946 (12.5 GB)
Interrupt:18


Write down the IP number. In the example above, the IP is 192.168.1.4.

We are going to need a few tools in order to administer our server. Assuming you want to run the server "headless" (without a keyboard/mouse/monitor), we will need the following tools so the server can be maintained remotely.

  • SSH
  • FTP
Step 2: Install SSH:

sudo apt-get update
sudo apt-get install openssh-server

*press Y to install at prompt

Now that SSH is installed. The monitor/keyboard/mouse can be removed from the system. Hop on another computer and download a ssh program such as PuTTy if on Windows, or use the terminal in Mac/Linux. Issue this command:

ssh your-ip or ssh username@your-ip-number eg: ssh drew@192.168.1.4

Your screen should look something like this when you log in:

termshot2

 

You are now in the new MC server! Now lets set up FTP, create a Minecraft direcory, and download the server files.

Step 3:

Install FTP to transfer MC server files and use later to upload any other files you may need in the future.

Install FTP:
sudo apt-get install vsftpd

Edit vsftp.conf file:
sudo nano /etc/vsftpd.conf

Change the following:
anonymous_enable=YES to NO
Uncomment local_enable=YES
add to the bottom of the file force_dot_files=YES.

To exit nano, press ctrl+x, Y to save, press enter when it displays the file name.
Restart ftp:
sudo service vsftpd restart

Create Minecraft directory:
Lets put the MC directory in root (where home, var, etc reside).

cd / *Will change the directory to "root".
sudo mkdir minecraft

Now that we have ftp installed, and our Minecraft directory created, lets create a shortcut in your user folder (for when you ftp into server and have a shortcut to the MC folder).

sudo ln -s /minecraft ~/minecraft
Step 4: Minecraft is written in Java, so naturally we have to install Java:

sudo apt-get update
sudo apt-get install openjdk-7-jre


Now do one more final reboot before installing the MC server files:

sudo reboot

Minecraft Server

Download the files to your machine and upload using the newly installed FTP service!

Download the .jar server from the Minecraft website.

Now upload to the /minecraft directory.

An alternative to using ftp to uploading the Minecraft Server file is using the command line to download:

sudo wget url_to_minecraft.jar

Make sure you go to the Minecraft website and copy the download link to the latest server file.

Navigate to the /minecraft directory: cd /minecraft

Start Server:

java -Xmx1024M -Xms1024M -jar minecraft_server.1.7.10.jar nogui

cntrl a + d gets out of the Minecraft console to the linux prompt

You are all set! A couple more things, the command above, Xmx1024M, is where you can set the amount of ram you want allocated to Minecraft. 1024 mb is in the example, so if you would like more, be sure to adjust and leave enough for your system to run.

Open the Minecraft game, select multiplayer, and add a new host with the IP you wrote down in the earlier step!

Lastly, if you want to be able to share the server to friends, etc. You will need to forward the port MC uses in your router. Minecraft's default port is 25565.

Thanks for reading! Leave a comment if something is not clear or I missed something.

--Drew D. Lenhart