環境:Ubuntu8.04
1.安裝build工具
sudo aptitude install build-essential linux-headers-$(uname -r)
2.安裝readline zlib libncurses5
apt-get install zlib1g-dev
apt-get install libreadline5 libreadline5-dev
apt-get install libncurses5 libncurses5-dev
3.安裝ruby
ruby的源代碼下載:
http://www.ruby-lang.org/en/downloads/
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p114.tar.gz
tar xvfz ruby-1.8.6-p114.tar.gz
cd ruby-1.8.6-p114
。/configure ——prefix=/usr/local/ruby
sudo make
sudo make install
安裝好以後,加入/usr/local/ruby/bin到操作系統的PATH環境變量中
編輯/etc/environment
gedit /etc/environment
在最後面加入:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/
bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"
執行命令,使環境變量修改生效:
source /etc/environment
4.安裝gem
wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz
tar xzvf rubygems-1.0.1.tgz
cd rubygems-1.0.1
sudo ruby setup.rb
驗證gem是否安裝成功並升級
sudo gem update ——system
5.安裝rails
sudo gem install rails ——include-dependencies
安裝好rails以後,驗證是否安裝成功,可以執行:
rails –v
確認一下rails的版本