How to Install Redmine with Ruby on Rails and Passenger
Note:
- Installing Redmine with Ruby on Rails and Passenger is outside the Scope of Bluehost's Technical Support.
- Before you begin, you will need SSH access.
- Prerequisites for Redmine Installation
- Step-by-Step Guide to Install Redmine
- Troubleshooting Remine Installation Errors
- Summary
Prerequisites for Redmine Installation
Install Ruby on Rails and Passenger
This article assumes you are logged in to the server through SSH as root.
- Installing the Basics - We will use the installruby script, located in /scripts, to get started. While this script installs more than what is listed here, below is what is important to take note of:
- Ruby 1.8,7
- RubyGems 2.1.9, and 1.8.25
- rails-2.3.18
- rake-10.1.0
- rack-1.1.6
- mongrel-1.1.5
# /scripts/installruby
- Installing Passenger - Now that Ruby is installed, we will use the following command:
# gem install passenger mysql
- Installing curl-devel
# yum install curl-devel
- Installing postgresql-devel
# yum install postgresql-devel
- Installing ImageMagick
# /scripts/installimagemagick
- Installing Passenger modules for Apache
# passenger-install-apache2-module
The system will check to see what you are missing. Press Enter.- When prompted, "Are you sure you want to install against Apache 2.2.24 (/usr/bin/apxs)? [y/n]:", type the letter "y" and press Enter. This will return, "The Apache 2 module was successfully installed".
- Press Enter.
- Add the lines below to the file.
/usr/local/apache/conf/includes/pre_main_2.conf
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.21/buildout/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.21 PassengerDefaultRuby /usr/bin/ruby
echo -en "LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.21/buildout/apache2/mod_passenger.so\nPassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.21\nPassengerDefaultRuby /usr/bin/ruby\n" >> /usr/local/apache/conf/includes/pre_main_2.conf
- Restart Apache
# service httpd restart
- Switch to your cPanel User - Now, you must install your application as the cPanel user, or else you will run into permission issues.
# su cpanelusr # cd ~
The final step is to install the application.
Step-by-Step Guide to Install Redmine
publishing the site
# rake db:migrate RAILS_ENV=production
- Create a rails_app folder and redmine folder within it, then go inside that folder.
# mkdir -p ~/rails_apps/redmine/ # cd ~/rails_apps/redmine/
- Download Redmine 2.1.4, extract it and move the content out, then delete the files not being used.
# wget http://rubyforge.org/frs/download.php/76589/redmine-2.1.4.tar.gz # tar xvzf redmine-2.1.4.tar.gz # mv redmine-2.1.4/* ./ # rm -rf redmine-2.1.4*
- Move example files where they can be used.
# cd config # mv database.yml.example database.yml # mv configuration.yml.example configuration.yml
- Creating the MySQL Database/User/Password - For step-by-step instructions, check out How to Create and Delete MySQL Databases and Users. Make sure to assign the user to the database with full permissions.
- Modifying your database.yml file
# vim database.yml
Modify these lines:
production: adapter: mysql database: redmine host: localhost username: root password: encoding: utf8
- Updating the ~/rails_apps/redmine/public/.htaccess file
# cd ../public/ # pwd
/home#/user/rails_apps/redmine/public
# vim .htaccess
Options -MultiViews PassengerResolveSymlinksInDocumentRoot on #Set this to whatever environment you'll be running in RailsEnv production RackBaseURI / SetEnv GEM_HOME /home1/examplec/ruby/gems
SetEnv GEM_HOME /home#/user/ruby/gems
- Creating the subdomain - The goal is to point the subdomain to the Redmine folder. If you don't have one in mind, you can simply use Redmine as your subdomain. Follow the steps in What Is A Subdomain And How Does It Work? How To Create A Subdomain for instructions. Make sure to create a subdomain going to the document root of Redmine.
- Creating the symlink
Now you need to delete the redmine folder. You can delete this from within the ~/public_html directory:# rm -rf redmine
# ln -s ~/rails_app/redmine/public redmine
- Updating your ~/.bashrc file
Add these lines to the bottom of your ~/.bashrc file:export HPATH=$HOME export GEM_HOME=$HPATH/ruby/gems export GEM_PATH=$GEM_HOME:/lib64/ruby/gems/1.9.3 export GEM_CACHE=$GEM_HOME/cache export PATH=$PATH:$HPATH/ruby/gems/bin export PATH=$PATH:$HPATH/ruby/gems
# source ~/.bashrc
# rails -v
Rails 3.2.13
Invalid gemspec in [/home#/user/ruby/gems/specifications/mail-2.4.4.gemspec]: invalid date format in specification: "2012-03-14 00:00:00.000000000Z" Invalid gemspec in [/home#/user/ruby/gems/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Modify this line:s.date = %q{2012-03-14 00:00:00.000000000Z}
s.date = %q{2012-03-14}
# find $HOME/ruby/gems/specifications -name \*.gemspec | xargs sed -i "s/\ 00:00:00.000000000Z//"
# cd ~/rails_apps/redmine/ # bundle install # rake generate_session_store
- Running bundle install
The # rake generate_session_store is strictly related to redmine. Some other applications may use it after running the rake if you get this error:Invalid gemspec in [/home#/user/ruby/gems/specifications/jquery-rails-2.0.3.gemspec]: invalid date format in specification: "2012-08-16 00:00:00.000000000Z"
# bundle install
- Running generate_session_store or generate_secret_token
# rake generate_session_store
If you get an error saying that command is deprecated, run this command instead:# rake generate_secret_token
publishing the site # rake db:migrate RAILS_ENV=production
Troubleshooting Remine Installation Errors
Common Issues
# rails generate controller First list
/home4/lorentzo/ruby/gems/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)
from /home#/user/ruby/gems/gems/execjs-1.4.0/lib/execjs.rb:5
from /home#/user/ruby/gems/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
from /home#/user/ruby/gems/gems/coffee-script-2.2.0/lib/coffee_script.rb:1
from /home#/user/ruby/gems/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
from /home#/user/ruby/gems/gems/coffee-script-2.2.0/lib/coffee-script.rb:1
from /home#/user/ruby/gems/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
from /home#/user/ruby/gems/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1
from /home#/user/ruby/gems/gems/bundler-1.2.2/lib/bundler/runtime.rb:68:in `require'
from /home#/user/ruby/gems/gems/bundler-1.2.2/lib/bundler/runtime.rb:68:in `require'
from /home#/user/ruby/gems/gems/bundler-1.2.2/lib/bundler/runtime.rb:66:in `each'
from /home#/user/ruby/gems/gems/bundler-1.2.2/lib/bundler/runtime.rb:66:in `require'
from /home#/user/ruby/gems/gems/bundler-1.2.2/lib/bundler/runtime.rb:55:in `each'
from /home#/user/ruby/gems/gems/bundler-1.2.2/lib/bundler/runtime.rb:55:in `require'
from /home#/user/ruby/gems/gems/bundler-1.2.2/lib/bundler.rb:128:in `require'
from /home#/user/rails_apps/first/config/application.rb:7
from /home#/user/ruby/gems/gems/railties-3.2.9/lib/rails/commands.rb:24:in `require'
from /home#/user/ruby/gems/gems/railties-3.2.9/lib/rails/commands.rb:24
from script/rails:6:in `require'
from script/rails:6
Solution
# gem install therubyracer
Then, run:
# bundle install
Summary
Learn how to install Redmine with Ruby on Rails and Passenger. Please note that the installation process of Redmine with Ruby on Rails and Passenger falls outside the scope of technical support provided by Bluehost. The guide includes a list of prerequisites required for the installation of Redmine, a step-by-step guide to installing Redmine, and errors that may arise during Redmine installation and how to troubleshoot. This guide assumes you are logged in to the server via SSH as root and have SSH access.
If you need further assistance, feel free to contact us via Chat or Phone:
- Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
- Phone Support -
- US: 888-401-4678
- International: +1 801-765-9400
You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.