1.安装相关软件
yum install make gcc gcc-c++ zlib-devel ruby-devel rubygems ruby-libs apr-devel apr-util-devel httpd-devel mysql-devel automake autoconf ImageMagick ImageMagick-devel curl-devel mysql mysql-server
[注]需要安装ruby2.0版本按如下命令:
yum install make gcc gcc-c++ zlib-devel apr-devel apr-util-devel httpd-devel mysql-devel automake autoconf ImageMagick ImageMagick-devel curl-devel mysql mysql-server libffi-devel
安装ruby2.2
wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.gz
tar -zvxf ruby-2.2.0.tar.gz
cd ruby-2.2.0
./configure
#如果报错可以在后面加上 --enable-shared
make && make install
2.安装包组
yum groupinstall -y "Development Tools"
3.安装bundle ruby gem
gem install bundle
4.安装redmine
cd /var/www
wget http://rubyforge.org/frs/download.php/76255/redmine-2.4.2.tar.gz
tar zxf redmine-2.4.2.tar.gz
ln -s redmine-2.4.2 redmine
rm -f redmine-2.4.2.tar.gz
5.安装redmine ruby 依赖,解决依赖关系
cd /var/www/redmine
bundle install --without development test
6.修改mysql(5.1)配置文件,设置默认字符集为utf-8,默认引擎为innodb,启动mysql
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
vim /etc/my.cnf
在[client]下面添加
default-character-set=utf8
在[mysqld]下面添加
default-character-set=utf8
ignore-builtin-innodb
plugin-load=innodb=ha_innodb_plugin.so
plugin_dir=/usr/lib64/mysql/plugin/
default-storage-engine=INNODB
然后启动mysql,查看引擎
service mysqld start
mysql> show engines;
创建redmine库和用户
mysql> create database redmine character set utf8;
mysql> grant all privileges on redmine.* to 'redmine'@'localhost' identified by '123456';
mysql> flush privileges;
mysql> \q
7.创建,修改redmine的配置文件
cd /var/www/redmine/config
创建database配置文件
cp database.yml.example database.yml
修改database.yml
vim database.yml
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine#这个是上面sql语句里面创建的redmine账户
password: “123456”#账户密码
encoding: utf8
8.写入数据库
rake generate_secret_token
如果报错”Could not find gem 'mysql2 (~> 0.3.11) ruby' in the gems available on this machine.”
那么
bundle install
即可
rake db:migrate RAILS_ENV="production"
rake redmine:load_default_data RAILS_ENV="production"
选zh
9.创建邮件配置文件
cd /var/www/redmine/config
cp configuration.yml.example configuration.yml
vim configuration.yml
default:
# Outgoing emails configuration (see examples above)
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.exmail.qq.com#使用QQ企业邮箱就用这个
port: 25
domain: qq.com#使用QQ企业邮箱就用这个
authentication: :login
user_name: "*****@kangaiweishi.com"#你的发信邮箱
password: "******"#你的发信邮箱密码
10.启动redmine
ruby /var/www/redmine/script/rails server webrick -e production
去访问试试http://IP:3000
11.设置redmine和apache关联
yum install -y openssl-devel
gem install passenger
passenger-install-apache2-module
选1然后都是回车
12.修改相关配饰文件
vim /etc/httpd/conf.d/redmine.conf
# Loading Passenger
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-
4.0.42/buildout/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.42
PassengerRuby /usr/bin/ruby
<VirtualHost *:80>
ServerName 192.168.1.5#服务器的IP地址
DocumentRoot /var/www/redmine/public
<Directory /var/www/redmine/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
allow from all
</Directory>
ErrorLog "|/usr/sbin/rotatelogs /etc/httpd/logs/redmine-error.%Y-%m-%d.log 86400"
CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/redmine-access.%Y-%m-%d.log 86400" "%h %l %u %t %D \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
</VirtualHost>
修改apache配置文件
vim /etc/httpd/conf/httpd.conf
NameVirtualHost *:80#启用
修改ServerName www.example.com:80 为 ServerName localhost:80 并启用
检查apache配置文件是否有错
httpd -t
修改属主属组
chown -R apache:root /var/www/redmine
service httpd configtest
启动apache
service httpd start
chkconfig httpd on
但这样只是以独立的方式启动redmine的服务器,在后台执行,有些不足,因为客户端的访问日志会在终端上直接显示。并且你退出终端时,服务器进程也会跟着关闭,如果希望Redmine作为服务运行,加上-d参数即可:
ruby script/rails server webrick -e production -d
如果服务器上已经安装了phpRedisAdmin,并且phpRedisAdmin和redmine都跑在Apache上,这两者会不兼容。这时需要将redmine跑在nginx上,修改nginx的配置文件,做一个指向即可。
server {
listen 80;
server_name 192.168.1.101;
location / {
proxy_pass http://192.168.1.101:3000;
proxy_redirect default ;
}
进程中有redmine的启动命令(也可以在/etc/rc.local中查找):
[root@localhost conf]# ps -ef|grep redmine
root 7773 30406 0 10:44 pts/2 00:00:00 vim redmine.conf
root 9624 7709 0 11:12 pts/1 00:00:00 grep redmine
root 30350 1 0 10:32 ? 00:00:01 ruby /var/www/redmine/script/rails server mongrel -e production -d