Pages

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 http://rvm.beginrescueend.com/releases/rvm-install-head )

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





Note:

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

8 comments:

  1. sir, hope you can help, i am stuck here,

    bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

    as i am behind a proxy, so i try this

    bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head -p http://proxy:8080)

    but i got this

    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    0 0 0 0 0 0 0 0 --:--:-- 0:00:03 --:--:-- 0
    curl: (7) couldn't connect to host
    100 1142 100 1142 0 0 3195 0 --:--:-- --:--:-- --:--:-- 3195
    bash: line 1: syntax error near unexpected token `newline'
    bash: line 1: `'

    ReplyDelete
  2. bash: line 1: `!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"'

    ReplyDelete
  3. I got it like a breeze... thanks for the tuto!

    ReplyDelete
  4. Was going so well until I ran

    gem install rails --pre
    bash: gem: command not found

    any ideas ?

    ReplyDelete
  5. Woot ! all working now

    Sorry my mistake gem was missing from my path. I had to add.

    PATH=$PATH:/usr/local/rvm/rubies/ruby-1.9.2-head/bin ; export PATH

    Not sure why it found ruby but not gem - even though they are in the same dir ?

    All works , many many thanks! I've spent a while trying to figure this :-)

    ReplyDelete
  6. FYI I was getting an openssl error then I started the server. To fix I had to install openssl and openssl-devel then remove and reinstall ruby using RVM. So 'yum install openssl openssl-devel' then 'rvm remove ruby-1.9.2-head' then 'rvm install ruby-1.9.2-head'. Thanx for this blog...really helped me out!

    ReplyDelete
  7. Another note : as I returned to this post , to use it again I was installing on a machine that had no ruby at all installesdd , I had to install the ruby rpm via yum to get the rvm to build correctly. Once you have done that you uninstall the rpm as its not needed anymore.

    ReplyDelete
  8. Also if you get java script runtime , after running rails s
    you may need to add the following to your Gemfile in the app root dir

    gem 'execjs'

    gem 'therubyracer'

    That worked for me

    ReplyDelete