how to host a minecraft server on github | WTBBLUE

Minecraft Logo

Setting up a Minecraft server

Reading: how to host a minecraft server on github

Table of contents

  • Minecraft

  • Clients and Servers

  • Getting a server on the Internet

  • Setting up the operating system

  • Securing your server

    • Secure Shells
    • Firewall and iptables
    • fail2ban
  • Configuring your server

    • Whitelisting
    • CraftBukkit
    • Protect your world
  • MinecraftEdu

  • Resources


Minecraft is a game by Mojang that allows players to mine, build and craft things in their own worlds. You can play Minecraft on your own computer, on a mobile device and on your Xbox. You don't need to connect to a server to play Minecraft, but a server lets you play with your friends.

Clients and Servers

When computer programs need to communicate, they are often separated into client programs and server programs. Client programs run on user machines and server programs run on servers. Any computer can be a client or a server, but often servers are out on the Internet. This allows multiple clients to talk with them at the same time.

Servers are like cooks at a restaurant and clients are like customers. The customers send messages (via the waiter or waitress) to the cook who prepares a response (the food) which is sent back to the customer. One cook can serve a lot of customers at the same time but there are limits.

In software, clients connect to servers by specifying their IP address (or website) and sending messages on a specific port. Ports are like channels on your TV. On most computers the lower number ports are reserved for specific things (usually port 0-1023). Higher number ports can be used by anyone and sometimes conflict so make sure you are using the right port for your client and server.

