Ubuntu 中安装 ruby on rails

先在Ubuntu安装基本的软件:
aptitude install subversion libreadline5-dev libopenssl-ruby libssl-dev zlib1g-dev build-essential-$(uname -r) imagemagick libmagick9-dev libmysqlclient15-dev xpdf xpdf-chinese-simplified xpdf-chinese-traditional libncurses5-dev gettext memcached sun-java6-jdk


cd ~
mkdir lib

cd ~/lib

下载ruby安装包,并放在lib下
cd ~/lib
tar zxvf ruby-1.8.6-p111.tar.gz
mv ruby-1.8.6-p111 ruby-1.8.6-p111-install
cd ruby-1.8.6-p111-install
./configure --prefix=$HOME/lib/ruby-1.8.6-p111
make clean && make
make install

cd ~/lib
ln -s ruby-1.8.6-p111 ruby

修改.bashrc文件加入ruby path:
#!/bin/bash
export PATH=$HOME/lib/ruby/bin:$PATH

检查ruby 命令路径是否正确
which ruby


安装一些扩展lib,不是必须,但可能会用到:

# zlib:
cd ~/lib/ruby-1.8.6-p111-install/ext/zlib/
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make clean && make
make install

# readline:
cd ~/lib/ruby-1.8.6-p111-install/ext/readline
ruby extconf.rb
make clean && make
make install

# openssl:
cd ~/lib/ruby-1.8.6-p111-install/ext/openssl
ruby extconf.rb
make clean && make
make install


下载gc patch for ruby(略),并安装:
cd ~/lib/ruby-1.8.6-p111-install
patch gc.c < ruby185gc.patch


重新编译ruby:
cd ~/lib/ruby-1.8.6-p111-install
./configure --prefix=$HOME/lib/ruby-1.8.6-p111
make clean && make
make install


下载gem安装包(略),并解压安装:
cd ~/lib
tar zxvf rubygems-0.9.5.tgz
cd rubygems-0.9.5
ruby ./setup.rb
gem update

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/89367b35d942638e25a8261389104d50.html