Setup Postgresql and Its Libraries to Work With Rails

Recently lot of people have been asking me why they are not able to install the pg (PostgreSQL) gem even after installing PostgreSQL server in their system?

Well the answer is simple, the pg gem, requires the PostgreSQL development libraries to build native extensions to communicate with the PostgreSQL server. Native extensions refer to building ruby extensions or wrappers for existing C or C++ library.

One can install the development libraries of PostgreSQL by installing the libpg-dev package.

Install Ruby via Source Ubuntu

This blog post is for old style programmer who wish to install ruby via compiling the source code, like how I do it. This blog post is written in a just to know basis.

The source code of ruby can be downloaded from ruby’s official website

Dependency for Ruby and Ruby on Rails : libreadline, libyaml, libxml, libssl, zlib1g.

In ubuntu you can have these libraries installed via the command line ( or if you are so old fashion you may google and find the source code for these packages as well)