Install Ruby on Rails on Ubuntu

First we need to make sure that the system which we are using is up to date , so for that run the command below
sudo apt-get update

We'll be installing some software that needs to be built so we'll need to get packages required for compiling. With Ubuntu, you can type this single command and get everything you need:

sudo apt-get install build-essential
Once you've got the tools, it's time to install MySQL and Ruby

sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libmysql-ruby1.8 libreadline-ruby1.8 libruby1.8 mysql-client-5.1 mysql-common mysql-server-5.1 rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby libopenssl-ruby1.8 mysql-server-core-5.1 libmysqlclient16 libreadline5 psmisc

If you hadn't previously installed MySQL you'll be asked to set a root password. You don't have to, of course (it will bug you no fewer than 3 times if you opt not to) but I strongly recommend it. You'll need this password when you populate your rails config/database.yml file so be sure not to forget it.

tar xvzf rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby setup.rb
On the command line, type gem -v. if you get this message we need to make some symlinks:

The program 'gem' can be found in the following packages:
 * rubygems1.8
 * rubygems1.9
Try: sudo apt-get install 
-bash: gem: command not found
Let's create those symlinks now:

sudo ln -s /usr/bin/gem1.8 /usr/local/bin/gem
sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby
sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc
sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri
sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb
Other Libraries installation
sudo apt-get install libc6 libpcre3 libpcre3-dev libpcrecpp0 libssl0.9.8 libssl-dev zlib1g zlib1g-dev lsb-base

Rails Installation
sudo gem install rails

Specific Version installation of Rails
sudo gem install rails -v=2.3.11

You do not need to add sudo if you are using RVM.

Mysql Gem Installation

sudo apt-get install libmysqlclient-dev
sudo gem install mysql --no-rdoc --no-ri


Popular posts from this blog

Inserting and Moving elements inside Ruby Array

Difference between Validations, Callbacks and Observers