Install Ubuntu 14.04 from cloud image
This guide will show you how to:
- Extract Ubuntu 14.04 from the official cloud images onto your VPS
- Configure cloud-init, so you can log in to the booted Ubuntu instance
As of the date this guide was written, Prgmr does not offer an Ubuntu 14.04 image, so this is probably the easiest way to get up and running with a fresh install of 14.04.
32- vs 64-bit
The author of this guide could not get an Ubuntu 14.04 64-bit kernel to boot on Prgmr (specifically the wemyss server). Hopefully this will change, but in the meanwhile, this guide assumes you are performing a 32-bit install.
Alternatively, as a workaround to boot 64-bit Ubuntu 14.04, I have had luck replacing the latest Ubuntu kernel with the kernel from saucy or earlier versions.
Wipe the system
Since we are extracting from an image, you'll want to start from a clean slate.
CentOS rescue (2.6.18-92.el5xen)from GRUB
- Wipe the filesystem:
mkfs.ext3 -L cloudimg-rootfs /dev/xvda1
- Mount the new filesystem:
mount -n /dev/xvda1 /mnt
Extract the cloud image
Download the cloud image to /mnt:
cd /mnt imageurl=http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-i386.tar.gz wget -qO - "$imageurl" | tar xzf - trusty-server-cloudimg-i386.img
Next, extract the image:
mkdir /tmp/trusty-server-cloudimg-i386 mount -o loop,ro trusty-server-cloudimg-i386.img /tmp/trusty-server-cloudimg-i386 cp -a /tmp/trusty-server-cloudimg-i386/* . rm -f trusty-server-cloudimg-i386.img # optional cleanup
To get the system to boot, update menu.lst to point to /dev/xvda1 instead of /dev/xvda:
sed -i '/^##/ !s/(hd0)/(hd0,0)/' /mnt/boot/grub/menu.lst
To get cloud-init to initialize the system on first-boot, we need to create two files (meta-data and user-data).
Create the first file, /mnt/var/lib/cloud/seed/nocloud/meta-data, with the contents:
instance-id: SERVER_NAME local-hostname: SERVER_FQDNS_NAME
(Replace SERVER_NAME and SERVER_FQDNS_NAME with the actual values you want to use.)
Create the second file, /mnt/var/lib/cloud/seed/nocloud/user-data, with the contents:
#cloud-config ssh_authorized_keys: - ecdsa-sha2-nistp256 AAAA… user@host
Important: replace ecdsa-sha2-nistp256 … with your public key (from $HOME/.ssh/id_ecdsa.pub or from $HOME/.ssh/id_rsa.pub or whichever public key you want), otherwise you will not be able to log in.
Boot the instance
Reboot your VPS. The new Ubuntu instance should start automatically. cloud-init will run on the first-boot based on the configuration you supplied in the previous step.
Once it is finished booting, you can SSH in to the instance with the ubuntu user:
No password is configured — you must authenticate with the ssh key that you listed in the user-data file.
It appears that cloud-init does not enable shell access over the console. This is unfortunate, as it makes it more difficult to regain access to the VPS if for some reason SSH stops working.