apt (Debian or Ubuntu)
Debian GNU/Linux and Ubuntu use the apt package manager. You can use it like this:
$ sudo apt-get install ruby-full
As of writing, the ruby-full package provides Ruby 2.3.1, which is an old stable release, on Debian and Ubuntu.
使用apt
只能安装旧版,想安装新版本就只能自己编译了。
1.到官网下载最新稳定版源代码 http://www.ruby-lang.org/en/downloads/
2.解压 tar zxvf ruby-2.5.0
3../configure
4.make
5.make install
6.ruby -v
输出ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
成功