时间:2021-07-01 10:21:17 帮助过:46人阅读
Apache/PHP/MariaDB环境按照2# CentOS 6.7 x64 Apache/PHP/Mariadb环境搭建
创建数据库
[root@centos2 ~]# mysql -u root -pmariadb.2016P <<EOF 2> /dev/null create database redmine default character set utf8; create user ‘redmineuser‘@‘%‘ identified by ‘redmine.2016P‘; grant all privileges on redmine.* to ‘redmineuser‘@‘%‘ identified by ‘redmine.2016P‘; flush privileges; EOF
下载、安装Ruby2.3/rubygems2.6.3
[root@centos2 src]# wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz [root@centos2 src]# wget http://production.cf.rubygems.org/rubygems/rubygems-2.6.3.tgz [root@centos2 src]# wget http://www.redmine.org/releases/redmine-3.2.1.tar.gz [root@centos2 src]# tar zxf ruby-2.3.0.tar.gz [root@centos2 ruby-2.3.0]# cd ruby-2.3.0 [root@centos2 ruby-2.3.0]# ./configure --prefix=/usr/local/ruby && make && make install [root@centos2 ruby-2.3.0]# echo "export PATH=/usr/local/ruby/bin:$PATH" > /etc/profile.d/ruby.sh [root@centos2 ruby-2.3.0]# source /etc/profile.d/ruby.sh [root@centos2 ruby-2.3.0]# cd .. [root@centos2 src]# tar xf rubygems-2.6.3.tgz [root@centos2 src]# cd rubygems-2.6.3 [root@centos2 rubygems-2.6.3]# ruby setup.rb
修改gem源
[root@centos2 src]# gem source --remove https://rubygems.org/ [root@centos2 src]# gem sources -a https://ruby.taobao.org/
配置Redmine
[root@centos2 src]# tar zxf redmine-3.2.1.tar.gz [root@centos2 src]# mv redmine-3.2.1 /data/redmine [root@centos2 src]# sed -i "s/source ‘https:\/\/rubygems.org‘/source ‘https:\/\/ruby.taobao.org‘/" /data/redmine/Gemfile [root@centos2 src]# cp /data/redmine/config/configuration.yml.example /data/redmine/config/configuration.yml [root@centos2 src]# cp /data/redmine/public/dispatch.fcgi.example /data/redmine/public/dispatch.fcgi [root@centos2 src]# cp /data/redmine/public/htaccess.fcgi.example /data/redmine/public/htaccess.fcgi [root@centos2 src]# sed -i ‘s/#imagemagick_convert_command:/imagemagick_convert_command:\ \/usr\/local\/imagemagick\/bin\/convert/‘ /data/redmine/config/configuration.yml [root@centos2 src]# sed -i ‘s/attachments_storage_path:/attachments_storage_path\: \/data\/redmine\/files/‘ /data/redmine/config/configuration.yml # 配置数据库 [root@centos2 src]# cat > /data/redmine/config/database.yml << EOF production: adapter: mysql2 database: redmine host: localhost username: redmineuser password: "redmine.2016P" encoding: utf8 EOF [root@centos2 src]# chown -R www.www /data/redmine [root@centos2 src]# mkdir /data/wwwlogs/redmine [root@centos2 src]# chown -R www:www /data/wwwlogs/redmine/ [root@centos2 src]# rm -rf /data/redmine/files/delete.me
配置Apache
[root@centos2 src]# mv /usr/local/apache/conf/vhost/0.conf{,\.bak} [root@centos2 src]# cat > /usr/local/apache/conf/vhost/redmine.conf << EOF <VirtualHost *:80> ServerName redmine.test.com ServerAdmin walter.jia@junlins.com DocumentRoot /data/redmine/public/ ErrorLog /data/wwwlogs/redmine/error_redmine_apache.log CustomLog /data/wwwlogs/redmine/access_redmine_apache.log common <Directory /data/redmine/public/> Options +indexes Order allow,deny Allow from all Require all granted </Directory> </VirtualHost> EOF
安装gem依赖包
[root@centos2 src]# gem install bundle [root@centos2 src]# gem install rbpdf-font [root@centos2 src]# gem install htmlentities -v=4.3.1 [root@centos2 src]# gem install rmagick --verbose -- --with-opt-dir=/usr/local/imagemagick --with-opt-include=/usr/local/imagemagick/include --with-opt-lib=/usr/local/imagemagick/lib --ruby=/usr/local/ruby [root@centos2 src]# gem install mysql2 -- --with-mysql-include=/usr/local/mariadb/include/mysql/ --with-mysql-lib=/usr/local/mariadb/lib/ --with-mysql-dir=/usr/local/mariadb/ [root@centos2 src]# gem install passenger -v=5.0.28 [root@centos2 src]# cat >> /usr/local/apache/conf/httpd.conf << EOF LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/2.3.0/gems/passenger-5.0.28/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /usr/local/ruby/lib/ruby/gems/2.3.0/gems/passenger-5.0.28 PassengerDefaultRuby /usr/local/ruby/bin/ruby </IfModule> EOF [root@centos2 src]# passenger-install-apache2-module --apxs2-path /usr/local/apache/bin/apxs --apr-config-path /usr/local/apache/bin/apr-1-config # 此处按回车
安装Redmine
[root@centos2 redmine]# cd /data/redmine [root@centos2 redmine]# bundle install --without development test postgresql sqlite [root@centos2 redmine]# sed -i "/inodot/{ n; s/‘inodot‘/#‘inodot‘/; }" /usr/local/ruby/lib/ruby/gems/2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb [root@centos2 redmine]# mv /data/redmine/lib/tasks/testing.rake{,\.bak} [root@centos2 redmine]# rm -rf /data/redmine/Gemfile.lock [root@centos2 redmine]# gem install rbpdf-font [root@centos2 redmine]# bundle install --without development test postgresql sqlite [root@centos2 redmine]# bundle exec rake generate_secret_token [root@centos2 redmine]# bundle exec rake db:migrate RAILS_ENV=production [root@centos2 redmine]# RAILS_ENV=production rake redmine:load_default_data # 此处输入"zh",然后按回车键
重启Apache
[root@centos2 redmine]# service httpd restart
访问Redmine
浏览器访问服务器的80端口
本文出自 “Junlins” 博客,请务必保留此出处http://junlins.blog.51cto.com/7601672/1789781
CentOS 6.7 x64 Apache/PHP/Mariadb环境安装Redmine3.2.1
标签:项目管理 redmine