http://www.mylinuxguide.com/installing-redmine-with-passenger-and-apache-on-centos-6-3/
Installing Redmine with Passenger and Apache on Centos 6.3
1. Install prerequisite / dependencies :
yum install subversion make gcc gcc-c++ zlib-devel ruby-devel rubygems ruby-libs apr-devel apr-util-devel httpd-devel mysql-devel mysql-server automake autoconf ImageMagick ImageMagick-devel curl-devel
2. Go to the directory where you want to download Redmine Code and check out the files using svn command :
svn co http://svn.redmine.org/redmine/branches/2.1-stable redmine
3. Install the ruby gem named bundle :
gem install bundle
4. Now go to the redmine directory and install the redmine’s ruby dependencies using the bundler :
bundle install --without postgresql sqlite test development
Now Lets Setup the MySQL Database
Now Create the MySQL Database for the redmine and create a user with access to that database :
mysql
create database redmine character set utf8;
grant all privileges on redmine.* to ‘redmineUser’@’localhost’ identified by redminePassword;
flush privileges;
quit;
Now create the database configuration file for redmine :
cd /path/to/redmineDir/config
cp database.yml.example database.yml
vi database.yml
Now in the database.yml file enter the database information in the production section as shown below :
production: adapter: mysql database: redmine host: localhost username: redmineUser password: redminePassword encoding: utf8
Now populate the database using the rake command :
cd /path/to/redmineDir
rake generate_secret_token rake db:migrate RAILS_ENV="production" rake redmine:load_default_data RAILS_ENV="production"
Configure outgoing Email :
cd /path/to/redmineDir/config cp configuration.yml.example configuration.yml
Please read the email configuration section at the end for setting up outgoing email configuration, for now we will proceed and come back to email configuration at the end.
As of now you should be able to test the redmine in standalone mode. Run the following command to run redmine in the standalone mode :
ruby script/server webrick -e production
Note : You need to be inside your redmine dir to run above command .
Now open the following URL and you should see the redmine in your browser :
http://serverIp:3000
Now let’s Install Passenger module for apache which will allow us to browse ruby application using apache . We will install phusion passenger for this and we will need to install the gem first :
gem install passenger
Now install the apache module for passenger :
passenger-install-apache2-module
Now we create the apache configuration for redmine :
vi /etc/httpd/conf.d/redmine.conf
Now paste the following content into the redmine.conf , please adjust the configuration to suite your environment :
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.18/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.18 PassengerRuby /usr/bin/ruby <VirtualHost *:80> ServerName redmine.hostname.com DocumentRoot /path/to/redmineDir/public <Directory /path/to/redmineDir/public> AllowOverride all #loosen apache security Options -MultiViews #turn of multi views 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>
Make sure that these directories are writable by the web user : (nobody user is used for rack )
chown -R apache:nobody files/ log/ tmp/ tmp/pdf/
chmod -R 770 files/ log/ tmp/ tmp/pdf/
Now Change the ownership of the directory, test the configuration and start / restart apache :
chown -R apache:root /path/to/redmineDir/
service httpd configtest
service httpd restart
Quick Tips :
Clean up all the devel packages that were installed during installation :
yum remove '*-devel' make automake autoconf
Restarting Redmine :
touch /path/to/redmineDir/tmp/restart.txt
Migrating restored data from previous version :
First Backup the database from old Redmine install, restore into the new database, sync the files directory from old installation to new installation and then run the migrate command :
cd /path/to/redmineDir
rake db:migrate RAILS_ENV=”production”
Email Settings :
Using Gmail as outbound SMTP :
production: email_delivery: delivery_method: :smtp smtp_settings: enable_starttls_auto: true address: "smtp.gmail.com" port: '587' domain: "smtp.gmail.com" authentication: :plain user_name: "your_email@gmail.com" password: "your_password"
Using your own SMTP with authentication :
production: email_delivery: delivery_method: :smtp smtp_settings: address: smtp.yourdomain.com port: 25 domain: example.net authentication: :login user_name: redmine@yourdomain.com password: redmine
Your own SMTP without authentication :
production: email_delivery: delivery_method: :smtp smtp_settings: address: smtp.yourdomain.com port: 25 domain: yourdomain.com authentication: :none
Using Local Sendmail :
production: email_delivery: delivery_method: :sendmail
Common Issues and Resolutions :
Error while sending mail notificaiton “ hostname was not match with the server certificate”
Add this line to the email settings :
openssl_verify_mode: none
- mysql2 is not part of the bundle. Add it to Gemfile
If you get the above error, that means, mysql2 adapter has not been included in your Gem file , open the gem file in your redmine root directory and add it to the list :
gem 'rails', '3.2.8' gem "jquery-rails", "~> 2.0.2" gem "i18n", "~> 0.6.0" gem "coderay", "~> 1.0.6" gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] gem "builder", "3.0.0"
Make it look like :
gem 'rails', '3.2.8' gem "jquery-rails", "~> 2.0.2" gem "i18n", "~> 0.6.0" gem "coderay", "~> 1.0.6" gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] gem "builder", "3.0.0" gem "mysql2", "~> 0.3.11"
Now run the bundle installer again with the following command :
bundle install --without postgresql sqlite test development
Now verify that the mysql2 adapter has been installed :
bundle show mysql2
Now you should be good.. continue with the other steps from where you got this issue.
Clearing Redmine Cache
rake tmp:cache:clear RAILS_ENV=production rake tmp:sessions:clear RAILS_ENV=production
版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则按侵权处理.