Ubuntu 12.04 + Ruby 2.0 + Rails 3.2.13
1、安装系统需要的包
$ sudo apt-get install -y build-essential openssl curl libcurl3-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-dev2、安装RVM
$ curl -L https://get.rvm.io | bash -s stable安装RVM成功后,
然后,载入 RVM 环境(新开 Termal 就不用这么做了,会自动重新载入的)
检查一下是否安装正确
$ rvm -v rvm 1.17.3 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]3、用RVM安装Ruby环境
# 替换 Ruby 下载地址到国内淘宝镜像服务器$ sed -i.bak 's!ftp.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db # 安装 readline 包$ rvm pkg install readline # 安装 Ruby 2.0.0$ rvm install 2.0.0 --with-readline-dir=$rvm_path/usr4、设置Ruby版本
$ rvm 2.0.0 --default测试是否正确
$ ruby -v ruby 2.0.0p0 (2013-02-24 revision 39474)[x86_64-darwin12.3.0] $ gem -v 2.0.0 $ gem source -r https://rubygems.org/ $ gem source -a5、安装Rails环境
$ gem install bundler rails测试安装是否正确
$ bundle -v Bundler version 1.0 $ rails -v Rails 3.2.136、安装MySQL
$ sudo apt-get install mysql-server mysql-client //牢记安装过程中输入的密码$ sudo apt-get install libmysql-ruby libmysqlclient-dev $ gem install mysql2查看Gem包 gem list