linux(Centos6)安装Redmine 2.2.1

Redmine比BoardReview还要折腾,主要是让apache支持Redmine(即不通过3000端口访问,通过80端口访问),总是提示错误。后来查看apache的错误日志,才知道需要修改:

1. config/environment.rb,指定环境变量。ENV['RAILS_ENV'] ||= 'production'

2. public/dispatch.fcgi,加载rubygems和fcgi模块。

一种方式是安装完Redmine后通过3000访问,这个据说性能低;所以改为Apache的cgi支持的方式。

Redmine单独启动

[python]  view plain  copy
  1. echo "for Centos6 x86_64bit. Centos5.5因为Python是2.4的,无法支持ReviewBoard。"  
  2. echo "refer to: http://www.redmine.org/projects/redmine/wiki/RedmineInstall"  
  3. echo "refer to: http://www.redmine.org/projects/redmine/wiki/Redmine_on_CentOS_installation_HOWTO"  
  4.   
  5. # 安装支持工具  
  6. # redmine 2.2.1 requires following:  
  7. sudo yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel  
  8. # install ruby(ruby 1.8.7), it canbe ruby 1.8.7, 1.9.2, 1.9.3, jruby-1.6.7  
  9. sudo yum install -y ruby ruby-devel  
  10. # install gems(RubyGems <= 1.8)  
  11. sudo yum install -y rubygems  
  12. # install mysql  
  13. sudo yum install -y mysql-server  
  14. # 将mysql的编码改为utf8,否则中文会出现乱码,修改/etc/my.conf  
  15.     sudo vi /etc/my.cnf  
  16.     #修改内容,在以下两节中添加:  
  17.     [mysqld]   
  18.     default-character-set=utf8  
  19.     [client]  
  20.     default-character-set=utf8  
  21. sudo chkconfig mysqld on  
  22. sudo service mysqld start  
  23. # install passenger  
  24. sudo gem install passenger  
  25. echo "very important to run redmine on apache. choose 1 to install passenger for apache."  
  26. sudo passenger-install-apache2-module  
  27.   
  28. #下载和解压Redmine  
  29. ##################################################################################  
  30. ##################################################################################  
  31. wget http://rubyforge.org/frs/download.php/76677/redmine-2.2.1.tar.gz  
  32. tar xf redmine-2.2.1.tar.gz   
  33. sudo mkdir /var/www/redmine  
  34. sudo cp -a redmine-2.2.1/* /var/www/redmine  
  35.   
  36. # 安装Redmine  
  37. ##################################################################################  
  38. ##################################################################################  
  39. # install rmagick  
  40. sudo yum install -y ImageMagick-devel postgresql-devel sqlite-devel  
  41. # install bundler  
  42. sudo gem install bundler pg sqlite3  
  43. # update gem file, [winlin] do nothing.  
  44. #vi /var/www/redmine/Gemfile  
  45. # bundle install  
  46. cd /var/www/redmine  
  47. sudo bundle install  
  48. # bundle show mysql  
  49.   
  50. # 创建数据库  
  51. ##################################################################################  
  52. ##################################################################################  
  53. # set mysql user name to root, password to root.  
  54. mysqladmin -uroot -p"" password root  
  55. # create database, login as root of mysql  
  56. mysql -uroot -proot  
  57. create database redmine character set utf8;  
  58. create user 'redmine'@'localhost' identified by 'my_password';  
  59. \q  
  60. # config database  
  61. cd /var/www/redmine/config  
  62. sudo cp database.yml.example database.yml  
  63. sudo vi database.yml  
  64. # 修改用户名和密码。  
  65.   
  66. #单独启动Redmine,侦听3000端口。  
  67. # 访问方式:http://redmine:3000  
  68. ##################################################################################  
  69. ##################################################################################  
  70. cd /var/www/redmine  
  71. # generate database data  
  72. sudo rake generate_secret_token  
  73. # 以下以root用户运行。sudo su  
  74. RAILS_ENV=production rake db:migrate  
  75. RAILS_ENV=production REDMINE_LANG=fr rake redmine:load_default_data  
  76. # config svn  
  77. cd /var/www/redmine/config  
  78. cp configuration.yml.example configuration.yml  
  79. # test install  
  80. cd /var/www/redmine  
  81. sudo ruby script/rails server webrick -e production  
  82. echo "Redmine is running..."  


Apache和Redmine

[python]  view plain  copy
  1. # Redmine的Apache支持,通过Apache访问,不单独启动Redmine  
  2. ##################################################################################  
  3. ##################################################################################  
  4. echo "refer to: http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Apache_to_run_Redmine"  
  5. # install cgis.  
  6. cd /var/www/redmine/public  
  7. cp dispatch.fcgi.example dispatch.fcgi  
  8. cp htaccess.fcgi.example .htaccess  
  9. # change owner.  
  10. cd /var/www  
  11. sudo chown -R apache:apache redmine  
  12. sudo chmod -R 755 redmine  
  13. # config ruby  
  14. cd /var/www/redmine  
  15. # add the following to the first line of file: config/environment.rb  
  16. sudo vi config/environment.rb  
  17. cat << END  
  18. ENV['RAILS_ENV'] ||= 'production'  
  19. END  
  20. # add the following lines to the file: public/dispatch.fcgi  
  21. sudo vi public/dispatch.fcgi  
  22. cat << END  
  23. require 'rubygems'  
  24. require 'fcgi'  
  25. END  
  26.   
  27. # 安装fastcgi/fcgi/mode_fastcgi支持  
  28. ##################################################################################  
  29. ##################################################################################  
  30. # install fastcgi for apache.  
  31. cd; wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz  
  32. tar xf mod_fastcgi-current.tar.gz  
  33. (cd mod_fastcgi-2.4.6; cp Makefile.AP2 Makefile;)  
  34. # lib64, if 32bit os, use /usr/lib/httpd instead  
  35. (cd mod_fastcgi-2.4.6;  make top_dir=/usr/lib64/httpd;)  
  36. (cd mod_fastcgi-2.4.6; sudo make install top_dir=/usr/lib64/httpd)  
  37. # install to apache  
  38. sudo vi /etc/httpd/conf.d/mod_fastcgi.conf  
  39. cat << END  
  40. LoadModule fastcgi_module modules/mod_fastcgi.so  
  41. <IfModule mod_fastcgi.c>  
  42. FastCgiIpcDir /tmp/fcgi_ipc/  
  43. </IfModule>  
  44. END  
  45. # restart apache  
  46. sudo /sbin/service httpd restart  
  47. sudo chmod 777 /tmp/fcgi_ipc -R  
  48. sudo /sbin/service httpd restart  
  49. # install fcgi for ruby(redmine)  
  50. cd; wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz  
  51. tar -zxvf fcgi-2.4.0.tar.gz  
  52. # patch it, 或者用我们已经下载修改的包。  
  53. cd fcgi-2.4.0;  
  54. vi include/fcgio.h  
  55. echo "在第34行加上以下include"  
  56.     #include <cstdio>  
  57. echo "为了支持新版的gcc。"  
  58. # make and install.  
  59. (cd fcgi-2.4.0;./configure;)  
  60. (cd fcgi-2.4.0;make; sudo make install)  
  61. sudo gem install fcgi  
  62. # update apache config  
  63. sudo vi /etc/httpd/conf/httpd.conf  
  64. cat << END  
  65. <VirtualHost *:80>  
  66.     ServerName redmine.winlin.com  
  67.     ServerAdmin webmaster@winlin.com  
  68.     DocumentRoot /var/www/redmine/public/  
  69.     ErrorLog logs/redmine_error_log  
  70.   
  71.     <Directory "/var/www/redmine/public/">  
  72.             Options Indexes ExecCGI FollowSymLinks  
  73.             Order allow,deny  
  74.             Allow from all  
  75.             AllowOverride all  
  76.     </Directory>  
  77. </VirtualHost>  
  78. END  
  79.   
  80. # 完毕,重启Apache  
  81. # 可通过: http://server 访问  
  82. ##################################################################################  
  83. ##################################################################################  
  84. sudo /sbin/service httpd restart  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值