做者博文地址:https://www.cnblogs.com/liu-shuai/html
環境:mysql
CentOS-6.5+Nginx-1.8.0+Redmine-3.1.1+Ruby-2.0nginx
一、配置環境c++
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
二、Mysql安裝與配置web
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;
三、Ruby安裝sql
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
四、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
五、Redmine安裝配置vim
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
六、Redmine啓動與關閉ruby
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'
七、整合Nginx和Redminecurl
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
八、訪問
http://work.manager.com