Skip to content

Commit 54e2eca

Browse files
committed
Add manual installation instructions of Ruby
1 parent f1b9542 commit 54e2eca

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

languages/ruby.md

+31
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,37 @@ rbenv install 2.3.3
5050
rbenv global 2.3.3
5151
```
5252

53+
## 手动编译安装
54+
55+
以 root 身份执行:
56+
57+
```
58+
RUBY_VERSION=2.4.1
59+
RUBY_DOWNLOAD_MIRROR=https://cache.ruby-lang.org/pub/ruby/
60+
# RUBY_DOWNLOAD_MIRROR=https://cache.ruby-china.org/pub/ruby/
61+
62+
yum install -y autoconf gcc gcc-c++ make automake patch
63+
yum install -y git openssh curl which tar gzip bzip2 unzip zip
64+
yum install -y openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
65+
yum install -y epel-release yum-utils
66+
yum-config-manager --enable epel
67+
68+
mkdir -p /usr/local/etc
69+
echo -e "install: --no-document\nupdate: --no-document" > /usr/local/etc/gemrc
70+
mkdir /build && cd /build
71+
curl -o ruby.tar.gz "$RUBY_DOWNLOAD_MIRROR/ruby-$RUBY_VERSION.tar.gz"
72+
mkdir ruby && tar -xzf ruby.tar.gz -C ruby --strip-components=1
73+
cd ruby
74+
./configure --disable-install-doc --enable-shared
75+
make -j"$(nproc)"
76+
make install
77+
cd / && rm -rf /build
78+
```
79+
80+
```
81+
gem update --system && gem install bundler
82+
```
83+
5384
## 配置
5485

5586
使用[Ruby China gem 源](https://gems.ruby-china.org/),禁止安装文档

0 commit comments

Comments
 (0)