查看完整版本: 如何在 CentOS 7 下用 yum 及 rvm 安裝 Ruby 2.5


becky98 2018-12-5 10:25

如何在 CentOS 7 下用 yum 及 rvm 安裝 Ruby 2.5

Ruby 是一種物件導向、命令式、函數式、動態的通用程式語言。這邊介紹如何在CentOS 7下安裝Ruby 2.5<br><br>(1) 安裝相關套件<br># yum install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel sqlite-devel<br><br>(2) Install RVM<br><div># gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB<br></div># curl -L get.rvm.io | bash -s stable<br># source /etc/profile.d/rvm.sh<br># rvm reload<br><br>(3) Verify Dependencies<br># rvm requirements run<br><br>Checking requirements for centos.<br>Requirements installation successful.<br><br>(4) Install Ruby 2.5<br># rvm install 2.5<br><br>[Sample Output]<br>[quote]<br>Searching for binary rubies, this might take some time.<br>No binary rubies available for: centos/7/x86_64/ruby-2.5.1.<br>Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.<br>Checking requirements for centos.<br>Requirements installation successful.<br>Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.5.1, this may take a while depending on your cpu(s)...<br>ruby-2.5.1 - #downloading ruby-2.5.1, this may take a while depending on your connection...<br>&nbsp; % Total&nbsp;&nbsp;&nbsp; % Received % Xferd&nbsp; Average Speed&nbsp;&nbsp; Time&nbsp;&nbsp;&nbsp; Time&nbsp;&nbsp;&nbsp;&nbsp; Time&nbsp; Current<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dload&nbsp; Upload&nbsp;&nbsp; Total&nbsp;&nbsp; Spent&nbsp;&nbsp;&nbsp; Left&nbsp; Speed<br>100 13.3M&nbsp; 100 13.3M&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; 866k&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; 0:00:15&nbsp; 0:00:15 --:--:--&nbsp; 823k<br>ruby-2.5.1 - #extracting ruby-2.5.1 to /usr/local/rvm/src/ruby-2.5.1.....<br>ruby-2.5.1 - #configuring..................................................................<br>ruby-2.5.1 - #post-configuration..<br>ruby-2.5.1 - #compiling....................................................................<br>ruby-2.5.1 - #installing.............................<br>ruby-2.5.1 - #making binaries executable..<br>ruby-2.5.1 - #downloading rubygems-2.7.7<br>ruby-2.5.1 - #extracting rubygems-2.7.7.....................................................<br>ruby-2.5.1 - #removing old rubygems........<br>ruby-2.5.1 - #installing rubygems-2.7.7................................<br>ruby-2.5.1 - #gemset created /usr/local/rvm/gems/ruby-2.5.1@global<br>ruby-2.5.1 - #importing gemset /usr/local/rvm/gemsets/global.gems...................................................<br>ruby-2.5.1 - #generating global wrappers.......<br>ruby-2.5.1 - #gemset created /usr/local/rvm/gems/ruby-2.5.1<br>ruby-2.5.1 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list<br>ruby-2.5.1 - #generating default wrappers.......<br>ruby-2.5.1 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).<br>Install of ruby-2.5.1 - #complete<br>Ruby was built without documentation, to build it run: rvm docs generate-ri<br>[/quote]<br><div><br></div><div>(5) 列出 Ruby 預設版本<br># rvm list<br></div><div><br></div>(6) 確認 ruby 版本<br># ruby -v<br><br>ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]<br><br>恭喜...這樣就安裝好囉<br><br>參考文章:<br>https://tecadmin.net/install-ruby-latest-stable-centos/<br><br>
頁: [1]
查看完整版本: 如何在 CentOS 7 下用 yum 及 rvm 安裝 Ruby 2.5