CentOS 部署Redmine + MySQL + Nginx

安装MySQL

# yum install mysql mysql-server

配置MySQL安全

# service mysqld start
# mysql_secure_installation

设置MySQL开机启动

# chkconfig mysqld on

安装ruby

# yum install ruby
# yum install ruby-devel

安装rubygems

# yum install rubygems
# yum install rubygem-rake
# yum install rubygem-rack

安装ruby-mysql

# yum install ruby-mysql

安装gcc编译器

# yum install gcc

安装配置Redmine

# wget http://rubyforge.org/frs/download.php/75910/redmine-1.3.2.tar.gz
# tar zxvf redmine-1.3.2.tar.gz
# mkdir /var/www/
# mkdir /var/www/redmine
# cp -av redmine-1.3.2/* /var/www/redmine

创建redmine用户以及数据库

# mysql -u root -p
mysql> create database redmine character set utf8;
mysql> create user 'redmine'@'localhost' identified by 'my_password';
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
mysql> \q

修改数据库账号密码

# cp config/database.yml.example config/database.yml
# vim config/database.yml

改后如下结果:

production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password
encoding: utf8

# gem install rdoc

# RAILS_ENV=production rake generate_session_store

# RAILS_ENV=production rake db:migrate

# RAILS_ENV=production rake redmine:load_default_data

启动redmine

# ruby script/server -d webrick -e production

浏览器访问:http://ip:3000 测试redmine是否可以正常运行

安装nginx

# yum install nginx

设置nginx开机启动

# chkconfig nginx on

配置nginx做反向代理

# vim /etc/nginx/conf.d/redmine.conf

在配置文件中添加如下代码:

server {
    listen       80;
    server_name  redmine.example.com;

    location / {
        proxy_pass http://127.0.0.1:3000;
    }
}

设置redmine开机启动

# vim /etc/rc.local

在下面添加如下代码:

echo "start redmine:"
 /usr/bin/ruby /var/www/redmine/script/server -d webrick -e production

安装ImageMagick以便能够输出甘特图

# yum -y install ImageMagick