While I tend towards mainly Ubuntu 14.04 LTS (Trusty Tahr) as my core Linux derivative, it is time to move on to the 15.x stream and embrace the Ubuntu 15.04 (Vivid Vervet) for the next bunch of work I’ll be doing.

A common practice is that I run the installation and then do an apt-get update to make sure I’ve got the latest goodness from the source repository. If you’ve tried this after doing a CD or ISO install of Vivid Vervet, you will discover that it leaves the CD-ROM as an apt source.

This is what the process will look like out of the box:

This leaves you with that sad, can’t be updated feeling. Nobody likes that feeling.

Removing the CD-ROM apt source with sed

Because I’m fundamentally lazy, I decided that the process of using nano to edit the /etc/apt/sources.list file is a few too many steps. Plus, I’m a vim lover, but it isn’t installed and can’t be because of the apt source issue.

Note: I also recognize that true laziness would mean using Vagrant, but there are times when an ISO install happen, so I wanted to share this 🙂

Sed is a great little tool baked into Linux, so let’s just do the process using sed and the one-liner as follows:

sudo sed -i 's/deb cdrom/#deb cdrom/g' /etc/apt/sources.list

That just means that we stream the /etc/apt/sources.list file and replace the instances of deb cdrom with #deb cdrom which turns it into a comment line in the file.

There is a comment line in the sources.list file which will get an extra hash in front of it, but I’m doing this rather quick and dirty.

Once we run that command we can now run the apt-get update again now and it looks much better: