About an year back, I had posted in depth about my love for Ruby, and how I set up my Linux box on Ubuntu 10.10, including how to set up Ruby on Rails in that environment.
Since I had written that previous post in such detail, I will just jot down the steps in this one. This is more for my reference, but may be it will be of use to someone as well. Also, that post came in quite handy during the current setup and so I hope I would refer back to this one as well in future.
I was on Ubuntu 10.10, whose support came to an end during April and I was looking forward to the final release version of 12.04 ever since.
Now, there were only two ways to upgrade – from 10.10 to 11.04, then to 11.10, and finally to 12.04. Or, take backups, take a deep breath, and wipe your disk clean and install 12.04. I chose the later path since the former sounded a terrible idea. Also, interestingly had I been on 10.10 (another LTS version), I could have directly upgraded to 12.04 (which is again an LTS version). So, a good lesson learned there – I will think twice before upgrading to non-LTS versions from here on.
So, here I had a blank machine one more time, and this time too I decided to jot down the things I had to do to get the machine to a state that I would be happy about. I am a bit finicky about things like colors and fonts.
Compared to the 10.10 days, there are some changes - some of the apps now come pre-installed (Firefox 12.0) or is no longer supported on Linux (Picasa)
So, once the OS is installed, here are the things I did:
Basic Machine Set Up
A. Installing my favorite fonts
Inconsolata-dz, an even better looking Inconsolata
Inconsolata-g, another derivative of Inconsolata though I prefer the dz version more.
Droid family of fonts, designed by Google for Android phones
Another brilliant monospace font that has caught my attention off late is Meslo (based on the Menlo font that the latest versions of Mac use), created by Andre Berg. The beauty of these fonts (and of course of the original Mac Monaco) is that they are very legible at small font sizes. Also, it is more compact (width-wise) at the same point size compared to say, Inconsolata. I use Meslo Medium at 9 points these days. You can download it from the Meslo github page. I haven’t changed the references in this post from Inconsolata to Meslo, however.
B. Configure gEdit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
C. Configure Nautilus
1 2 3 4 5
D. Configure Terminal
1 2 3
E. Install Chrome Dev Channel
Thankfully Chrome remembers all my settings and plugins and so this was pretty hassle free. The only setting I remembered doing was to set the font to Droid.
Of course, Chrome doesn’t remember any userscripts that you installed, and so I had to reinsall the following userscripts:
F. Install aptitude
This would come in handy to install stuff that needs aptitude rather than the default apt-get package manager.
G. Install Pinta (equivalent of Paint.net)
I am someone who takes a number of screenshots in a month for various things, and so not having the equivalent of Paint.net is not acceptable. I usually crop the screenshots and so I need a decent, basic editor. Enter Pinta
1 2 3
H. Configure Reliance NetConnect
Unfortunately, my Reliance Netconnect just doesn’t work with the out-of-the-box method (of adding a new mobile network connection), and what works is the steps outlined by Harbhag at his blog: Reliance Netconnect Broadband+ on Ubuntu
I. Further tips and tricks to customize Ubuntu
J. Install “Open Terminal [Command-Prompt] Here”
This allows you to open a terminal from any path in the file manager Nautilus, and for me it is an indispensable tool. From this SuperUser thread:
K. Install tmux
Tmux is a terminal multiplexer and ensures that every time I open it I have all the windows I need (multiple terminals, rails server, rails console, rails db server and so on) are up and running.
Since the apt-get repository had an old version, I downloaded and compiled the source. But the above should get you started.
Of course, to make it even more easier, I use the Tmuxinator gem as well:
L. Install the indicator-weather applet
M. Install Ack, which is of course better than grep
N. Install Kazam for recoring videos for screencasts.
O. Install xsane for the scanner
P. Install VLC player
Q. Install lo-menubar to make LibreOffice play nicely with Unity
R. Install Nautilus Image converter to have a quick option to resize images from Nautilus
S. Install xclip to use the clipboard from the commandline
T. Install ImageMagick
1 2 3
U. Install Exuberant Ctags (for Vim)
V. Install MyUnity to tweak Ubuntu.
The best part for me is that I can easily tweak the unity launcher bar from this.
W. Install Ubuntu Tweak to tweak Ubuntu.
Can be downloaded from http://ubuntu-tweak.com/
X. Install Compiz Config Settings Manager
This allows me to continue to use the Super(Windows key)+N combination to invert the monitor colors - an indispensable tool for reading using the browser.
Y. Install AmbianceOneiric theme
I prefer the all dark provided by AmbianceOneiric theme compared to light+dark menus of the default theme.
Download from the github repo.
Z. Change the keyboard shortcut to open the HUD.
I find the default mapping of the [left] Alt key to open the HUD highly irritating, as whenever I press Alt+tab or Alt+LeftArrow (in the browser to go to the previous page), the system would promptly open the HUD. I have to press Escape to close it and get the focus back on whatever window I wanted to access.
Go to System settings | Keyboard | Shortcuts tab. The entry “Key to show the HUD” should have the shortcut listed as “Alt L”. Click that row and press the right Alt key to get the row to display the new keyboard shortcut as “Alt R”. Peace of mind guaranteed. Of course, I do use HUD a lot, including to shut down the device, but I prefer to pay the extra penalty of clicking the right Alt key to invoke it.
AA. Remap Caps Lock to act as Control key
I wasn’t aware till recently that the editors like emacs make heavy use of the hard to reach Control key for virutally every shortcut not because it was designed by people who didn’t care, but because before the advent of x86 hardware, all keyboards had the Caps and Control keys swapped. Which means their decision (taken before the x86 days) to use the Control key makes a lot of sense. Luckily it is pretty easy to remap the Caps Lock to act as the Control key. Though it will take a little while for the change to sink in, after a week or so it would be pretty difficult to live without it!
AB. Replace gedit with vim as the default editor
One of the things I missed after upgrading 12.04 was the default availability of vim as an option when you right click a file to choose an application to open it with. Luckily the fix is simple and consists of two steps - (a) create a vim.desktop file to ensure vim is listed as an application when you right click (you would have to use “Open with Other Application” the first time to select vim from the list of available applications, and vim will be listed there only if the vim.desktop file is around) and (b) replace gedit with vim throughout the system as the default editor.
AC. Disable F1 in terminal vim
One of the problems I face using vim is that I keep hitting F1 instead of the Esc key, and that means closing the Help window that pops up every now and then. The fix is simple - disable the keyboard shortcut for Help. Refer this post for more.
AD. Get rid of the envelop icon in the system tray
For about a year I have been living with the never used envelop icon in the top menu corner. Follow the instructions from this post to get rid of it and a bit of unnecessary apps from the system including Empathy and Thunderbird.
AE. Configure Terminal to always open maximized
Since I work in terminal vim, it is important that when I press Ctrl+Alt+T, the terminal opens in the maximized state. Follow the instruction found here to use Compiz to open all the windows in maximized state.
AF. Bring back Hibernate
Hibernate has been disabled by default in 12.04 (since Hibernate was not working consistently across hardware) but we can bring it back easily. Follow the instructions found in this Ubuntu help post.
AG. Install Opera
There are some quirky Indian sites that works only with IE. For instance the payment page of Fame Cinemas simply refuses to work in either Chrome or Firefox, but it works in Opera! So having Opera in the system can help you at times. Install Opera following the instructions in this page.
AH. Install Skype
Though I am a huge fan of the simple and elegant Gmail chat, from time to time, I find myself talking to people who prefer to be on Skype. So having Skype on the box is pretty useful. It is better not to install Skype from the official download page and instead use the repos. To install using the repo, follow the instructions at this page.
Developer tools Setup
A. Install LAMP
Install following instructions at Installing LAMP on Ubuntu 12.04 Precise Pangolin. Like last time, I stopped short of installing the phpAdmin software that is mentioned at the end of that post.
B. Install vim
I have become a big fan of terminal vim over the last year, and this time decided to compile and install vim with ruby support. I followed the steps outlined in this post, including installing mercurial to clone the vim source code. Of course I used Ruby 1.9.3 on Ubuntu 12.04, but other than that the steps outlined in that post works. Of course, I still can’t get Command-T to work on my box, and that is something I will have to check one of these days.
I ended up installing version 7.3.509, which was the latest version available while I was installing.
For Vim plugin management, this time I decided to do away with my manual style, and was almost going to use the highly rated Pathogen plugin. But googling revelaed an even simpler (dare I say better) way of doing that using Vundle.
Of course, to install terminal vim using the package manager, use
Note: From here on, the installation process was done based on a bunch of resources:
C. Install git
D. Set up tab completion for git
I had backed up the file “contrib/completion/git-completion.bash” and so this was pretty painless - I just had to copy the file into my home (~) folder.
1 2 3 4 5 6 7 8 9 10
If you don’t have that file, you might have to download the latest git source. Please refer my previous installation post for more on this.
Also, if you use bash aliases (for instance, type g instead of git and so on), then the default autocomplete won’t work unless you type “git” in full. This can be pretty irritating if you are like me who use git many times a day and expect “g co”, “g bd” and “g m” to have auto completion available to select the branch. By the way, in case you are wondering, those are the alias shortcuts for checking out an existing branch, deleting a branch and merging a branch respectively.
In order to get bash alias and bash autocomplete to work with each other follow the instructions found here.
E. Install curl
F. Install Ruby Version Manager (RVM)
Refer the RVM installation page and follow along.
G. Install Ruby
Create the required rvm gemsets as per your requirement.
H. Install the latest version of Rails
To complete the set up of Rails development environment along with the required test setup and deployment (using heroku) environment, refer to the excellent Ruby on Rails Tutorial, chapters 1 and 3. Chapter 2 is about using scaffold to create a sample app, and doesn’t add any value towards our current goal: setting up the environments.
I. Install the databases
If you had followed along from the top (referring to the different sources, you would have already installed both mysql and sqlite3). If you haven’t, please refer the “Databases” step of this post.
For me, what is left to do is to install postgresql
1 2 3
Of course, you would then have to then try to log into the postgresql db server, create the required users/roles etc. Refer this post to install and set up postgresql.
J. Install node
Since the package repository is not kept upto date, it is always better to install node from the source on a Ubuntu box. Refer the excellent gist: install node and npm without having to sudo for instructions. I prefer cloning the git repo method, and one can safely ignore line numbers 15-18 that is for installing npm. This is so since npm is bundled along with node that we installed following line numbers 1-14 of that gist.
My ideas about what constitutes preferred configuration is bound to change over time, and so would the tools required to do the job. If I come across something great, I will try to update this post with that info.
Thanks for reading and I hope at least some of it would have been useful for you.
Update# 2 - Mon, 21-May-12: Changed the pinta ppa to point to the correct one, changed reference to the package libmagick to imagemagick, moved items K-Z to the more appropriate top section, added info about AmbianceOneiric theme and changing the HUD keyboard shortcut, added reference to Meslo and mapping the Caps Lock to act as the Control key. Added a note about installing node.js.