|The instructions provided in this article or section are considered advanced.|
You are expected to be knowledgeable in the UNIX shell.
|The instructions provided in this article or section require shell access unless otherwise stated.|
You can use the PuTTY client on Windows, or SSH on UNIX and UNIX-like systems such as Linux or Mac OS X.
- 1 Initial installation
- 2 Configuring a repository
- 3 Configuring email
- 4 How to Fix Redmine if Dreamhost Upgrades to a Newer Version of Rails
- 5 Fixing the problems in browsing a Mercurial repository
- 6 Alternative Packages
Note: The most up-to-date instructions on how to install Redmine are available here. You may just want to follow those instructions once you get Ruby on Rails set up on a subdomain and a MySQL database created. (If you're on shared hosting, don't run the WEBrick test server mentioned in the directions; it's against Dreamhost's policy.)
For help on using the shell you can take a look at the UNIX commands and you can also get help on changing directories. If you want to save the output for debugging and support then you can look at the Redirection Symbol.
This details installation of Redmine 2.0 using FCGI (see also http://wiki.dreamhost.com/Rails_3#Using_FastCGI). Use FCGI and NOT Passenger since Dreamhost's current Passenger version is out of date. (May 19 2012 Passenger is currently v2.2.9, which was released in Jan 2010).
Create a new subdomain and a new MySQL database
- From the Dreamhost control panel, create a new subdomain for Redmine such as yoursubdomain.yourdomain.com. (If you're attempting to install Redmine anywhere other than the subdomain root, you'll also need to follow some additional steps or else you will start receiving routing errors as you continue through these setup instructions.)
- Do NOT enable Passenger. Dreamhost's Passenger version is old and buggy. Use FCGI instead of Passenger - make sure the PHP mode dropdown says PHP x.y.z FastCGI.
- Specify your web directory: /home/username/yoursubdomain.yourdomain.com/public. You must add public. It is the actual web interface; additional code is contained in parent and sibling folders. Note that if you are planning to use an svn checkout of redmine, you do not need to create the /public directory as it is a part of the repository and has additional files under it.
- From the Dreamhost control panel create a new MySQL database named yourdatabasename.
Get the Redmine source code
ssh into your Dreamhost account and run
cd ~/yoursubdomain.yourdomain.com hg clone --updaterev 2.0-stable https://bitbucket.org/redmine/redmine-all redmine-2.0
Check http://www.redmine.org/wiki/redmine/Download for the latest version
Alternative download methods
There are a few alternatives to using mercurial to get the source code.
- Use svn to download and update the source code
svn checkout http://redmine.rubyforge.org/svn/branches/2.0-stable redmine-2.0
- As another alternative, if you don't want to be able to update Redmine, you can do
svn export --force svn://rubyforge.org/var/svn/redmine/branches/2.0-stable redmine-2.0
- Or manually unpack a source tarball from Rubyforge
wget http://rubyforge.org/frs/download.php/76259/redmine-2.0.3.tar.gz tar -zxvf redmine-2.0.3.tar.gz
Configure the Redmine installation
- Create the
cd ~/yoursubdomain.yourdomain.com/redmine-2.0/config cp database.yml.example database.yml
database.ymlwith a text editor. Change the
productionstanza to your settings (be careful to preserve the whitespace):
production: adapter: mysql database: your_redmine_database_name host: your_dreamhost_mysql_hostname username: your_dreamhost_mysql_username password: your_dreamhost_mysql_passsword encoding: utf8
- Install gems, run rake, etc. as per the official installation instructions.
Configure the FCGI dispatcher
Per Stack Overflow you may need to add back environment variables in the dispatcher in order to get your Rails app to start loading properly on Dreamhost shared hosting. Add the following lines below the shebang in /public/dispatch.fcgi (copy from the example if there isn't one there yet):
ENV['RAILS_ENV'] = 'production' ENV['HOME'] ||= `echo ~`.strip ENV['GEM_HOME'] = File.expand_path('~/.gems') ENV['GEM_PATH'] = File.expand_path('~/.gems') + ":" + '/usr/lib/ruby/gems/1.8'
You can also copy the .htaccess example in the /public directory if you want to use Redmine's 404.html or 500.html pages. Or start from an example like the one referenced in this thread.
Configuring a repository
When a new project is made you will probably link a repository to it. Our Redmine setup is on a Dreamhost PS account. This should work on a shared account but YMMV.
Go to the project. Then settings -> repository -> Create. Choose the repository type and enter its full local path. For example, for git:
It is important to tell Redmine to look for new repositories. Execute this line:
ruby /home/username/sub.domain.com/script/runner "Repository.fetch_changesets" -e production
Change production for any environment you made.
Edited from Matt Jones' Blog
The easiest way to send email on a Dreamhost PS account is just to use sendmail.
cp config/email.yml.example config/email.yml Edit email.yml, look for the section marked “=== Sendmail command” and uncomment the following lines so it looks like this:
# === Sendmail command # production: delivery_method: :sendmail #
Be sure to comment out any other "production" sections that may appear after this section.
After changing the e-mail settings don't forget to restart Passenger by adding the file restart.txt to the tmp folder.
- Change directory (cd) to the root of the redmine install and issue the following command to restart the redmine application.
How to Fix Redmine if Dreamhost Upgrades to a Newer Version of Rails
Sometimes Dreamhost upgrades Rails (or doesn't upgrade it fast enough to keep up with new versions of Redmine), which can break Redmine since it is fairly particular about rails versions -- the 0.9.x codebase expects rails 2.3.5, for example. Dreamhost upgraded several servers to Rails 2.2.2 on 1/5/09, breaking several Redmine instances. In the user discussion that followed this event, one helpful Dreamhost customer shared the following steps for re-installing Rails 2.0.2 and "freezing" Redmine so that it will continue using the old version, even if Dreamhost upgrades Rails again in the future. The following steps have been updated to show how to install rails 2.3.5. (Note: the original discussion can be viewed at http://www.dreamhoststatus.com/2009/01/05/hooray-another-rails-upgrade/):
1. Remove old Rails installations (these overcome the "the rack(0.3.0 not >= 0.9.0)" error.): rm -fR /home/YOUR_DOMAIN/.gem rm -fR /home/YOUR_DOMAIN/REDMINE_DIR/vendor/rails 2. Edit REDMINE_DIR/config/environment.rb and ensure it has the following lines: RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION ENV['GEM_PATH'] = '/home/YOUR_DOMAIN/.gem:/usr/lib/ruby/gems/1.8' 3. Navigate to your Redmine directory and install ROR v2.3.5 (highest version of Rails supported by Redmine): gem install -v=2.3.5 rails Note: You will probably get 2 WARNINGs - we have taken these into account in step 2. 4. Freeze your Redmine to use 2.3.5 and nothing else: rake rails:freeze:edge TAG=rel_2-3-5 IMPORTANT: Do NOT type “rake rails:freeze:gems” - this breaks it again. Also, I did not need to run “rake rails:update”. 5. Replace REDMINE_DIR/config/boot.rb with REDMINE_DIR/vendor/rails/railties/environments/boot.rb. This overcomes the “undefined method 'install_gem_spec_stubs' for #)” error.
Note: You may experience a small delay (up to an hour?) before Redmine starts working again.
WARNING: rake rails:freeze:edge TAG=rel_2-3-5 no long works! --Ericvh 10:22, 20 December 2010 (PST)
To get by the problem with "rake rails:freeze..." timing out use the following from the REDMINE_DIR:
git clone --branch=2-3-stable git://github.com/rails/rails.git rails cd rails git checkout v2.3.5
Update: In December 2010, Dreamhost upgraded Rails to version 3.0.3, which broke many installations of Redmine.
Instructions for fixing have been provided by paulorcf on the VPIData blog:
1. $ rake VERSION=2.3.5 rails:freeze:gems 2. $ cd vendor/rails/activesupport/lib/active_support/ 3. $ vim vendor.rb 4. Edit line 24 ( http://stackoverflow.com/questions/2975532/have-rails-2-3-x-ignore-the-i18n-gem ) gem 'i18n', '>= 0.1.3', '< 0.4.0' 5. $ cd - 6. $ rm -rf tmp/restart.txt 7. $ touch tmp/restart.txt
Fixing the problems in browsing a Mercurial repository
If you use Mercurial as your repository in Redmine and self compiled your own Mercurial in your home directory, you might be getting a 500 error whenever trying to browse the repository. The problem is merely that Redmine does not find your Mercurial Binary and your Python library. To solve the issue, please do the following modifications:
In newer versions of Redmine simply:
- cp config/configuration.yml.example config/configuration.yml
- nano config/configuration.yml
- Look for the line containing "scm_mercurial_command", and add the path to your Mercurial binary.
Or for older versions:
- Open ~/<your-redmine-domain>/config/environment.rb
- Add ENV["PYTHONPATH"] = '/<your-home-directory>/lib/python'
- Save the file and close
- Open ~/<your-redmine-domain/lib/redmine/scm/adapters/mercurial_adapter.rb
- Modify the line that says HGBIN to the following: HGBIN = '/<your-home-directory>/bin/hg'
- Save the file and close
- Restart the Application
- Create a file at: ~/<your-redmine-domain>/tmp/restart.txt with empty contents
- If such a file already exits, just update it using: touch ~/<your-redmine-domain>/tmp/restart.txt
- Now Browse your site and you'll see everything working fine.
Mantis is a PHP bug tracker