首先到ruby官网下载需要的版本(如2.4.3):
http://www.ruby-lang.org/en/downloads/
解压到 /usr/local/ruby目录,
然后切换到/usr/local/ruby/ruby-2.4.3目录,
./configure
make && make install
验证:
ruby -v
添加openssl扩展:
首先切换到/usr/local/ruby/ruby-2.4.3/ext/openssl目录:
cd /usr/local/ruby/ruby-2.4.3/ext/openssl
ruby extconf.rb --with-openssl-include=/usr/local/openssl/include/ --with-openssl-lib=/usr/local/openssl/lib
ln -s /usr/local/ruby/ruby-2.4.3/include /
make && make install
添加zlib扩展:
/usr/local/ruby/ruby-2.4.3/ext/zlib目录:
cd /usr/local/ruby/ruby-2.4.3/ext/zlib
ruby extconf.rb
make && make install