DigitalOcean Setup

Today I decided to spend $5 and create a DigitalOcean droplet. I'm actually using this droplet to host this blog using the Ghost platform, among other things. So, the fact that this blog is running at all is more or less a testament to the tutorial (whoa, so meta).

I cover setting up Ghost in a later post.

DigitalOcean offers 'droplets': Lightweight SSD-based machines, with a number of both one-click and in-depth configurations and options. You can pretty much do anything with a droplet, from creating a blog (hey there), running a LAMP/LEMP web server, rolling your own VPN, and everything in between.

Plus, their documentation and tutorials are mind-bogglingly awesome and cover nearly every topic you could imagine when setting up any kind of server, from the very basics of DNS to how to properly use git branching models.

I'll go through the steps to create a DigitalOcean droplet step-by-step, although in reality it is a pretty foolproof process.

I'll also cover setting up a hostname to address the droplet with the amazing (and free) service yDNS

My DigitalOcean droplet tech specs:

  • 512 MB of RAM
  • 1 CPU
  • 20 GB of SSD storage
  • Ubuntu 14.04 x64

Note: You will configure these when you set up your droplet.

Create an Account

This one is pretty straightforward... Create an account at DigitalOcean and fill in your credit card info. The most affordable plan is $5, so that's the one I chose - I'm currently broke.

Create a Droplet

Now just click on Create Droplet and fill in your desired hostname. Note that this does not have to be the same as your domain name.

Next, select the plan you want. You can find help on choosing the right server and plan here.

For the region selection you should choose the region physically closest to you, unless you want the machine to be located in a specific place for some reason.

Region

Now select the desired distribution. I chose 64-bit Ubuntu 14.04. There are a number of distributions to choose from, and you can select the version and architecture (32-bit or 64-bit) for each one.

Distro

You can also select the Applications tab and select from a myriad of one-click applications. Most of them will run fine on the $5 plan, but some (like a GitLab server) require the $10 plan. If you want to run a Ghost blog, for example, you can either select the base Ubuntu 14.04 x64 image from the Distributions tab, or you can choose an image with it pre-installed by selecting the Applications tab and selecting Ghost, which is what I ultimately did.

Applications

Configure any additional settings:

I left them all unchecked.

Additional Settings

You should be using SSH to log into your droplet. You can add a key now, or you can also add one later under the Security item in your account settings.

SSH

Aaaand if everything looks good, go ahead and click Create Droplet and you're done with the creation step!

After about a minute you will be taken to a page that looks something like this:

IP

Copy the IP address in the top left corner. This is the address you will use to SSH into your droplet and to assign a host name (next) or domain name to it.

Create a Hostname for Your Droplet with yDNS

I always like to create a intermediary hostname for my servers, rather than just using the IP address, even though I'm eventually going to point a final domain name to it.

There is a truly awesome and free service called yDNS that makes this incredibly easy to do.

Just create an account through yDNS and then click on Create Host

Create Host

Then enter your details. The hostname followed by the domain will be the actual name you will use to refer to your server address. The actual domain name has no impact on anything, so just choose your favourite.

In this example I used my hostname, microamps, the domain I chose, .ynds.eu, and a fake IP, 12.12.12.12.

Enter in your info, and change the TTL if you want. The TTL is just how long the DNS packet is considered valid for when cached. Browsers will cache DNS packets so they don't constantly check for changing records every time you request content from the same host.

Configure yDNS

Click Create Host, and then you can see your hosts on the main page:

Hosts

Make sure the type A record (IPv4) matches your configuration for the hostname and IP address.

Note: A great thing about yDNS is that they have a bash updater script that you can run as a cronjob to always keep the IP up-to-date. This is especially nice when, like me, you run a RaspberryPi on your home network, whose IP constantly changes.

I can now refer to my server (via ssh and using a web browser) as:

microamps.ydns.eu  

Configuring Ubuntu on the Droplet

There's not much extra for me to write here. I basically followed the following guides by DigitalOcean, which cover most everything. Additional packages I installed are discussed next.

Additional Packages

git

As Dennis from It's Always Sunny in Philadelphia so eloquently put it:

'You got got. Guys like us - we don't get got. We go get.'

No, that has absolutely nothing to do with git, but here's how to install and configure it:

sudo apt-get update  
sudo apt-get install git  
git config --global user.name "Your Name"  
git config --global user.email "[email protected]"  
emacs

Super simple (like most things with apt-get...):

sudo apt-get update  
sudo apt-get install emacs