So the first thing you need when you decide to start rails development is a development environment. I personally own a Macbook and while there seems to be this notion that rails developers all use Macs I still haven’t found a tactful way to run a purchase requisition through for one at work. So being stuck with PC hardware the choice was Windows or Linux.
Windows actually can be used to develop rails applications and I did that for a week or two until I got the itch to put Linux to use. Que about a week of lost productivity as I ran through all the distros looking for something I could use daily at work. Surprisingly I was unable to find anything to replace Outlook and since it has become common for people to email me change requests or project ideas I really need a stable communication line with the Exchange server. Yes, I could use the web client but when you’ve used Outlook for years you get used to being notified of new mail and having offline abilities available.
So without a replacement for Outlook easily available, I decided on the next best thing: virtualization. I have a license for VMware Workstation and it does have nice features like dual monitor support but all I need is a quick, light environment to work with. Enter VirtualBox. It’s open source and free to use so I can load it up on my computers at home or at work. I picked XUbuntu for the distribution as it was light on resource usage and still has everything I need to feel at home.
With XUbuntu running on a fresh install the following steps will get you a rails development environment up and running in no time. Since I compile ruby from source I need to install the development libraries and dependencies needed to do that. The following is all one command:
apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libpq-dev
Once apt is done installing you can download the ruby source at http://www.ruby-lang.org/en/downloads/ You’ll want the latest 1.9 source which at this time is 1.9.2 p290.
Extract this to a folder and run the following command:
./configure && make && make install
Once ruby is installed you can check by running:
ruby -v
and it should display the version you downloaded. Now we need to update the rubygems.
gem update --system
This will install the latest version of rubygems on the system. Now we can begin to install the rails environment. Run the following commands:
gem install rakegem install rails
gem install pg
The last one will install the PostgreSQL library which is what I use, you can change it to whatever database you use.
After this I like to do a full update of all the gems.
gem update
This will update all the gems on the system but be aware that this WILL install new versions of rails or any other gems you have loaded if you run this command later.
You should now have a running rails environment ready for you to play with.