centos安装ruby

下面开始安装Ruby

一、下载Ruby源码包

wget ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.7.tar.gz

二、解压安装Ruby

tar zxvf ruby-2.1.7.tar.gz
./configure --disable-install-rdoc
make
make prefix=/usr/local install

三、安装Bundler Gem

由于AWS被墙无法使用,修改ruby的源为淘宝

gem sources --remove https://rubygems.org/
gem sources -a https://ruby.taobao.org/
gem sources -l
gem install bundler --no-doc

添加以下软连接,否则可能提示找不到

ln -s /usr/local/bin/ruby /usr/bin/ruby  
ln -s /usr/local/bin/gem /usr/bin/gem  
ln -s /usr/local/bin/bundle /usr/bin/bundle  

四、查看验证

复制代码
[root@test81 ~]# which ruby
#/usr/local/bin/ruby
[root@test81 ~]# which gem
#/usr/local/bin/gem
[root@test81 ~]# which bundle
#/usr/local/bin/bundle [root@test81 ~]# ruby -v #ruby 2.1.7p400 (2015-08-18 revision 51632) [x86_64-linux]
复制代码
posted @ 2018-06-07 18:01  贺秋雨  阅读(370)  评论(0编辑  收藏  举报