How to set up ( Fedora php ruby on rails )

Thursday, July 22, 2010

Installing and setting up Rails 3 on Fedora 13 (Ruby on Rails 3 RC)

How To installing Ruby On Rails 3 (Release Candidate) on Fedora 13

First make sure following packages are installed on you fedora 13 system.(Requires especially if you have installed fedora from live CD instead of DVD)

[ismail@localhost ~]$ sudo yum install git bison svn autoconf sqlite-devel

Do almost every task where possible as normal user instead of super user for this installation

To start installation of Rails 3 on fedora we are using RVM(ruby version manager) so we can use our old stable release as well latest beta on our fedora system

First of all we need to install RVM so lets begin

[ismail@localhost ~]$ bash < <( curl )

Now add the following line to your .bashrc file:

[ismail@localhost ~]$ if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi

Now you need to close termial and start again and run following command:

[ismail@localhost ~]$ rvm notes

Above command will reveal the dependencies for installing ruby using RVM cuz it compile stuff and than you can install ruby without any pain with single command:

[ismail@localhost ~]$ sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel

Now lets install ruby 1.9.2-head cuz rails 3 requires ruby 1.8.7 or greater and 1.9.2 have less bugs than others

[ismail@localhost ~]$ rvm install ruby-1.9.2-head

Now lets make ruby 1.9.2 as default so we can install rails 3 pre and don't worry you can easily come back to previous version with single command without and pain or problem

[ismail@localhost ~]$ rvm ruby-1.9.2-head --default

Now its time to install Rails 3 its simple to do just issue one command and you are done with installation

[ismail@localhost ~]$ gem install rails --pre

Your installation completed but no database support yet so you need to install sqlite3-ruby so you can work with rails 3 beta

[ismail@localhost ~]$ sudo gem install sqlite3-ruby

Now create your applications in Rails 3. Lets start.....

[ismail@localhost ~]$ rails new myApplication

Now go to newly created application folder

[ismail@localhost ~]$ cd myApplication

Now we need to run last command(Hope so) so our system fully working with rails

[ismail@localhost ~]$ bundle install

Now Start your rails server

[ismail@localhost ~]$ rails s

Open your browser and open localhost:3000


You may face error like activesupport requires ruby >= 1.8.7 try closing all terminal and than trying gem install rails --pre again and don't use sudo with this command as it will install in user directory so no need and you can make sure that gem using ruby 1.9.2-head by command gem env

I've been trying for long to install Rails 3 on fedora and atlast i've succeed and if you have errors regarding installing do comment and ya i am missing one thing that is using MySQL instead SQLite and and and ya thats it have fun with rails 3