作者博文地址:https://www.cnblogs.com/liu-shuai/
环境:
CentOS-6.5+Nginx-1.8.0+Redmine-3.1.1+Ruby-2.0
1、配置环境
1 id www >/dev/null 2>&1 || useradd www 2 echo "www ALL=(ALL) ALL" >>/etc/sudoers 3 yum install gcc gcc-c++ make automake autoconf curl-devel openssl openssl-devel zlib-devel ImageMagick-devel –y
2、Mysql安装与配置
1 #安装mysql过程省略 2 service mysqld start 3 #创建Redmine数据库 4 mysql -uroot -p 5 >create database redmine character set utf8; 6 >grant all privileges on redmine.* to 'redmine'@'172.16.0.%' identified by 'redmineadmin' with grant option; 7 >flush privileges;
3、Ruby安装
1 cd /usr/local/src 2 tar fx ruby-2.0.0-p353.tar.gz 3 cd ruby-2.0.0-p353 4 ./configure --prefix=/usr/local/ruby 5 make && make install 6 #配置环境变量 7 echo "export PATH=$PATH:/usr/local/ruby/bin" >>/etc/profile 8 source /etc/profile
4、Rubygem安装配置
1 cd /usr/local/src 2 tar fx rubygems-2.5.1.tgz 3 cd rubygems-2.5.1 4 ruby setup.rb 5 ######################################## 6 #更换GEM镜像源 7 gem sources -a https://ruby.taobao.org/ 8 gem sources --remove https://rubygems.org/ 9 gem sources -l
10 #安装rails-4.2 11 gem install rails -v=4.2
5、Redmine安装配置
1 cd /usr/local/src 2 tar fx redmine-3.1.1.tar.gz 3 mv redmine-3.1.1 /var/www/html/redmine 4 cd /var/www/html/redmine/ 5 sed -i "s#source 'https://rubygems.org'#source 'https://ruby.taobao.org/'#" Gemfile 6 cp config/database.yml.example config/database.yml 7 sed -i "8s#host: localhost#host: 172.16.0.182#" config/database.yml 8 sed -i "9s#username: root#username: redmine#" config/database.yml 9 sed -i '10s#password: ""#password: "redmineadmin"#' config/database.yml
10 #安装bundle 11 gem install bundler 12 su - www -c "bundle install --without development test rmagick" 13 #################################################### 14 #配置rails环境 15 rake generate_secret_token 16 RAILS_ENV=production rake db:migrate 17 RAILS_ENV=production REDMINE_LANG=zh rake redmine:load_default_data 18 chown -R www.www /var/www/html/remine
6、Redmine启动与关闭
1 start 2 cd /var/www/html/redmine/ 3 ruby bin/rails server webrick -e production -d 4 #################################################### 5 stop 6 ps -aux |grep ruby 7 kill -9 'rubypid'
7、整合Nginx和Redmine
1 #Redmine安装passenger 2 cd /var/www/html/redmine/public 3 cp dispatch.fcgi.example dispatch.fcgi 4 cp htaccess.fcgi.example htaccess 5 gem install passenger 6 passenger-install-nginx-module 7 .....按提示安装 8 9 #配置Nginx 10 vim /usr/local/nginx/conf/nginx.conf 11 ....... 12 http { 13 passenger_root /usr/local/ruby/lib/ruby/gems/2.0.0/gems/passenger-5.0.23; 14 passenger_ruby /usr/local/ruby/bin/ruby; 15 ................................................ 16 ....................其余不变.................. 17 ................................................ 18 server { 19 listen 80; 20 root /var/www/html/redmine/public; 21 server_name work.manager.com; 22 passenger_enabled on; 23 } 24 } 25 26 service nginxd start
8、访问
http://work.manager.com