Setting up a development machine with Ubuntu 14.04 (Trusty Tahr)

Written by Erika Heidi on Tuesday April 22, 2014 - Permalink - Categories: DevOps, Linux - Tags: ubuntu, installation, development, environment - Lang: eng

Ubuntu finally released its new LTS (long term support) version, 14.04 - Trusty Tahr. In this post, I tried to list all the steps I performed to set up my working machine with a fresh Ubuntu 14.04 install. The motivation for this post came from all ~bullying~ I get for not being a OSX / Mac user, when apparently all my dev friends have a Mac =P

TL;DR: Ubuntu is really cool, SPECIALLY for developers. This is how I setup my environment, step-by-step (sort of).

Why I don't want a Mac

I had the experience of working with a Mac for 6 months, last year. I also owned an Ipod Touch for some time, years ago. In both cases, I had always the feeling that I was not in control, and some things would just not work as they were supposed to. Like the Bluetooth. Non-standard connectors also made me hate Apple products. I don' t want to use a freaking adaptor for everything! 

Macs are beautiful, elegant, they have an excellent hardware, but I like freedom. That's why I don't plan to have a Mac anytime soon. I rather get a more powerful PC with the money I would expend to get a Mac.

What about the softwares?

Not everything will run on Linux, I know that. I like to use Adobe Fireworks for image edition, and I can't have it on Linux. But I use VirtualBox for these situations - I always have a Windows VM for that. Rarely used, but still, completely functional. With my 8GB ram memory, I can't tell the difference between the VM and a "real"  Windows installation.

Linux is amazing for web developers

Let's face the facts: if you are a web developer, you are probably using a Linux server for your applications. You need to deal with Linux eventually. When using Linux in a daily basis, as your desktop, you learn a lot and you get used to how it works. It really makes a difference for your work as a developer. You understand much better how things work. OSX gets close, but it's not the real deal.

First things first - fresh Ubuntu 14.04 install

I won't cover the Ubuntu installation, since it is very straightforward. The only thing I would recommend is that you plan ahead your partition schema, as you would do with any other operating system. I always liked to have a separated partition for my data - code, pictures, documents, everything that I really don't want to lose. This makes updating much more easier. Now, for instance, my HD has the following schema:

/dev/sda1                  Swap Partition 
/dev/sda2   /              Linux ext4 - operating system
/dev/sda3   /media/export  Linux ext4 - my data

Each time I reinstall my Ubuntu, I create symbolic links for the main home folders - Documents, Downloads etc. The content is actually kept in the /dev/sda3 partition, the one I won't format when reinstalling. 

The item 2 shows how I add the partition and link the folders - if you don't plan to use this schema, just skip to the next topic ;)

1. Desktop Swag

