1. 准备安装时使用的库
- $ sudo apt-get install gcc g++ build-essential libssl-dev libreadline5-dev zlib1g-dev linux-headers-generic
2. 下载Ruby1.9.2源码编译安装
- $ wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
- (如果无法下载,可以选择:http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2- p0.tar.bz2,http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p0.zip)
- $ tar -xvzf ruby-1.9.2-p0.tar.gz
- $ cd ruby-1.9.2-p0/
- $ ./configure –prefix=/usr/local/ruby
- $ make && sudo make install
3. 准备环境变量
- $ sudo gedit /etc/environment
添加环境变量
- PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"
注意:也可以修改/etc/profile文件,添加/usr/local/ruby/bin
4. 检查Ruby安装情况
- $ruby -v
正常的话,ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
5. 创建关联
- $ sudo ln -s /usr/local/ruby/bin/ruby /usr/local/bin/ruby
- $ sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem
如果 /usr/bin/目录下面存在符号连接gem,就删除gem。重新:
- $ sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem
6. 安装Rails
- $ sudo gem install tzinfo builder memcache-client rack rack-test erubis mail text-format bundler thor i18n
- $ sudo gem install rack-mount
- $ sudo gem install rails
<p><span style="font-family:Arial;font-size:14px;line-height: 26px;"><span style="margin: 0px; padding: 0px;">
</span></span></p><pre>