ubuntu9.04下部署mongrel

ubuntu9.04下部署mongrel

完全参考以前记录的8.04的文档来安装的,但是执行中遇到些问题,一一记录下来备查。
1.升级系统
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get -f install
sudo dpkg --configure -a

2.安装ruby on rails
apt-get install ruby
apt-get install rubygems
gem update --system (先更新gem再装rails否则出错)

报错如下:
ERROR: While executing gem ... (RuntimeError)
    gem update --system is disabled on Debian. RubyGems can be updated using the official Debian repositories by aptitude or apt-get.
Unfortunately the apt-get update does not help at all.

解决方法:
gem install rubygems-update
cd /var/lib/gems/1.8/bin
./update_rubygems

安装继续
升级后命令变成了gem1.8了,使用起来不习惯,所以加个软链接
ln -s /usr/bin/gem1.8 /usr/bin/gem
注意,这次/usr/bin下面已经有个文件夹叫gem了,不晓得是什么版本,先rm /usr/bin/gem了,然后再加软链接

安装rails
gem install rails --include-dependencies
apt-get install imagemagick
apt-get install libmagick9-dev ruby1.8-dev
gem install rmagick

报错:
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
        ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
        from extconf.rb:1
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.9.2 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.9.2/ext/RMagick/gem_make.out
解决办法:
先安装
sudo apt-get install ruby1.8-dev ‘

再次报错:
Can't install RMagick 2.9.2. Can't find Magick-config in /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/ruby1.8
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/rmagick-2.9.2 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/rmagick-2.9.2/ext/RMagick/gem_make.out
解决办法,看来是少了某选项。找找加上:
命令:apt-get install libmagick9-dev

继续安装
gem install mongrel
gem install mongrel_cluster
mv redmine-0.7.3 redmine
把名字改掉后再运行
mongrel_rails cluster::configure -e production -p 8000 -a 0.0.0.0 -N 2 -c /usr/local/redmine/
报错:
root@jarod-ubuntu9:/usr/local# mongrel_rails cluster::configure -e production -p 8000 -a 0.0.0.0 -N 2 -c /usr/local/redmine/
!!! Path to config file not valid: config/mongrel_cluster.yml
cluster::configure reported an error. Use mongrel_rails cluster::configure -h to get help.
解决办法:
chmod a+x mongrel_cluster.yml

在终端下输入以下命令启动Mongrel:
代码:
/usr/local/redmine/mongrel_rails cluster::start

要停止则输入:
代码:
/usr/local/redmine/mongrel_rails cluster::stop

2、配置apache转发
启动mod_proxy模块.
cd /etc/apache2/mods-enabled/
sudo ln -s ../mods-available/proxy_balancer.load proxy_balancer.load
sudo ln -s ../mods-available/proxy_http.load proxy_http.load (配置转发JBOSS已加)
sudo ln -s ../mods-available/proxy.load proxy.load (配置转发JBOSS已加)
sudo ln -s ../mods-available/proxy.conf proxy.conf (配置转发JBOSS已加)

修改proxy.conf文件
vi /etc/apache2/mods-available/proxy.conf
#Allow from .example.com
改为
Allow from all

修改 /etc/apache2/apache2.conf 文件(默认是在最后一行):
Include /etc/apache2/sites-enabled/
改为:
#Include /etc/apache2/sites-enabled/

然后在/etc/apache2/httpd.conf里添加以下部分:
代码:
<Proxy balancer://mongrel>
BalancerMember http://192.168.50.90:8000
BalancerMember http://192.168.50.90:8001
</Proxy>

<VirtualHost *:80>
ProxyPass / balancer://mongrel/
ProxyPassReverse / balancer://mongrel/
</VirtualHost>

重启apache2让设置生效
/etc/init.d/apache2 restart

你可能感兴趣的:(Debian,jboss,Ruby,Rails,rubygems)