Servers and clients communicate by sending small messages back and forth. This usually happens using a protocol or agreement about how they will talk (who talks first and what happens if you don't hear part of the message). Most protocols are based on TCP or UDP.

TCP is short for Transmission Control Protocol. It is one of the primary ways devices communicate on the Internet. Every time you go to a website, your web browser (a client) is connecting to a website (a web server) using a protocol called HTTP which is based on TCP. Messages are sent from your browser to the server and back using port 80 or port 443. The thing that makes TCP so great is that communication sockets are constantly interrupted (the Internet is always breaking). TCP guarantees that your messages will be received and that they will be in order. Without this, the hundreds of messages the server sends to your client might take different pathways and arrive out of order. Web pages would be all jumbled.

UDP is short for User Datagram Protocol. UDP is also used on the web but is more commonly used in communications or video. For instance, Youtube uses UDP to deliver video to your web browser. And Skype uses UDP when you have a conversation (most of the time). UDP does not guarantee that your message will ever arrive, and if the order messed up… UDP won't care. This seems bad, but in the case of phone conversations means that there is no delay when waiting for the whole message. It skips missing packets of information and moves on.

Imagine you are playing the piano in a concert and the song you are playing is very fast and beautiful, but also very difficult. There is one note that you have to stretch your pinky to reach and sometimes you miss it. In the TCP version of this story, if you miss the note you stop the concert and keep trying to hit it with your pinky until you get it- because playing all of the notes exactly as they are written is really important. In the UDP version of this story you just keep playing the song if you miss the note… very few people will notice and the whole thing will sound better if you don't stop.

Minecraft uses TCP port 25565 to communicate between the client and server. This means that the messages are reliably sent between the two (or there is a disconnect).

Getting a server on the Internet

Getting a server on the Internet is easy. In fact, your computer is connected to the Internet right now and could be a Minecraft server. In most cases, your router and cable modem are in between your computer and the Internet. This means that people outside of your network can't see your computer directly (in most cases), instead they see your cable modem or your router. For instance go to WhatIsMyIP? and see what your address is (it might be something like If you were hosting a Minecraft server on your computer you would need to give your IP address to your friends. Unfortunately they still wouldn't see your computer, instead they would be connecting to your cable modem!

You could use port forwarding to send any messages from your cable modem to your computer to solve this problem. In order to do that, you need to know what the address of your computer on your local network is. There are few ways to do this, but the best way is to open a terminal window (on OSX you can use Spotlight and search for Terminal) and run ifconfig. This is going to give you a lot of information-way more than you need-but what you are looking for is your inet address which usually starts with 192. or 10.. To weed this out you can use the more advanced command:

This command says “run ifconfig and send the output to the grep command and search for the word ‘inet' and just show me those lines”. With this information you could forward external messages to your computer on your internal network. Even if you did this though, your Minecraft server would only work while your computer is on and while your Internet is working. If someone on your network starts watching YouTube videos or a movie on Netflix, your bandwidth might not be enough to support playing Minecraft. Also, if you are running a server on the same machine you play minecraft, your computer might get slow. For these reasons, we'll use a different computer out on the Internet.

Though there are some free computers you can use on the Internet, this is generally not the case (although Amazon offers 1 year free use of small servers). Computers cost money and running them costs money. All you have to do is choose the right server for running Minecraft without spending too much money.

For our use, we want to be able to play minecraft with 6 of our friends. A quick way to determine if the server you found will work is to go to Can I host a minecraft server. We plan on using DigitalOcean to host our server. DigitalOcean is a hosting company that lets you rent computers on the Internet (or rather, they let you rent virtual servers). DigitalOcean, like most providers, offers Tier 1 bandwidth at 1gbit/sec so we specify that our upload and download (in mbit/s) are 1024. The smallest plan on DigitalOcean is 5$ per month and it offers 512MB of memory (this can also be billed hourly if you want to turn off you machine to save money). According to Can I host a minecraft server that gives us just enough for 6 friends and us.

There are lots of other providers (for example Linode, Prgrmr, Amazon EC2, Rackspace).

Getting started at Digital Ocean

Once you signup you'll need to setup your billing information.

Create a Droplet

After that you will want to create a “Droplet”. Think of this like a recipe for creating a computer of a specific size and with a specific operating system.

A note on hostnames: when creating a droplet you have to create a hostname. People choose all kinds of names but when you choose your name try to imagine you will have lots of servers and you want to be able to distinguish them quickly. For this reason most people choose a naming theme to identify their servers quickly. For me, I use ancient city names but some people use articles of clothing or names of characters in books. You can come up with your own or you can choose something like “minecraftserver1”.

Choose a region that is near you or stick with the default.

We'll be running Linux on our server. There are lots of tradeoffs to the different flavors of linux. For us we will choose the one that will make our job easier and because Ubuntu has so much information online and a large helpful community we'll go with that. Although there are newer versions we chose Ubuntu 12.04.3 x64. This is an “LTS” release which means it has Long Term Support. Any security fixes will be ported to this version and it will be stable for a long time.

For now we didn't choose to enable backups. We might regret that later.

Once you have finished configuring your server you can “Create Droplet” and DigitalOcean will start creating the machine and send you an email with login details.

SSH access to your new server

Using the information that DigitalOcean sent us we can create a “Secure Shell” or SSH connection to our server. This allows us to run commands on our remote server as if we were on it (and it encrypts all of the information being sent back and forth).

First, you'll want setup a hostname for your remote server so you can login to the server by name. Open Terminal and type:

This opens the file /etc/hosts in the terminal editor nano as the admin (“sudo” means super-user do). At the top of the file add your server IP address followed by the hostname you chose. For example:

Once complete, hit Ctrl+X to exit (not CMD+X). nano will ask if you want to save, press Y and hit enter. Now you can test to make sure that worked by “pinging” your server:

Related: how to turn off tutorial in minecraft

You should see:

Hit Ctrl+c to stop ping.

Now we can ssh in. Type:

Related: how to turn off tutorial in minecraft

You should see:

Type “yes” and hit enter. At this point you need to enter the password that you were sent in the email. Once you've entered that you are logged into your server on the Internet.

Note: you just logged into your server as the root user. This is considered very bad practice and you want to avoid doing this. In fact you don't want anyone logging in as the root user because it is not secure. Without setting up a custom droplet though you need to do this once.

Securing your server

Much of this comes from My First 5 Minutes On A Server; Or, Essential Security for Linux Servers.

You can change your root password right away, but you need to store it somewhere. You could store it in your Keychain. It should be long and complex, you shouldn't need it.

By default your server is set to use the most recent set of packages that server company has. But there are usually a lot of updates that you should start with:

Once you have this we'll want to lock things down. If people try to hack into our server we want them to get blocked permanently.

Creating a user

Now we want a user. We'll call this user minecraft:

Now that you have a user you want to setup an authorized key saying that your computer is allowed to login to the server without using a password. This is actually much safer than using a password because passwords can be guessed. Keys are much longer and encrypt all of you communications between your machine and the server.

The nano editor will open and you need to get some information from your local computer. Open another tab or another terminal window and in the new Terminal type:

You should see something like:

Note that this is your public key. You also have a private key which you should not give away ever (it is in the file id_rsa without the .pub extension).

Copy the contents (including ssh-rsa and [email protected]) and paste it back in the nano window in the other terminal. Once pasted, click Ctrl+X type “Y” for “yes” and hit enter.

Super user access

Now we need to lock down that file so nobody can change it (and add their own keys). Once we have changed the mode so it is only readable, we will change the owner to our new minecraft user:

We'll give the user a password which we will need when doing important things.

Next we need to change how the sudo command works. The sudo command is short for “super-user do” and lets users run commands as if they were the root (most powerful) user. To change this we'll use a command called visudo. This command opens an editor called vi which works a little differently than the editors you are used to. Instead we'll force it to use nano:

Once open you should see a lot of commands and you want to comment some of them out:


We are going to comment these lines out by adding a “# ” to the start of the lines:


Next we'll add the line:

This says, as long as we are logged in and know the password we can run ALL commands as the superuser.

Technically we shouldn't need this for our minecraft server as everything will be setup. Giving users sudo is very serious. If they have super user privileges they can change anything about the server. Sometimes when setting up a server you'll see people use NOPASSWD:ALL indicating that you don't even need a password. This is very dangerous and is usually just a sign of laziness. For us, it is good to have some access so that we can switch to the super user later.

Securing SSH

In general you don't want users using ssh to login as the root user (even though you are doing it right now).

Change PermitRootLogin from “yes” to “no”

Change PasswordAuthentication to no and remove the # at the start of the line.

Do this

Add this line


Restart ssh:

Blocking everything with a Firewall

You should allow this to happen once done

apt-get install unattended-upgrades

nano /etc/apt/apt.conf.d/10periodic

Update the file to look like this

We chose “No Configuration”

Test your login

Setting up minecraft

As root:

Get Java

Install screen

Related: What Are Vbos Minecraft – Return The Vbos Option, Please

Create the minecraft folder:

As minecraft user

Your Minecraft server is now all set up.

You can exit out of screen by pressing Ctrl-a followed by d. To reattach screen, type:

You can change the settings of your server by opening up the server properties file:

Some changes we made:

Change the


Spigot is the new craftbukkit. Get it. In order to get it you'll need to install the (docs here) and build it.

Building takes about 10 minutes.

Make a file called ./

Change the mode

Run it




Disease (Byte Disease)

MobCatcher Lite

Download it to ~/Downloads






betonquest (1.8?)

multiverse2 (no)

worldedit (1.8?)

iconomy (very old)

legendary weapons (1.8)

legendary armor (1.8)

enchantplus (1.8)

tardis (1.8)

Protecting your worlds

Prevent griefing




NOTE: CraftBukkit is no longer available

Make the script look like this


To run craftbukkit as your server do:


Edit the and

Technic Platform (Tekkit, Attack of the B-team)

First you need unzip:

Download the server. For us we want an Attack of the B Team server. So we went to the Technic Platform and searched for the modpack. Go there. Once there you can download the server. You'll need to secure copy this to your server:

You might be able to do this directly. But this is how we did it.

Unzip that:

Check that you don't need to change any wtbblue.comerties

Copy over the whitelist:

Edit the launcher to max out at 2GB.

Make the launcher executable:


Setup some rules (see above)

Revenge of the C Team


betonquest bettercrops dynamap multiverse2 citizens worldedit iconomy legendary weapons legendary armor enchantplus

Related: Cool Minecraft builds: the best constructions you need to see

Leave a Comment