c handbook-master/docs/CentOS
Ruby安装| modified | Tuesday 7 July 2026 |
|---|
下载地址可以换成 淘宝镜像
1sudo yum groupinstall "Development Tools"
2sudo yum install openssl-devel
3wget https://ruby.taobao.org/mirrors/ruby/2.4/ruby-2.4.0.tar.gz
4tar xvfvz ruby-2.1.2.tar.gz
5cd ruby-2.1.2
6./configure
7make
8sudo make install
9
1yum install ruby
1gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
2curl -sSL https://get.rvm.io | bash -s stable
3# 如果上面的连接失败,可以尝试:
4curl -L https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
5
6curl -L get.rvm.io | bash -s stable
7echo "source /etc/profile.d/rvm.sh" >> ~/.bashrc && source /etc/profile.d/rvm.sh
8
9# 安装完RVM之后,我们需要使用如下命令设置RVM运行环境。
10source /etc/profile.d/rvm.sh
11
12# 列出rvm知道的ruby版本
13rvm list known
14
15# 重新安装ruby 2.3.3版本
16rvm install 2.3.3
17
18# 重新安装
19rvm reinstall ruby-2.3.3
20
21# 切换要使用的ruby版本
22rvm use 2.2.1
23
24# 输出变量参数
25echo "export rvm_max_time_flag=20" >> ~/.rvmrc
26
27
28# 这种方式安装
29bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
最终使用下面方式安装成功的
1curl -L https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
2# 安装完RVM之后,我们需要使用如下命令设置RVM运行环境。
3source /etc/profile.d/rvm.sh
RVM换淘宝镜像
1# For Mac
2sed -i .bak -E 's!https?://cache.ruby-lang.org/pub/ruby!https://ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db
3
4# For Linux
5sed -i -E 's!https?://cache.ruby-lang.org/pub/ruby!https://ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db
1sudo yum remove ruby ruby-devel
1make uninstall