安装Ruby:
到Ruby官网:https://www.ruby-lang.org/en/downloads/
找到最新版本的Ruby
进入linux,选择一个位置存放安装包,我的位置是/opt/soft
[root@localhost soft]# pwd
/opt/soft
输入命令wget + 刚刚复制的安装包URL
[root@localhost soft]# wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.gz
我安装的是2.2.7,解压缩:
[root@localhost soft]# tar zxf ruby-2.2.7.tar.gz
进入解压缩完成后的文件夹,执行命令:
[root@localhost ruby-2.2.7]# ./configure --prefix=/usr/local/ruby-2.2.7
[root@localhost ruby-2.2.7]# make && make install
[root@localhost ruby-2.2.7]# ln -s /usr/local/ruby-2.2.7 /bin/ruby /usr/bin/ruby
执行ruby -v可查看版本
[root@localhost zlib]# ruby ./extconf.rb
checking for deflateReset() in -lz... yes
checking for zlib.h... yes
checking for crc32_combine() in zlib.h... yes
checking for adler32_combine() in zlib.h... yes
checking for z_crc_t in zlib.h... no
creating Makefile
[root@localhost zlib]# pwd
/opt/soft/ruby-2.2.7/ext/zlib
[root@localhost zlib]# make
compiling zlib.c
linking shared-object zlib.so
[root@localhost zlib]# make install
/usr/bin/install -c -m 0755 zlib.so /usr/local/ruby-2.2.7/lib/ruby/site_ruby/2.2.0/x86_64-linux
[root@localhost zlib]#
安装RubyGems:
到官网 https://rubygems.org/pages/download
wget + URL,在线下载安装包:
[root@localhost soft]# wget https://rubygems.org/rubygems/rubygems-2.7.6.tgz
--2018-03-13 05:37:49-- https://rubygems.org/rubygems/rubygems-2.7.6.tgzResolving rubygems.org... 151.101.194.2, 151.101.66.2, 151.101.130.2, ...
Connecting to rubygems.org|151.101.194.2|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 852486 (833K) [application/x-tar]
Saving to: ârubygems-2.7.6.tgzâ
100%[======================================>] 852,486 1.86M/s in 0.4s
解压缩:
[root@localhost soft]# tar xzf rubygems-2.7.6.tgz
进入解压后的文件夹,执行命令:
[root@localhost soft]# c