2014年3月5日 星期三

[Ubuntu] Install Ruby on Rails with RVM

由於 Redmine 是以 Ruby on Rails 撰寫的架構,因此首要,因此我們必須安裝 Ruby on Rails 。
這裡是使用工具 RVM (Ruby Version Manager) ,它提供使用者在同一環境下安裝多個版本的機制。


Preparation:

  • RVM need following standard GNU tools and libraries:
    • bash (>= 3.2.25)
    • awk
    • sed
    • grep
    • which
    • ls
    • cp
    • tar
    • curl
    • gunzip
    • bunzip2
    • git (>= 1.7.6)
    • subversion

    1. For a quick and dirty way to find out if you have these programs and where they are, copy and paste the following code into your shell
    2. for name in {bash,awk,sed,grep,which,ls,cp,tar,curl,gunzip,bunzip2,git,svn} ; do which $name ; done

    3. Install missing packages
    4. sudo apt-get install curl git subversion

    這裡因為笨啃的 Server 僅建立一個使用者,因此單純使用 Single-User 來安裝;根據 RVM 官方網站的說明,還有 Multi-User 與 Mixed mode 兩種方法,使用者可以根據自己所需來選擇。


Steps:

  1. Download and run the RVM installation script
  2. \curl -sSL https://get.rvm.io | bash -s stable

    The rvm function will be automatically configured for every user on the system. Read the output of installer to check which files were modified.


  3. Reload shell configuration and test
    1. Close out your current shell or terminal session and open a new one.
    2. exit

    3. If you use non-login shell, you will need following command to load RVM:
    4. source ~/.rvm/scripts/rvm

    5. Test RVM installation by executing the following command which should output 'rvm is a function'.
    6. type rvm | head -n 1


  4. Install all RVM dependancies package (root password required)
  5. rvm requirements


  6. Install Ruby
    1. Display a list of all "known" rubies.
    2. rvm list known

    3. You could install latest version or specific version:
      • Latest version:
      • rvm install ruby

      • Specific version: (eg 1.9.3)
      • rvm install 1.9.3

    4. [Optional] Use the installed Ruby as the default for new shells
    5. rvm use 1.9.3 --default

    6. Check using Ruby version
    7. ruby -v
      which ruby


  7. [Optional] Install the most recent RubyGems (This should auto complete when install Ruby)
  8. rvm rubygems current


  9. Install Rails
    1. You could install latest version or specific version:
      • Latest version:
      • gem install rails

      • Specific version: (eg 3.2.13)
      • gem install rails -v '3.2.13'

    2. Check Rails version
    3. gem list



References:

5 則留言: