一、Redmine基本安装
1、安装依赖库
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
2、安装Ruby On Rails
2.1、安装YAML
$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar zxf yaml-0.1.7.tar.gz
$ cd yaml-0.1.7/
$ ./configure --prefix=/home/root/ruby
$ make
$ make install
2.2 安装RUBY
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar zxvf ruby-2.4.2.tar.gz
cd ruby-2.4.2
./configure
make
make install
注:ruby-1.8.6以后版本已经集成了GEM 以前的版本需要自己安装GEM
安装方法:
wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
tar -zxvf rubygems-1.3.7.tgz
cd rubygems-1.3.7
ruby setup.rb
3、安装Rails
gem install rails
4、安装Redmin
4.1、svn下载redmine最新版
cd /opt
svn co http://svn.redmine.org/redmine/branches/2.1-stable redmine-2.1
cd redmine-2.1
yum install ImageMagick ImageMagick-devel
bundle install --without development test postgresql sqlite
去掉了postgre 和 sqlite
如果使用ImageMagick 那么需要安装ImageMagick-6.7
=========
tar zxvf ImageMagick-6.7.0-9.tar.gz
cd ImageMagick-6.7.0-9
./configure
make
make install
==========
4.2 配置mysql数据库
cp /redmine-2.1/config/database.yml.example /redmine-2.1/config/database.yml
vi /redmine-2.1/config/database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: root
password: “123456”
encoding: utf8
5、生成Session密钥
gem install mysql2 -v '0.4.6'
rake generate_secret_token
6、创建数据库表对象
cd /redmine-2.1
RAILS_ENV=production rake db:migrate
7、导入数据库默认数据集
RAILS_ENV=production rake redmine:load_default_data
输入zh
8、设置文件系统权限
mkdir -p tmp/pdf public/plugin_assets
chmod -R 755 log files tmp tmp/pdf public/plugin_assets
9、启动redmine
cd /redmine
ruby ./bin/rails server webrick -e production -d
10、登录系统
login:admin
password:admin
二、整合NGINX和redmine
server {
listen 80;
server_name redmine.lihaonan.top;
access_log /var/log/nginx/redmine.souvi.access.log main;
error_log /var/log/nginx/redmine.souvi.error.log debug;
location / {
client_max_body_size 8m;
proxy_pass http://127.0.0.1:3000;
}
}
二、整合Apache和Redmine
主要参考:http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Apache_to_run_Redmine
1、安装Passenger
gem install passenger
passenger-install-apache2-module
2、安装apache mod_fastcgi
2.1、安装
wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz
tar zxvf 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
2.2、配置Apache
vi /etc/httpd/conf.d/mod_fastcgi.conf
内容:
LoadModule fastcgi_module modules/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
</IfModule>
mkdir -p /tmp/fcgi_ipc
chown -R apache.apache /tmp/fcgi_ipc/
chmod -R 777 /tmp/fcgi_ipc/
3、安装fastcgi
wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar -zxvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure
make
make install
4、安装gem fcgi
cd /redmine-2.1
vi Gemfile.local
gem 'fcgi'
bundle install --without development test postgresql sqlite
5、配置Redmine使用fastcgi
cd /redmine/public
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess
6、也可以使用apache mod_fcgid作为cgi接口
wget http://apache.etoak.com//httpd/mod_fcgid/mod_fcgid-2.3.7.tar.gz
tar zxvf mod_fcgid-2.3.7.tar.gz
cd mod_fcgid
./configure.apxs
make
make install
vi /etc/httpd/conf.d/mod_fcgid.conf
LoadModule fcgid_module /usr/lib/httpd/modules/mod_fcgid.so
<IfModule mod_fcgid.c>
SocketPath /tmp/fcgid_sock/
AddHandler fcgid-script .fcgi
</IfModule>
三、其他设置
1、防火墙
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
2、seLinux 由于Passenger_mod_apache2的原因需要改变selinux的模式
setenforce Permissive
vi /etc/selinux/config
SELINUX=permissive