Installing Ruby, Rails and MySQL without RVM on Ubuntu

Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp

The best way to install Ruby is by using RVM but those who don’t want to install RVM; this guide may be helpful for them. Installing Ruby without RVM is also easy process. You can directly install it from the apt Using the command:

sudo apt-get install ruby1.9.2-full

We can mention any version of Ruby that we want to install and the version will be installed for us. Sometimes apt not provides us with the installation of Ruby because the version we want to install is not available there. In that situation we can install it through another way. The step by step process is given below to install Ruby.

First we need to install git-core and curl that are required to install Ruby. We will use this command:

sudo apt-get install ruby1.9.2-full

Next we are going to install the other dependencies too. We will install all the packages we need to install Ruby. Here is the command to install the packages we need: 

sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-devlibsqlite3-0 libsqlite3-dev sqlite3  libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev

This command will install build-essential, openssl, sqlite and other packages that we will be needed working on rails application development.

Now we need to download our required version of Ruby. Here I am going to install the version 1.9.2 using the command: 

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz

After downloading the file we need to extract the file, make it and then we will install it using the commands:

tar -zxvf ruby1.9.2-p180.tar.gz
cd ruby1.9.2-p180
./configure
make
sudo make install

The installation of Ruby 1.9.2 is complete now.

Rails

As we installed Ruby successfully, now we are going to install rails. Rails can be installed with this simple command:

gem install rails -v 3.0.10

If you are not installing it in your home directory then don’t forget using the sudo. The above command will install rails and other gems with it.

MySQL

After the installation of rails is completed we will move ahead to install MySQL in our machine. Before installing the MySQL gem, we will install the libmysqlclient-dev packages. We will use the command:

sudo apt-get install mysql-server mysql-client libmysql-ruby libmysqlclient-dev

After this command we will install MySQL gem using the command:

sudo gem install mysql

Here our installation completes. I will not recommend you to use this method of Rails installation because using the RVM is the best way to install rails.