首先确定操作系统环境,不建议在 Windows 上面搞,所以你需要用:
$ sudo apt - get install - y build - essential openssl curl libcurl4 - openssl - dev libreadline6 libreadline6 - dev git zlib1g zlib1g - dev libssl - dev libyaml - dev libxml2 - dev libxslt - dev autoconf automake libtool imagemagick libmagickwand - dev libpcre3 - dev libsqlite3 - dev libmysql - ruby libmysqlclient - dev |
$ curl - L https: / / get.rvm.io | bash - s stable |
$ source ~ / .rvm / scripts / rvm |
$ rvm - v |
1
2 |
$ cat >>~ / .bash_profile [[ - s "$HOME/.rvm/scripts/rvm"
]] && . "$HOME/.rvm/scripts/rvm" |
# 替换 Ruby 下载地址到国内淘宝镜像服务器 $ sed - i ‘s!ftp.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby!‘
$rvm_path / config / db |
# 安装 readline 包 $ rvm pkg install readline # 缺少包: sqlite3, libgdbm-dev, libncurses5-dev, bison, libffi-dev, gawk |
# 安装 Ruby 2.0.0 $ rvm install 2.0 . 0
- - with - readline - dir = $rvm_path / usr |
或者可以安装 1.8.7 版本,也可以是 1.9.3,只要将后面的版本号跟换一下就可以了
同样继续等待漫长的下载,编译过程,完成以后,Ruby, Ruby Gems 就安装好了。
原文:http://www.cnblogs.com/lizunicon/p/3543910.html