Hi there, in this blog i will tell you how to install Ruby on Rails (RoR).Frankly speaking it takes me couple of days to get the things work’s properly, seriously , surfed a lot and finally came across one stop solution. When i was surfing, found number of forums regarding the issues of Ruby on Rails with the mysql gem, thats encouraged me to write this blog.
For the installation of ruby on rails i have preferred railsinstaller.
RailsInstaller has everything you need to hit the ground running. In one easy-to-use installer, you get all the common packages needed for a full Rails stack. Follow the steps carefully
Step 1: Download the railsinstaller package from here.
Step 2:After installing this package u will find a directory by the name RailsInstaller according to the path selected by you during the installation and the menu in the start->All Programs->RailsInstaller…..
Step 3: Click the gitbash submenu in the RailsInstaller menu.A cmd type screen will gets open.
Step 4:check the ruby version by the command “ruby -v” and also the gem version by command “gem -v”. and this installs your ruby successfully along with the gems package.
Step 5:Check the rails version now:”rails -v” but this time you will find an unknown command because you had’nt install rails till now, so you got to do it by running a command “gem install rails” in the gitbash,this takes some time to install the rails. After the installation, again check the rails version and this time you will find the latest rails version.This finishes the installation of ruby on rails.
Step6: Now install the MySql installer verision 5.5.21 from here.You need to made couple of requirements inorder to run this msi package sucessfully one is .NET 4 framework and second Microsoft C++ runtime 2010 32 bit package.
Step 7:After successful installation edit the environmental variables path by appending value “<selected drive>\Program Files\MySQL\MySQL Server 5.5 “.
Step 8:Now moving on to the most difficult part: MySql gem installation:Download the gem package of mysql2 from github (just google it).Copy all the files from the root of the extracted folder.
Step 9:Next move to the path(as per you ruby and gems version’s) “RailsInstaller\Ruby1.9.2\lib\ruby\gems\1.9.1\gems” and create a folder by the name mysql2-<your gems version >, in my case named the folder as mysql2-0.3.11 and place all the copied files here.
Step 10:Now change your directory path to the mysql2 gems folder created above and Build Gem by the command:” gem build mysql2.gemspec “, ignore the warnings for now.
Step 11: Run the command subst x:”<selected drive>\Program Files\MySQL\MySQL Server 5.5 ”
Step 12: Run This Command
gem install mysql2-0.3.11.gem --platform=ruby -- --with-mysql-dir=X: --with-mysql-lib=X:\lib.In the command specify this file mysql2-0.3.11.gem as per mysql2 gems version(refer step 9) .
Step 13 : Finally, the only thing you need to make sure is the version of libmysql.dll i.e. mysql client library version, if you find any version related issues than get the latest dll file from the zip package of MySql Connector/c which can be downloaded from here and overwrite the libmysql.dll file in your RailsInstaller i.e in RailsInstaller\ruby version\bin.Now you are ready to create first RoR application with the mysql database.
For further assistance leave me a comment.