How to install Ruby on Rails 3.0 on Ubuntu 10.10?

后端 未结 8 1414
北海茫月
北海茫月 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.

提交回复
热议问题