You are here:Home » Ruby on Rails » Installing Ruby on Rails on Ubuntu 10.04

Installing Ruby on Rails on Ubuntu 10.04


This is the first tutorial post on Apsotech blog. There are several tutorials available on Internet which guides through Ruby and Rails installation. This post is very particular about installing ruby version  1.9.3p194  and rails version 3.2.13. Lets get started.
Follow the below steps carefully if you get any error in between please solve the issue before going to the next step.

Installing ruby

Download the source file here.
Copy the file to home folder and open terminal, type the command


prathviraj@apsotech:~$tar xvjf ruby-1.9.3-p194.tar.gz 

prathviraj@apsotech:~$cd ruby-1.9.3-p194/


Install dependency
prathviraj@apsotech:~/ruby-1.9.3-p194$sudo apt-get install libyaml-dev

Compile, make and install

prathviraj@apsotech:~/ruby-1.9.3-p194$sudo ./configure
prathviraj@apsotech:~/ruby-1.9.3-p194$sudo make
prathviraj@apsotech:~/ruby-1.9.3-p194$sudo make install 

Now you have installed ruby on your machine. To confirm, check the ruby version

prathviraj@apsotech:~/ruby-1.9.3-p194$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

Rails Installation
Now time to install rails using gem. I am not using apt-get repository for rails as it does not provide all the packages needed and its not up to date, instead I am using gem repository which is directly backed by ruby repository.


Install curl
prathviraj@apsotech:~$sudo apt-get install curl


Now download gem
prathviraj@apsotech:~/ruby-1.9.3-p194$sudo curl -L https://get.rvm.io | bash -s stable --ruby -V
To install rails just type
prathviraj@apsotech:~/ruby-1.9.3-p194$sudo gem install rails 
It may take some time depending on your Internet speed.
After completion check your rails version 
prathviraj@apsotech:~/ruby-1.9.3-p194$ rails -v
Rails 3.2.13

Now create a project. I would suggest you to do it inside home directory
prathviraj@apsotech:~$ rails new projectname -d mysql 
prathviraj@apsotech:~$ cd projectname/

Now download all necessary gem files here 
Extract the cache.zip file and place it inside directory ~/projectname/vendor/


Before going ahead, you need to install some dependecies for mysql2 gem. Type
prathviraj@apsotech:~/projectname$ sudo apt-get install mysql-client libmysqlclient-dev

Install all the gem files
prathviraj@apsotech:~/projectname$ bundle install --local 

Congratulations!! If you are lucky enough to go through all the installation steps.

0 comments:

Post a Comment