There are a lot of posts out there to install Ruby on Rails in Linux and Windows which are not clear explained. The reason is that latest version of Ruby and Gem are causing some issues due to which we are not able to use Rails. So I have given simple steps to install Ruby on Rails in Ubuntu Linux.
- Install Ruby – sudo apt-get install ruby
- Use ruby -v to check for the version you are using.
- Configure system to use the Ruby version 1.9 – sudo update-alternatives –config ruby. Select which version to use.
- Install rubygem – sudo apt-get install rubygems
- Configure system to use the gem version 1.9- sudo update-alternatives –config gem. Select which version to use.
- Install Rails – sudo apt-get install rails
- MYSQL & Apache will be installed by default. If it is not installed use the following command to install it.
- Install MYSQL – sudo apt-get install mysql-server
- Install Nodejs – sudo apt-get install nodejs
- To install mysql2 gem, you need to install the following sudo apt-get install libmysql-ruby libmysqlclient-dev
- Check whether Rails is working – rails new app1
- Start the app – rails server inside app1 folder.
Note: This setup was tested in Ubuntu 12.04 LTS.