Overview

In What is this "Linux", anyhow? we briefly covered a number of options for getting access to a GNU/Linux environment. In this guide, we'll discuss one easy option for experimenting with a small server in the cloud.

What is this "Cloud" Business, Anyway?

Cloud computing has been a tech industry buzzword for years now.  Most industry buzzwords have a way of fizzling out after a while, but "the cloud" has passed into everyday speech as a routine shorthand for the often-nebulous world of networked software and storage. Used this way, it often comes with a certain amount of hand waving and fuzzy thinking, but you can usually dispel that by remembering that "cloud" is a useful shorthand for "happening on other people's computers".

There are gazillions of companies offering different cloud services, in ways that range from the simple to the brain-hurtingly complex.  A lot of the modern internet runs on top of Amazon's datacenters and networks, for example.

DigitalOcean

At $5-10 a month for a server instance, DigitalOcean offers a nice mix of simplicity and reasonable cost. If you'd like to experiment with running a Linux server on the internet, it's a great place to start.

In DigitalOcean terminology, individual servers are called "droplets", and managed by way of a web interface.

Account Setup

First, you'll need an account.  Hit the DigitalOcean home page and click that SIGN UP button.

You'll want to pick a good password here, since access to this account gives root access to the servers you host under it.

Next, check your e-mail for a confirmation message from DigitalOcean, and click the confirmation link inside.

You should then be asked to provide a credit card number to pay for the account.

Droplet Creation

With the bureaucracy taken care of, you're ready to fire up a virtual machine. Click that "Create Droplet" button, and you should see a screen like this one.

The $5/mo option is more than adequate for most purposes, so let's go with that. Next you'll be asked to select which region the droplet should live in - or more exactly, which of several datacenters you'd like to host it in.

It's often advisable to pick something on your continent just to avoid a slow connection to the server. In this case, I went with New York.

Next, you'll be prompted to select an image containing a pre-installed distribution.

Here, I'm going with the latest stable Debian, because that's the most like a Raspberry Pi install of Raspbian. If you're planning to follow along with tutorials in this series, Debian (stable but fairly stale) or Ubuntu (a lot like Debian, but with fresher software and some different design priorities) will usually work well. Other choices are well worth exploring, but keep in mind that there are subtle (or not-so-subtle) differences between the distributions.

There's even an option to use FreeBSD, an operating system that's a direct descendant of the original AT&T Unix codebase. (FreeBSD is well worth exploring in its own right.)

You also have the option to add an SSH key here. Go ahead, if you know what an SSH key is and have one lying around. Otherwise, we'll get into that in a minute.

Lastly, there are a variety of configuration options.  If you're planning to keep this droplet around for a while, you might want to enable backups now, because it's a little trickier if you change your mind later on.

All set? Click the CREATE DROPLET button and see what happens.

Connecting to Your Droplet

By now, you should be looking at something like the following.

If you added an SSH key during the droplet creation process, you're probably already familiar with SSH - just connect directly to the displayed IP address with the username "root".

Otherwise, check your e-mail. You should have a root password waiting.

Connecting to the Console in the Browser

DigitalOcean droplets offer in-browser access to the console. Just click that "Console Access" button and enter "root" for the username, followed by the password from your e-mail.  You'll be immediately prompted to replace this with a password of your own choosing, and then you should find yourself with a shell prompt.

Connecting via SSH from Windows

First, download a copy of PuTTY. You just need putty.exe from that link, to start.

Next, enter [email protected][your ip address] in the "Host Name (or IP address)" field and hit the "Open" button.

Connecting via SSH from OS X or Linux

First, get to a terminal. On the Mac, look for the Terminal in your Applications folder. On Linux, run one of xterm, lxterm, Gnome Terminal, etc. In menus, these can usually be found under "Accessories".

Once you're at a prompt, just invoke SSH like so.

...replacing 192.168.0.5 with your droplet's IP address.

Basic Configuration & Further Reading

Now that you're logged into a working machine, there are a few basics it'd be good to take care of.

First, you should probably add a non-root user. You can do that with adduser yourname, which will interactively prompt you for some info about the new user.

Again, choose a strong password here.

Next, you'll probably want to give this user the ability to use sudo, and disable root logins over SSH.  Start by making sure that sudo is installed.

...then add your new user to the sudoers group. In my case, this looks like:

Download: file
[email protected]:~# addgroup brennen sudo
Adding user `brennen' to group `sudo' ...
Adding user brennen to group sudo
Done.

Finally, tell SSH it shouldn't allow direct root logins any more. Start by opening /etc/ssh/sshd_config in nano.

Download: file
nano /etc/ssh/sshd_config

Next, look for this line:

Download: file
PermitRootLogin yes

And change to:

Download: file
PermitRootLogin no

And finally restart the SSH service:

Download: file
[email protected]:~# service ssh restart
[ ok ] Restarting OpenBSD Secure Shell server: sshd.

Further Reading

With that out of the way, you're ready to explore.

For command line basics, check out our What is the Command Line? and An Illustrated Shell Command Primer.

For general server administration topics, DigitalOcean's community support system is chock full of useful reference material and tutorials.

This guide was first published on Feb 13, 2015. It was last updated on Feb 13, 2015.