Some notes about Digital Ocean servers

I’ve been unhappy with my current website host. My old hosting company, Verio, sold part of its webhosting business (including my websites) to another company. Verio used to provide php by default. The new host does not. I decided to try out another cloud provider, Digital Ocean, to see what they can provide.

I spent a while reviewing their help pages to prepare myself for surprises. I spent enough time on their documents site that they gave me a $10 credit when I set up a new account. Eventually, I set up an account with them and received the credit. Click on the link above to get your own $10 credit. (I’ll get some credit, too.)

Setting up a droplet is just as described in their setup page. It’s almost exactly the same. Digital Ocean provides more machine size options ($320/month and above) for monster machines with dedicated CPUs and/or high RAM requirements. I don’t need that. I want a small Ubuntu machine that I can use to hold the domain names that I have and don’t use.

I like their suggestion to use public/private keys. I did not realize that each machine should use exactly one key pair. I had set up key pairs for Bitbucket, Github and now Digital Ocean. I was unable to log in automatically with the key pair until I replaced the public key with the default public key I created on my machines a long time ago. I still set up a password for the non-root account. I still have to key it in for ‘sudo’ stuff, which is annoying, but login works automatically and well.

I decided to follow their instructions for setting up a server firewall. I’m not familiar with IP tables and Digital Ocean recommends using ufw. I followed their instructions and discovered that new terminal windows were not logging in automatically with ssh. It kept timing out for some reason. I rolled back my ufw changes, but I still had trouble with logins. I sent in a help ticket and received some additional instructions that look like they work. They have so far, so that’s good.

I continued setting up the server. Apache installed without trouble, even though they recommend Nginx. (I don’t know Nginx yet.) I skipped MySQL because I did not need it for a placeholder / testing site. I followed their instructions for installing PHP and … discovered that Ubuntu 16.04 does not have default repositories for PHP5. It has repos for PHP7. I had to add an additional repo for the PHP 5 files. Not a big deal, once I knew what was going on. Finally, I have PHP5 installed on the placeholder site. For a placeholder site, I like it.

Fixing an Ubuntu update issue

I started having problems with Ubuntu updates. I noticed them at the beginning of the year. At first, the message that appeared was a notice about lack of space. A notice appearing after failed upgrades also described possible issues and fixes. I ran the suggested commands, *>sudo apt-get install -f” and “sudo apt-get clean”, but the error was not resolved.

I was unsure if the problem had to do with the lack of space needed to unpack the updates. “sudo apt-get autoremove” did not resolve the space issue. I focused on adding extra space the Ubuntu VM, described here. Once that was completed, I tried the suggested commands, but still had the same issues and errors. The error displayed read something like this:

> dpkg: error processing linus-headers – generic (~configure)
> linux-generic depends on linux-image-generic (3.2.0.59.70)
> however version of linux-generic in system is 3.2.0.60.70

I ran the suggested commands

> sudo apt-get purge linux-generic
> sudo apt-get install –reinstall linux-generic

I believe the idea is to remove the linux-generic version that is causing the issue. However, after running these commands, I still had the same message appearing. Running

> sudo apt-get clean
> sudo apt-get auto remove

did nothing new. I considered running dpkg, but dpkg won’t install dependencies that apt-get will, so I left dpkg alone.

After some more google searches, I ran across something that did work:

> sudo apt-get remove linux-image-generic linux-generic linux-headers-generic

As I understand it, this removes these items from the software waiting to be updated without removing configuration files.

> sudo apt-get -f install
> sudo apt-get auto remove

loaded the proper versions of the missing files and the Ubuntu updates have been running fine since.

Yes to Gparted, but still having trouble

It turns out the /home directories in my Ubuntu VM were too small to transfer over to a separate partition. I ran “Disk Usage Manager” (I think) and discovered that one of my main directories (/usr or /lib) was using almost all the free space available. It was a good idea to use VBoxManager to boost the space available for the hard drive in the VM. However, GParted does not allow modification of the partition it’s running on.

I realized I had to run a GParted Live CD on the VM. I found the .iso file and left it on the desktop. I had to modify the VM settings to read the .iso file first when booting. Once I figured that out, I was able to run the GParted Live CD. I was still having trouble reordering the partitions of the Ubuntu VMs.

It turns out that the extra space was added at the end of the Linux swap partition, as separate unallocated space. Eventually, a Google search helped me realize that I needed to move the Linux swap space to the far end of the unallocated partition, then extend the “boot” partition over to fill the remaining space. (It’s weird. Why not just one command instead of two separate actions?) I reshuffled the partition space, rebooted and Ubuntu started again with the full 16 GB partitions correctly.

Unfortunately, I’m still having trouble with Ubuntu updates. I can finally run them without running out of free space, but I have a configuration problem where a linux-generic update depends on another file that is not loaded and that file won’t load because it’s not needed. More on that later.

Keep running out of space on VMs

I think I need to add more space to a VirtualBox VM loaded on one of my machines. I’m unable to load the Ubuntu updates any more. One of the error messages implies I’ve run out of free space. The VM needs more space any way, and I’ll need to remember how to bump up the VM size for another machine, so I should relearn how to do this.

I think what I need to do is this:

  • bump up the space using VirtualBox
  • use Gparted (Ubuntu desktop app) to create a new partition in that extra space
  • move the home directories to the new partition.
  • Get rid of the extra temp space and clean up

I’ve done this before about a year ago. My notes from them imply that I should not use the VirtualBox desktop app to add more memory to the virtual hard drive. My notes show the command line commands I entered to get everything to line up correctly. I don’t remember why the desktop app did not work, so I’ll try the command line.

For GParted, I found two web pages that describe that to do, one on site point ( http://www.sitepoint.com/ubuntu-12-04-lts-precise-pangolin-using-gparted-to-partition-a-hard-disk/ ) and another one on the Ubuntu help pages ( https://help.ubuntu.com/community/HowtoPartition/PartitioningBasics ). I’ll have to review them again to make sure I don’t get any surprises.

Once I’m through with GParted, I’ll follow along with this page in the Ubuntu help pages (https://help.ubuntu.com/community/Partitioning/Home/Moving) to finish. I remember this page before. The instructions are simple to follow and I understand what is being done at each step. I don’t expect any trouble from this point, but you never know. More news later.