this is based on redmine-1.0.0
we need a more recent version of rails
and rubygems
than those shipped with lenny, so first add the backports-repository to your sources.list:
deb http://www.backports.org/debian lenny-backports main contrib non-free
then, update your package list:
sudo apt-get update
and install the above mentioned packages
sudo aptitude -t lenny-backports install rails rubygems
in addition, librmagick and ruby’s mysql bindings are required:
sudo aptitude install librmagick-ruby1.8 libmysql-ruby1.8
next, we need an additional gem called rack
which is not available as a debian package in the required version (has to be 1.0.1 sharp). thus, we install it locally in a separate directory below /opt/
. so lets create a directory for the gems, set the path accordingly and install the gem:
sudo mkdir /opt/ruby_gems
sudo chown $(whoami): /opt/ruby_gems
export GEM_HOME=/opt/ruby_gems
gem install rack -v=1.0.1
create a database and a corresponding user in mysql:
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER ‘redmine’@‘localhost’ IDENTIFIED BY ‘my_password’;
GRANT ALL PRIVILEGES ON redmine.* TO ‘redmine’@‘localhost’;
of course we need to download redmine itself, which can be found on rubyforge.org. we’ll put it somewhere in /opt/
as well, so:
tar xzf redmine-1.0.0.tar.gz
sudo mv redmine-1.0.0 /opt/redmine
cd /opt/redmine/config
cp -v database.yml.example database.yml
cp -v email.yml.example email.yml
vim database.yml
vim email.yml
rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
sudo chown -R root.root .
sudo chown -R www-data.www-data files log tmp public/plugin_assets
sudo chown -R root.root /opt/ruby_gems
cd /var/www
sudo ln -s /opt/redmine/public/ redmine
make sure the apache modules mod_rewrite and mod_passenger are enabled, then edit your apache virtualhost configuration and add the following section:
#
RailsEnv production
RailsBaseURI /redmine
Options -MultiViews
AllowOverride all
#
since we have installed the rack-gem in a non-standard location, we have to pass this information along to the ruby-process. in an interactive shell-session, this can be done by simply exporting the relevant variable(s). since our ruby is called by apache, we have to append this into /etc/apache/envvars
(see stackoverflow #79474 and blog-entry 223 on phusion for more information):
sudo -s -H
echo ‘export GEM_HOME=/opt/ruby_gems’ >> /etc/apache2/envvars
exit
now the last obstacle is the way phusion passenger handles privileges for the script to call: it runs a Rails application as the owner of environment.rb (see rubyforge issue #23105 for details), so we need to do a final chown on that file to make sure redmine has write-access to the files owned by www-data (this is certainly a security-issue, so creating a separate user for redmine instead of using www-data is by far the more elegant solution…)
sudo chown www-data.www-data config/environment.rb
that should be all, now restart apache and navigate to your redmine-installation:
sudo apache2ctl graceful