linux(Centos6)安装Redmine 2.2.1

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: Redmine比BoardReview还要折腾,主要是让apache支持Redmine(即不通过3000端口访问,通过80端口访问),总是提示错误。后来查看apache的错误日志,才知道需要修改: 1. config/environment.rb,指定环境变量。ENV['RAILS_ENV'] ||= 'production' 2. public/dispatch.fcgi

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  

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
4天前
|
Linux 开发工具 C语言
Linux 安装 gcc 编译运行 C程序
Linux 安装 gcc 编译运行 C程序
22 0
|
4天前
|
Ubuntu Linux Python
Linux(15)Ubuntu安装ninja构建工具
Linux(15)Ubuntu安装ninja构建工具
15 0
|
7天前
|
NoSQL Linux 测试技术
Redis的安装(Linux版)
Redis的安装(Linux版)
150 1
|
17天前
|
缓存 Linux 测试技术
安装【银河麒麟V10】linux系统--并挂载镜像
安装【银河麒麟V10】linux系统--并挂载镜像
90 0
|
1天前
|
关系型数据库 MySQL Java
Linux 安装 JDK、MySQL、Tomcat(图文并茂)
Linux 安装 JDK、MySQL、Tomcat(图文并茂)
12 2
|
1天前
|
负载均衡 Java 应用服务中间件
nginx安装在linux上
nginx安装在linux上
21 2
|
3天前
|
监控 安全 Linux
Linux系统之安装ServerBee服务器监控工具
【4月更文挑战第22天】Linux系统之安装ServerBee服务器监控工具
41 2
|
3天前
|
Linux
centos 6.5安装yum
centos 6.5安装yum
22 0
|
3天前
|
运维 网络协议 Linux
【运维系列】Centos7安装并配置PXE服务
PXE是Intel开发的预启动执行环境,允许工作站通过网络从远程服务器启动操作系统。它依赖DHCP分配IP,DNS服务分配主机名,TFTP提供引导程序,HTTP/FTP/NFS提供安装源。要部署PXE服务器,需关闭selinux和防火墙,安装dhcpd、httpd、tftp、xinetd及相关服务,配置引导文件和Centos7安装源。最后,通过syslinux安装引导文件,并创建pxelinux.cfg/default配置文件来定义启动参数。
15 0
|
3天前
|
运维 网络协议 Linux
【运维系列】Centos7安装并配置postfix服务
安装CentOS7的Postfix和Dovecot,配置Postfix的`main.cf`文件,包括修改完全域名、允许所有IP、启用邮箱等。然后,配置Dovecot的多个配置文件以启用auth服务和调整相关设置。重启Postfix和Dovecot,设置开机自启,并关闭防火墙进行测试。最后,创建邮箱账户并在Windows邮箱客户端中添加账户设置。
10 0