环境: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的版本。
新闻热点
疑难解答
图片精选