How to install Ruby on Rails 3.0 on Ubuntu 10.10?

后端 未结 8 1356
北海茫月
北海茫月 2020-12-24 04:18

After installing Ruby and Ruby Gems:

$ sudo apt-get install ruby rubygems
...
$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
$ gem -v
1.3.7


        
相关标签:
8条回答
  • 2020-12-24 04:21

    Ok, I hesitated to use rvm as it seemed to be aimed at solving problems I didn't intend to have (multiple ruby versions? c'mon, I just want to play with rails...) and installing from source is generally something I want to avoid...

    Anyway, I gave in and followed along with http://rvm.beginrescueend.com/rvm/install/

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

    Then (mostly suggested by the output of the above, but I needed to add libmysqlclient-dev):

    $ sudo aptitude install build-essential bison openssl libreadline5 \
                            libreadline5-dev curl git zlib1g zlib1g-dev \
                            libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 \
                            libxml2-dev libmysqlclient-dev
    

    Then I edited my .bashrc as required and opened a new terminal.

    $ rvm install 1.9.2
    $ rvm --default use 1.9.2
    $ ruby -v
    ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
    $ gem install rails
    $ rails -v
    Rails 3.0.1
    

    After creating a new project, I still had a few things to do to make it work:

    $ rails new myproject --database=mysql
    $ cd myproject
    $ emacs config/database.yml # set passwords
    $ bundle install
    $ rake db:create
    $ rails server
    

    And finally it all seems to be working. I hope that helps someone else, it certainly wasn't a particularly pleasant intro to a framework. I've reordered the commands I actually entered to avoid double handling for anyone following along.

    0 讨论(0)
  • 2020-12-24 04:24

    try installing the rdoc gem first:

    gem install rdoc
    

    It worked for me using RVM on ruby 1.8.7 and rails 3.0.7

    Good luck.

    0 讨论(0)
  • 2020-12-24 04:35

    I'm guessing rails is installed just fine but the gem-folder is somehow not setup in your PATH. Do a search somewhat like this find / -name *rails* | grep bin and check if that yields any results; if so check if the path rails is located in is also in your PATH. (echo $PATH)

    0 讨论(0)
  • 2020-12-24 04:37

    I very strongly suggest you skip the Ubuntu packages and use RVM. The install process is pretty straight forward and documented. There is also a Railscast on it.

    RVM will allow you to install multiple versions and create custom gemsets (no dependency problems). It is WELL worth it and quickly becoming the de-facto way to develop (and deploy) with Ruby.

    0 讨论(0)
  • 2020-12-24 04:37

    You will need a bunch of building tools. Googling "install rails 3.0.1 ubuntu" and you will find the info. It will be something like:

    apt-get install curl git-core build-essential zlib1g-dev libssl-dev libreadline5-dev
    

    Also recommended is RVM, which is very good for having multiple Ruby versions and different gem sets, good for experimenting and for using different versions of Rails on the same machine.

    0 讨论(0)
  • 2020-12-24 04:43

    I documented the process I went through. It covers git, rvm, and vim.

    http://appogee.posterous.com/ubuntu-1010-ruby-on-rails-setup

    0 讨论(0)
提交回复
热议问题