26 04 2013
Installing Redmine on cPanel.
This guide shows how you to install Redmine with RoR on a cPanel server.
Install ruby using the cPanel installer.
/scripts/installruby
Install passenger.
gem install passenger passenger-install-apache2-module
Once the passenger 2 apache module is installed, add the bits it tells you to the following file.
nano /usr/local/apache/conf/includes/pre_virtualhost_2.conf
It should look like this;
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19 PassengerRuby /usr/bin/ruby
Once it’s added, rebuild the httpd config.
/usr/local/cpanel/bin/apache_conf_distiller --update /usr/local/cpanel/bin/build_apache_conf service httpd restart
Download/extract redmine.
cd /usr/src wget http://rubyforge.org/frs/download.php/75814/redmine-1.3.1.tar.gz tar -xvf redmine-1.3.1.tar.gz mv redmine-1.3.1 redmine
Prepare the redmine directory.
mv redmine/config/database.yml.example redmine/config/database.yml mv redmine/public/dispatch.cgi.example redmine/public/dispatch.cgi mv redmine/public/dispatch.fcgi.example redmine/public/dispatch.fcgi mv redmine/public/dispatch.rb.example redmine/public/dispatch.rb mv redmine/public/htaccess.fcgi.example redmine/public/.htaccess
Create a database in cPanel and edit the config file.
nano redmine/config/database.yml
It should look like this;
production: adapter: mysql database: user_redmine host: localhost username: user_redmine password: strongpassword
Install an older version of rubygems.
cd /usr/src wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.2.tgz tar -xvf rubygems-1.4.2.tgz cd rubygems-1.4.2 ruby setup.rb
Install bundler.
gem install bundler
Move the redmine directory to the users public_html (or doc root if it’s a subdomain).
cd /usr/src mv redmine /home/user/public_html
Edit the environment file and uncomment “ENV[‘RAILS_ENV’] ||= ‘production'”
nano /home/user/public_html/config/environment.rb
Run the following;
RAS_ENV=production bundle exec rake generate_session_store RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production bundle exec rake redmine:load_default_data
Create the include directory tree.
mkdir -p /usr/local/apache/conf/userdata/std/2/<user>/<domain>/
Create the include file.
nano /usr/local/apache/conf/userdata/std/2/<user>/<domain>/redmine.conf
Enter the following;
RailsEnv production RailsBaseURI / PassengerAppRoot /home/<user>/public_html DocumentRoot /home/<user>/public_html/public
Rebuild the httpd to include the custom include.
/usr/local/cpanel/bin/apache_conf_distiller --update /usr/local/cpanel/bin/build_apache_conf service httpd restart
Fix the permissions.
chown -R user:user /home/<user>/public_html chown user:nobody /home/<user>/public_html chmod -R 755 /home/<user>/public_html
If it’s all gone well you will be able to access redmine at the domain/subdomain. If you want to install it in a directory, you just need to edit the relevant config files and set the ‘RailsBaseURI’ to /<directory>.
XenServer to KVM migration. PHP Handler in cPanel