Redmine 2.x in cPanel (requires custom Ruby on Rails)

Tatsujin

Registered
Dec 18, 2005
4
0
151
Installing Redmine 2.x to cPanel

NOTE: This requires that you have already followed my guide on installing Rails 3.x and mod_passenger for Apache. The latest version of Redmine (2.x) is no longer compatible with Rails 1.x/2.x. If you need to install just Redmine 1.x, the normal methods will work with cPanel's default Ruby/RoR setup.

NOTE: This is highly unsupported. Following this script will guarantee a clean install, but I am not very experienced with Rails applications.

NOTE: This guide also assumes that you will be running Redmine directly at the root of a domain or subdomain vhost in cPanel. Note that all of the rails files need to be one directory above the DocumentRoot for your virtual host, and the 'public' directory within the rails app needs to be moved to the real DocumentRoot. You can create a symbolic link to accomplish this. The examples I use below are for if Redmine is installed to the root of a main domain.

Installing Redmine

If a cPanel account doesn't exist, create one. Then create a database and user in WHM named username_redmine and assign the user to the DB

The following will calibrate your shell session and install improved MySQL support for Ruby Gems along with the bundler application the redmine install process uses

Code:
shopt -s dotglob
gem install mysql2
gem install bundler
Download source for redmine, latest tar.gz from their RubyForge page to /usr/local/src

Code:
cd /usr/local/src
wget http://rubyforge.org/frs/download.php/XXXXX/redmine-version.tar.gz
tar -xzvf redmine-version.tar.gz
chown -R username:username /usr/local/src/redmine-version/*
mv /usr/local/src/redmine-version/* /home/username/
(this may merge the tmp folder from the rails app with the cPanel account’s tmp folder, which is normal)

Below, you are moving the webroot portion of the rails app to your document root for the cPanel account, and then creating a symlink so Rails is none the wiser

Code:
mv /home/username/public/* /home/username/public_html
rm -rf /home/username/public
ln -s /home/username/public_html /home/username/public
This will finalize the install by installing all of the necessary gems and populating the default production database. This install assumes you are not using a development and/or test database

Code:
cd /home/username
bundle install --without development test postgresql sqlite
cp /home/username/config/database.yml.example /home/username/config/database.yml
Edit /home/username/config/database.yml so it has the access information for the database (production, we skipped test and dev)

Code:
cd /home/username
rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
Load the application using mod_passenger

Add the following to the custom vhost config for the domain (you may have to create the directory structure)

Code:
mkdir -p /usr/local/apache/conf/userdata/std/2/username/domain.com
edit /usr/local/apache/conf/userdata/std/2/username/domain.com/redmine.conf

Code:
PassengerSpawnMethod smart
PassengerPoolIdleTime 300
PassengerMaxPreloaderIdleTime 0
PassengerMaxRequests 5000
PassengerStatThrottleRate 5
PassengerMinInstances 3
 
<Location />
Options Indexes -ExecCGI FollowSymLinks -MultiViews
# AllowOverride None
Order allow,deny
Allow from all
 
# mod_rails
# PassengerUser redmine
#RailsEnv edoceo_live
RackBaseURI /
 
# environment.rb
# Redmine::Utils::relative_url_root = "/"   
</Location>
Next, add this to /etc/httpd/conf/includes/post_virtualhost_global.conf

Code:
PassengerPreStart http://domain.com
Look up your vhost in /etc/httpd/conf/httpd.conf and look for the line:

Code:
     # To customize this VirtualHost use an include file at the following location
     # Include "/usr/local/apache/conf/userdata/std/2/username/domain.com/*.conf"
Uncomment the include line, and restart Apache to verify it works fine. Once restarted OK, distill it to the distiller:

Code:
/usr/local/cpanel/bin/apache_conf_distiller --update
/usr/local/cpanel/bin/build_apache_conf
Your redmine application should now be accessible at http://domain.com

The default login is admin / admin
 

tomdchi

Well-Known Member
Feb 24, 2008
138
2
68
Atlanta, GA
cPanel Access Level
DataCenter Provider
since you have made the redmine.conf file in /usr/local/apache/conf/userdata/std/2/username/domain.com/redmine.conf there is no need to uncomment the include line in httpd.conf
That line is just there as a reference to tell you where to put your include files.
 

ITGabs

Well-Known Member
Jul 30, 2013
81
0
6
cPanel Access Level
Root Administrator
Hi, everything work great at my end with:
WHM 11.40.0 (build 19)
redmine 2.3.3
apache 2.2.x with mod_fcgid

Probably for my setup I got a 403 error page

the public_html need the group nobody for run with apache
chown :nobody /home/username/public_html/

Thanks!
 

kemal

Registered
May 1, 2015
2
0
1
Turkey
cPanel Access Level
Root Administrator
I get this error when i try to bundle-install
Code:
Gemfile syntax error compile error
on line 18: syntax error, unexpected ':', expecting $end
gem 'tzinfo-data', platforms: [:mingw, :x64_mingw, :mswin, :jruby]
Any suggestions?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,205
363
This is unsupported, but you may receive more user-feedback if you verify the exact command you entered to receive that error message. While it's likely the same one as what's listed in the instructions, it helps to provide as many details as possible.

Thank you.
 

Kent Brockman

Well-Known Member
PartnerNOC
Jan 20, 2008
1,255
60
178
Buenos Aires, Argentina
cPanel Access Level
Root Administrator
Hello! Does anybody know if these instructions are still working with the last version of cPanel + Redmine 3.x? If don't, can you point me to any other updated tutorial out there?