Here is a quick how-to on setting up a brand new Ubuntu VM and adding a web server. Ubuntu is the most popular open source OS for cloud deployments.
Plenty of cloud providers offer ready-made Ubuntu images. That's no surprise. Ubuntu is the most popular open-source operating system for cloud deployments. There are more virtual machines running the Ubuntu OS than any other because it's free, it's the reference OS for OpenStack, and you can rely on help for the LTS (Long Term Support) version for five years. For that reason, it's a good idea to be familiar with the basic setup.
A brand new basic Ubuntu machine needs a little care and attention to get it up to scratch - for instance, it has no web server. A little CLI (Command Line Interface) work will do the trick. These commands upgrade your system and install a web server, and are pretty much the same no matter which IaaS provider you've chosen. The commands also produce a huge amount of feedback - hundreds of lines of abbreviated text.
Open a CLI on your new Ubuntu VM.
You must type a few commands in using the CLI.
- Find the public IP address of your new VM, such as 188.8.131.52.
- Open an SSH client. It doesn't matter which one - you may be using PuTTY on a Windows OS or OpenSSH on a Mac.
- Connect and log in.
The Connect and log in procedure varies between cloud providers.
The first time you connect using SSH you see an RSA key fingerprint, which is an obscure list of characters like this: 23:fd:82:c1:3e:5a:66:fc:97:37:36:29:67:3b:5b:c1. You should check this fingerprint against the new machine's RSA key fingerprint to make sure they match, but most people just skip this security check. If you want to do things properly, you will find the machine's fingerprint buried somewhere in the console output. AWS let you get at the console output using their control panel, but it does take some digging.
Upgrade your system and install a web server
Use the APT (Advanced Package Tool) by running these apt-get commands. You have to run these commands using the root account. In Ubuntu, that means sticking the sudo command in front.
- Get a new list of security updates:
sudo apt-get updateYour new VM's OS talks to the Ubuntu servers and updates its list of packages. The machine may be brand new, but the image it was built from is months out of date.
- Install the security updates:
sudo apt-get upgradeAll the old packages are upgraded. Security upgrades are downloaded from Ubuntu to your VM and installed. Ugrading 100 packages may take 10 minutes.
- Install a web server:
apt-get install apache2The Apache web server is downloaded, installed, and run.
Restart your machine (if you have 5 minutes)
Linux does not usually need rebooting, but if a system package is upgraded (like linux-image-virtual, a kernel package) then unfortunately a restart is required.
You can put off this job for a little while. Your system can't use the updated kernel until you reboot the machine, but it's not urgent and it won't break anything.
sudo rebootYour CLI closes.
- Wait five minutes. That's plenty of time for a VM to shut down and start back up again.
- Open a CLI again.
Put the IP address into your web browser: http://184.108.40.206/. An It works! page appears.
Your machine is now secure and providing a simple customer service. Coming up, I will introduce you to the GoGrid cloud hosting provider and show you how to put this Ubuntu VM to work.