轉 CentOS下面安裝RVM+ruby+Rails

來源:互聯網
上載者:User

標籤:

CentOS6.2下面安裝RVM+ruby+Rails (1)RVM官方網站應該是改版過一次,
使用Java代碼  
  1. curl -L https://get.rvm.io | bash -s stable  
下載並安裝rvm穩定版本。不在使用bash < <(curl -s https://rvm.beginrescueend.com/install/rvm),切記。
很快安裝完rvm後,重新登入一個新的ssh,使用rvm -v檢查一下版本即可。

(2)安裝一些以來庫,編譯安裝其它軟體或者庫的時候會用到
Java代碼  
  1. yum install zlib zlib-devel sqlite-devel  

最後的資訊大致如下:
Java代碼  
  1. ......                                                                                                        30 kB/s | 124 kB     00:04       
  2. Running rpm_check_debug  
  3. Running Transaction Test  
  4. Transaction Test Succeeded  
  5. Running Transaction  
  6.   Installing : sqlite-devel-3.6.20-1.el6.i686                                                                                            1/2   
  7.   Installing : zlib-devel-1.2.3-27.el6.i686                                                                                              2/2   
  8.   
  9. Installed:  
  10.   sqlite-devel.i686 0:3.6.20-1.el6                                       zlib-devel.i686 0:1.2.3-27.el6                                        
  11.   
  12. Complete!  


(3)強烈推薦安裝ruby前,先安裝openssl,否則以後要用到ssl的時候可能痛不欲生地要重新安裝ruby。
Java代碼  
  1. rvm pkg install openssl  

安裝完成後,有下面的提示資訊,如果安裝錯誤,也有提示告示你到哪裡查看日誌。
Java代碼  
  1. [root@localhost config]# rvm pkg install openssl  
  2. Fetching openssl-0.9.8t.tar.gz to /usr/local/rvm/archives  
  3. Extracting openssl-0.9.8t.tar.gz to /usr/local/rvm/src  
  4. Configuring openssl in /usr/local/rvm/src/openssl-0.9.8t.  
  5. Compiling openssl in /usr/local/rvm/src/openssl-0.9.8t.  
  6. Installing openssl to /usr/local/rvm/usr  

不同的作業系統或者使用者,安裝位置可能不一樣。


(4)指定openssl位置來安裝ruby
提示有一些庫可能需要安裝,請根據實際情況決策是否需要yum install一些以來庫。
Java代碼  
  1. yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel   

可以先安裝上面的一些庫,再安裝ruby
Java代碼  
  1. rvm install 1.9.2 --with-openssl-dir=/usr/local/rvm/usr  

我看完提示資訊後,q推出提示,沒有安裝其它依賴庫,繼續安裝ruby。
Java代碼  
  1. ......  
  2. Press ‘q‘ to continue.  
  3. Fetching yaml-0.1.4.tar.gz to /usr/local/rvm/archives  
  4.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
  5.                                  Dload  Upload   Total   Spent    Left  Speed  
  6. 100  460k  100  460k    0     0  29602      0  0:00:15  0:00:15 --:--:-- 34256  
  7. Extracting yaml-0.1.4.tar.gz to /usr/local/rvm/src  
  8. Configuring yaml in /usr/local/rvm/src/yaml-0.1.4.  
  9. Compiling yaml in /usr/local/rvm/src/yaml-0.1.4.  
  10. Installing yaml to /usr/local/rvm/usr  
  11. Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.2-p320, this may take a while depending on your cpu(s)...  
  12.   
  13. ruby-1.9.2-p320 - #fetching   
  14. ruby-1.9.2-p320 - #downloading ruby-1.9.2-p320, this may take a while depending on your connection...  
  15.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
  16.                                  Dload  Upload   Total   Spent    Left  Speed  
  17. 100 8770k  100 8770k    0     0  44230      0  0:03:23  0:03:23 --:--:-- 55436  
  18. ruby-1.9.2-p320 - #extracting ruby-1.9.2-p320 to /usr/local/rvm/src/ruby-1.9.2-p320  
  19. ruby-1.9.2-p320 - #extracted to /usr/local/rvm/src/ruby-1.9.2-p320  
  20. ruby-1.9.2-p320 - #configuring   
  21. ruby-1.9.2-p320 - #compiling   
  22. ruby-1.9.2-p320 - #installing   
  23. Retrieving rubygems-1.8.24  
  24.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current  
  25.                                  Dload  Upload   Total   Spent    Left  Speed  
  26. 100  371k  100  371k    0     0  38121      0  0:00:09  0:00:09 --:--:-- 38064  
  27. Extracting rubygems-1.8.24 ...  
  28. Removing old Rubygems files...  
  29. Installing rubygems-1.8.24 for ruby-1.9.2-p320 ...  
  30. Installation of rubygems completed successfully.  
  31. ruby-1.9.2-p320 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).  
  32. ruby-1.9.2-p320 - #importing default gemsets (/usr/local/rvm/gemsets/)  
  33. Install of ruby-1.9.2-p320 - #complete   

(5) rvm use 1.9.2

(6) gem install rails
Java代碼  
  1. Fetching: i18n-0.6.0.gem (100%)  
  2. Fetching: multi_json-1.3.6.gem (100%)  
  3. Fetching: activesupport-3.2.6.gem (100%)  
  4. Fetching: builder-3.0.0.gem (100%)  
  5. Fetching: activemodel-3.2.6.gem (100%)  
  6. Fetching: rack-1.4.1.gem (100%)  
  7. Fetching: rack-cache-1.2.gem (100%)  
  8. Fetching: rack-test-0.6.1.gem (100%)  
  9. Fetching: journey-1.0.4.gem (100%)  
  10. Fetching: hike-1.2.1.gem (100%)  
  11. Fetching: tilt-1.3.3.gem (100%)  
  12. Fetching: sprockets-2.1.3.gem (100%)  
  13. Fetching: erubis-2.7.0.gem (100%)  
  14. Fetching: actionpack-3.2.6.gem (100%)  
  15. Fetching: arel-3.0.2.gem (100%)  
  16. Fetching: tzinfo-0.3.33.gem (100%)  
  17. Fetching: activerecord-3.2.6.gem (100%)  
  18. Fetching: activeresource-3.2.6.gem (100%)  
  19. Fetching: mime-types-1.19.gem (100%)  
  20. Fetching: polyglot-0.3.3.gem (100%)  
  21. Fetching: treetop-1.4.10.gem (100%)  
  22. Fetching: mail-2.4.4.gem (100%)  
  23. Fetching: actionmailer-3.2.6.gem (100%)  
  24. Fetching: rack-ssl-1.3.2.gem (100%)  
  25. Fetching: thor-0.15.4.gem (100%)  
  26. Fetching: json-1.7.3.gem (100%)  
  27. Building native extensions.  This could take a while...  
  28. Fetching: rdoc-3.12.gem (100%)  
  29. ......  

至此安裝完畢,後面再來驗證吧。

轉 CentOS下面安裝RVM+ruby+Rails

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.