在centos6.4上安装redmine 整合apache

以下安装步骤在2台服务器上安装成功,但是也有遇到不同的坎,主要因为是文件权限问题造成的。

整了2天才搞好,操作系统版本不同,redmine版本更新,数据迁移,反正就是以后不想再装redmine了!


软件版本

linux           centos6.4 x64bit

Mysql         5.1.73

Apache      2.2.15

Ruby          ruby-1.9.3-p545

Gem           1.8.23.2

Rails           3.2.13

Redmine     2.3.0


安装系统依赖包

# yum -y install gcc

# yum -y install gcc-c++

# yum -y install zlib zlib-devel
# yum -y install readline readline-devel
# yum -y install openssl openssl-devel
# yum -y install mysql-devel
# yum -y install ImageMagick ImageMagick-devel
# yum -y install curl-devel
# yum -y install httpd-devel
# yum -y install apr-devel
# yum -y install apr-util-devel
# yum -y install gdbm gdbm-devel


下载yaml和ruby包

#cd /usr/local/src
#wget http://pyyaml.org/download/libyaml/yaml-0.1.5.tar.gz
#wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p545.tar.gz
先装yaml
后装ruby
#./configure
#make
#make install


配置Redmine

#wget http://rubyforge.org/frs/download.php/76867/redmine-2.3.0.tar.gz

#tar -xf redmine-2.3.0.tar.gz
#cd redmine-2.3.0
#cp config/database.yml.example  config/database.yml
#vim database.yml
production:
  adapter: mysql2(ruby是1.9后的版本一定要是mysql2,不然会出现 redmine incompatible character                                                     encodings: UTF-8 and ASCII-8BIT)
  database: redmine
  host: localhost
  username: root
  password: "root"
  encoding: utf8

#vim Gemfile

加入 gem 'thin'


安装Redmine依赖的gem

#gem install bundler
#bundle install --without development test

#rake generate_secret_token


安装数据库

# yum -y install mysql-server
# sudo chkconfig mysqld on
# service mysqld start
# /usr/bin/mysqladmin -u root password 'root'
#GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';


Database迁移和初始化


我做的是redmine迁移,redmine之前的版本是1.8的,原来已经有很多项目管理数据了

所以只升级数据库结构,并不初始化

在Mysql 中执行 

mysql>source /root/redmine.bak.sql;

#RAILS_ENV=production rake db:migrate


如果要使用新的database,请执行以下命令

#CREATE DATABASE redmine CHARACTER SET utf8;

#RAILS_ENV=production rake redmine:load_default_data


#mkdir -p tmp tmp/pdf  public/plugin_assets

#sudo chown -R redmine:apache files log tmp public/plugin_assets
#sudo chmod -R 755 files log tmp public/plugin_assets


启动Redmine

#ruby script/rails server webrick -e production

# yum -y install httpd
# chkconfig httpd on
# service httpd start
# apachectl -v


#cd /usr/local/src/redmine-2.3.0

#gem install passenger

#passenger-install-apache2-module

我安装的时候报错如下:

parent directory is world writable, FileUtils#remove_entry_secure does not work;

然后查到资料,地址:www.ruby-doc.org/stdlib-1.9.3/libdoc/fileutils/rdoc/FileUtils.html

Remove_entry_secure (path, force = false) click to toggle source

This method removes a file system entry pathpath shall be a regular file, a directory, or something. If path is a directory, remove it recursively. This method is required to avoid TOCTTOU (time-of-check-to-time-of-use) local security vulnerability of rm_r. rm_r causes security hole when:

* Parent directory is world writable (including /tmp).
* Removing directory tree includes world writable directory.
* The system has symbolic link.

To avoid this security hole, this method applies special preprocess. If path is a directory, this method chown(2) and chmod(2) all removing directories. This requires the current process is the owner of the removing whole directory tree, or is the super user (root).

WARNING: You must ensure that ALL parent directories cannot be moved by other untrusted users. For example, parent directories should not be owned by untrusted users, and should not be world writable except when the sticky bit set.

WARNING: Only the owner of the removing directory tree, or Unix super user (root) should invoke this method. Otherwise this method does not work.

For details of this security vulnerability, see Perl’s case:

http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0448
http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-0452

For fileutils.rb, this vulnerability is reported in [ruby-dev:26100].

错误和这条有关

* Parent directory is world writable (including /tmp).

于是执行命令

sudo chmod -R 755 /tmp


在此执行#passenger-install-apache2-module,成功!


配置Apache
#cd /etc/httpd/conf
#touch redmine.conf
#vim redmine.conf
LoadModule passenger_module  /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.38/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
     PassengerRoot  /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.38
     PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>
<VirtualHost *:80>
      ServerName ***.redmine.com
      DocumentRoot /usr/local/src/redmine-2.3.0/public
      <Directory /usr/local/src/redmine-2.3.0/public>
         AllowOverride all
         Options -MultiViews
      </Directory>

</VirtualHost>


#vim httpd.conf

加入

Include conf/redmine.conf


#cd /usr/local/src
#wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz
#tar -xf mod_fastcgi-current.tar.gz
#cd mod_fastcgi-2.4.6/
#cp Makefile.AP2 Makefile 
#make top_dir=/usr/lib64/httpd
#make install top_dir=/usr/lib64/httpd


#vim /etc/httpd/conf.d/mod_fastcgi.conf
LoadModule fastcgi_module modules/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
</IfModule>


#mkdir /tmp/fcgi_ipc

#chown -R apache.apache /tmp
#chmod -R 777 /tmp

#wget http://www.fastcgi.com/dist/fcgi.tar.gz
#tar -xf fcgi.tar.gz
#cd fcgi-2.4.1-SNAP-0311112127
#vim include/fcgio.h
增加 
#include <cstdio>


#./configure

#make

#make install
#gem install fcgi

#cd /usr/local/src/redmine-2.3.0/public
#cp htaccess.fcgi.example .htaccess
#cp dispatch.fcgi.example dispatch.fcgi

#chown -R apache:apache /usr/local/src/redmine-2.3.0
#chmod -R 755 /usr/local/src/redmine-2.3.0

关闭selinux,否则在/var/log/httpd,apache的日志中错误如:Permission Denied
#vim /etc/selinux/config

SELINUX=disabled

#setenforce 0

重启Apache

#service httpd restart




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值