在DreamHost上安装Ruby、Gems与Rails的最简单方法之续

Sat May 10 18:03:00 UTC 2008

昨天只是泛泛谈了一下在DreamHost上安装Ruby、Gems与Rails的最简单方法 似乎有点 意犹未尽,决定写个续集,呵呵:)

好吧从哪儿说起呢?嗯,看我注释过的脚本吧,注释应该已经算是说得比较明白了,无它!

  • #修改.bash_profile,设置环境变量GEM_HOME与GEM_PATH
  • #并将~/.gems/bin与~/local/bin加入到查找路径的前端
  • echo  'export GEM_HOME="$HOME/.gems"'  >> .bash_profile
  • echo  'export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8"'  >> .bash_profile
  • echo  'export PATH="$HOME/.gems/bin:$PATH"'  >> .bash_profile
  • echo  'export PATH="$HOME/local/bin:$PATH"'  >> .bash_profile
  •   
  • #执行.bash_profile使变量生效
  • . ~/.bash_profile
  • #显示PATH变量,仅仅只是为了测试
  • echo $PATH
  •   
  • #生成gems所需的目录及.gemrc文件,并填充相应内容
  • mkdir ~/.gems
  • touch ~/.gemrc
  • echo gemhome:/home/$(whoami)/.gems >> ~/.gemrc
  • echo gempath: >> ~/.gemrc
  • echo -/home/$(whoami)/.gems >> ~/.gemrc
  • echo -/usr/lib/ruby/gems/1.8 >> ~/.gemrc
  •   
  • # setup directories
  • mkdir -p ~/local/usr/src/ruby
  • cd ~/local/usr/src/ruby
  •   
  • # Install readline
  • wget ftp://ftp.cwru.edu/pub/bash/readline-5.2.tar.gz
  • tar zxvf readline-5.2.tar.gz
  • cd readline-5.2
  • ./configure --prefix=$HOME/local
  • make
  • make install
  • cd ..
  •   
  • # install ruby
  • wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p114.tar.gz
  • tar zxvf ruby-1.8.6-p114.tar.gz
  • cd ruby-1.8.6-p114
  • ./configure --prefix=$HOME/local --with-readline-dir=$HOME/local/
  • make
  • make install
  • cd ..
  •   
  • # fix path
  • export PATH=$HOME/local/bin:$PATH
  •   
  • # get rubygems
  • wget http://rubyforge.org/frs/download.php/35283/rubygems-1.1.1.tgz
  • tar zxvf rubygems- 1.1.1.tgz
  • cd rubygems-1.1.1
  • $HOME/local/bin/ruby setup.rb config --prefix=$HOME/local
  • $HOME/local/bin/ruby setup.rb setup
  • $HOME/local/bin/ruby setup.rb install
  • cd ..
  •   
  • # Install RAILS
  • gem install rails
  •   
  • # Install FastCGI
  • curl -O http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
  • tar xzvf fcgi-2.4.0.tar.gz
  • cd fcgi-2.4.0
  • ./configure --prefix=$HOME/local
  • make
  • make install
  • cd ..
  •   
  • # Install FastCGI & MySQL gem packages
  • gem install fcgi -- --with-fcgi-dir=$HOME/local
  • gem install mysql -- --with-mysql-config

Filed Under: Tags:

Comments

Have your say

A name is required. You may use HTML in your comments.