teaching machines

CS 347: Digital Ocean Setup

August 26, 2021 by . Filed under fall-2021, specifications, webdev.

Your projects and blog will be hosted on a web server that really lives on the web. You will set up your server with Digital Ocean, a company that hosts virtual machines—which they call droplets. Normally, droplets cost money. Thanks to the GitHub Student Developer Pack, you can get a $100 credit for Digital Ocean. This credit supports 20 months of a $5/month droplet, long enough to get you through the semester without spending a penny.

Follow these steps to get an effectively-free droplet.

GitHub Student Developer Pack

The first step is to claim your free credits from GitHub.

SSH Key

In a moment you will create a new, public-facing virtual machine hosted on Digital Ocean. The default settings for these virtual machines leave them vulnerable to malicious users, and many of my former students have had their machines compromised. Their passwords were likely brute-force cracked. To keep your machines safe, we will take several steps to harden your server. First, we will disable password logins. Instead, users will authenticate via public and private key pairs.

Users of PuTTY on Windows, follow these directions to set up a public and private key. Save both the public and private keys to files that you can find again.

Users of Linux, macOS, or Windows Subsystem for Linux, run the following command in your terminal:

ssh-keygen -t rsa

The public and private keys will be stored in ~/.ssh/id_rsa.pub and ~/.ssh/id_rsa.

Digital Ocean

Now you are ready to create your virtual machine on Digital Ocean.

Be sure to decommission your droplet after the semester is over and before your credit runs out to avoid charges.

SSH

Now you are ready to log in to your new Ubuntu server in the cloud.

Apache

Your next step is to get the web server Apache up and running. While logged in to your droplet, run these commands to install the software:

sudo apt update
sudo apt install apache2

Visit http://YOUR_IP_ADDRESS in your web browser. You should see Apache’s test page.

Whew!