The very first thing I do with a fresh Ubuntu install is to change some Desktop settings. I like smaller icons in the launcher, and I also prefer to have the launcher with auto-hide (so it won't waste my screen space). You can do these changes in the Appearance settings (System Settings -> Appearance).

And, of course, a translucid terminal is MANDATORY. It looks **beautiful** and, in fact, it's very useful for when you are following some tutorial in the Terminal - no alt+tab needed, just place it on top of the browser window :D. You can adjust the transparency level as much as you want.

* I like around 60% opacity.

2. Mounting and Linking the extra partition (skip if using a different partition model)

2.1 Adding the partition to FSTAB

First, you need to find the correct UUID from the partition you want to add. You can list /dev/disk/by-uuid for finding out.

$ ls -al /dev/disk/by-uuid

It will give you an output similar to this:

lrwxrwxrwx 1 root root  30f42b6f-214f-4e70-bba9-51b7365bdb72 -> ../../sda1
lrwxrwxrwx 1 root root  35593486-5b91-4f17-858b-aa01eb81b7c1 -> ../../sda3
lrwxrwxrwx 1 root root  f1548a74-e2ba-4255-927a-791de7513c68 -> ../../sda2

Now, I know the right UUID - the second in the list (sda3). Using sudo, edit /etc/fstab and add a line like this (naturally you'll need to use your own partition UUID):

UUID=35593486-5b91-4f17-858b-aa01eb81b7c1 /media/export  ext4  defaults  0   2

This will automount the partition in the location /media/export, using the default options. Don't forget to create this directory, and set the right permissions for your user!

$ sudo mkdir /media/export
$ sudo chown -R YOURUSER.YOURGROUP /media/export

To test your settings, run:

$ sudo mount -a

This will mount the partition in /media/export, and from now on it will be automatically mounted each time you restart.

2.2 Linking Home Folders

Now that the partition is mounted, you can proceed to create the symbolic links for your Home folders.

$ rm -rf /home/YOURUSER/Documents

$ ln -s /media/export/Documents /home/YOURUSER/Documents

Repeat the above two steps for the other main Home folders: PicturesVideosMusicDownloads . Then you'll have something like this:

$ ls -l
drwxr-xr-x 2 erika erika 4096 apr 22 16:37 Desktop
lrwxrwxrwx 1 erika erika   23 apr 22 17:11 Documents -> /media/export/Documents
lrwxrwxrwx 1 erika erika   23 apr 22 17:12 Downloads -> /media/export/Downloads
lrwxrwxrwx 1 erika erika   19 apr 22 17:14 Music -> /media/export/Music
lrwxrwxrwx 1 erika erika   22 apr 22 17:12 Pictures -> /media/export/Pictures
drwxr-xr-x 2 erika erika 4096 apr 22 16:37 Public
drwxr-xr-x 2 erika erika 4096 apr 22 16:37 Templates
lrwxrwxrwx 1 erika erika   20 apr 22 17:12 Videos -> /media/export/Videos

Now you have the convenience of the Home shortcuts, but with a practical and permanent location. Whenever you decide to reinstall / update your Ubuntu, in most cases you won't need to make a manual backup.

3. Basic Stuff

Before going any further, we need some basic packages. Vim, to have a decent command line editor, and python-software-properties to easily add ppa repositories. Curl is needed to download some stuff like Composer. And Git... essential :)

$ sudo apt-get update

$ sudo apt-get install vim curl git python-software-properties

3.1 A cool shell: Oh My Zsh!

This is optional, but I really like "Oh My Zsh"  shell. It has many features and looks great (I love the Git repository prompt). To install it, first get ZSH and then use the provided install script.

$ sudo apt-get install zsh

$ curl -L | sh

Now just close and re-open the terminal and it should be working - if not, logout from Ubuntu and login again.

4. Web Server

Although I use Vagrant for most of my projects, I like to have a local web server for smaller projects, (e.g with no database) and also because in this case I can run Composer through my Host machine, which is usually much more faster than running it from inside the VM.

I'm using Nginx with php5-fpm, and I don't plan to go back to Apache ever again. In order to get the newest PHP packages, I use the ppa ondrej/php5.

$ sudo add-apt-repository ppa:ondrej/php5

$ sudo apt-get update

$ sudo apt-get install nginx php5-fpm php5-cli php5-curl

Installing Composer system-wide:

$ curl -sS | php

$ sudo mv composer.phar /usr/bin/composer

5. Vagrant / VirtualBox / Ansible

Now, for Vagrant and its dependencies. I use VirtualBox, and Ansible as provisioner. First we need to download and install both VirtualBox and Vagrant - they have .deb packages available in their offical websites: VirtualBox Downloads | Vagrant Downloads . Just download and install both.

For installing the newest Ansible, I use the ppa rquillo/ansible:

$ sudo add-apt-repository ppa:rquillo/ansible

$ sudo apt-get update

$ sudo apt-get install ansible

In order to make Vagrant work with NFS synced folders on Ubuntu, we need two extra packages:

$ sudo apt-get install nfs-common nfs-kernel-server

ProTip: I use the same approach from my Home folder - linking to separated partition - to keep my "VirtualBox VMs" folder safe, so when I reinstall everything I can just add the VMs from this folder.

4. Oracle JDK/JRE 8 (IDEs)

IDE's are a very personal choice. I really like PhpStorm, from JetBrains. If you plan to use an IDE, you'll probably need the Oracle JDK/JRE . OpenJDK is NOT recommended. 

The simplest way for installing the Oracle JDK/JRE is by using the ppa from webupd8team .

$ sudo add-apt-repository ppa:webupd8team/java

$ sudo apt-get install oracle-java8-installer

$ sudo apt-get install oracle-java8-set-default

This will install Java 8.

5. Other Useful Tools

Google Chrome - this should be in the top of my post since it's one of the first things I install, but I left it here along with the other easily-installable softwares I use. Extensions: AdBlock and Strict Workflow.

Libre Office (comes with Ubuntu) - Libre Office is getting better and better with time. I have to admit that years ago it was quite unstable, but I didn't have any problems recently. I use mostly LibreOffice Impress - for slides. What I love about it is the handy presentation screen showing time, notes and the next slide:

MySQL WorkBench - made me abandon phpmyadmin forever. 

RoboMongo - if you use MongoDB, this is essential, really good app.

ReText - a very simple markdown editor, I use it for writing Vagrant Cookbook.

6. Fun and Leisure

VLC (VideoLAN) - Best Video Player ever.

MyPaint - This is a very complete drawing application, better than many proprietary and expensive softwares out there. It's really cool, I use it with my Wacom Pen & Touch drawing tablet - by the way, the tablet worked really fine with this new Ubuntu, just plug and play for real. With 12.04 I had to install some stuff to make it work.


Yes, you can be a very productive and happy developer using Ubuntu. This is how I setup my Ubuntu, you can use it as an inspiration for your own setup. Cheers!

comments powered by Disqus