Setup PostgreSQL and its libraries to work with rails


Bookmark and Share

Recently lot of poeple have been asking me why they are not able to install the pg ( postgresql) gem even after install 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 exisiting C or C++ library.

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

The command below would install the last version of PostgreSQL available in the repository and its development libraries.

Ubuntu:

CentOS / RedHat

Trying gem install pg, should install everything smootly..

Happy Coding.. 🙂

Read More

How to install ruby via source in Ubuntu


Bookmark and Share

Hi there

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 http://www.ruby-lang.org/en/downloads/.

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)

After installing the dependency download the source code and extract it ( please not the installation will proceed if you miss some of the dependencies but missing then would make gem, bundle, irb to not function properly).

First extarct the code :

the configure the source code

the finally you make and install

To check if ruby is install you can use the command

or try out interactive ruby (irb)

Now for those who are wondering how to install the latest version of rails, use the command:

Read More