Project

General

Profile

Actions

HowTo Install Redmine on Debian 8 with Apache2-Passenger

Last updated: 4. April 2015

This HowTo describes installing redmine 3.0.1 on Debain 8 (April 15, few weeks before released as
stable) with Apache and MySQL.

Hint:
Run all commands as normal user. If root privileges required i used sudo (the 'sudo' package needs to be properly instaled and configured).

1. Install Debian Packages

sudo aptitude install mysql-server mysql-client libmysqlclient-dev gcc build-essential zlib1g zlib1g-dev zlibc ruby-zip libssl-dev libyaml-dev libcurl4-openssl-dev ruby gem libapache2-mod-passenger apache2-mpm-prefork apache2-dev libapr1-dev libxslt1-dev checkinstall libxml2-dev ruby-dev vim libmagickwand-dev imagemagick

2. Download and prepare Redmine

2.1 Download Redmine

cd /opt/
sudo mkdir redmine
sudo chown -R $your_user redmine
cd redmine
wget $redmine.tar.gz
tar xzf $redmine.tar.gz
cd redmine-X.X.X

2.2 Prepare MySQL

mysql --user=root --password=$password
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
exit

Redmine DB-Config:

cp config/database.yml.example config/database.yml

customize config/database.yml:

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: my_password

2.3 Bundler

install bundler:

sudo gem install bundler
bundle install --without development test

generate secret token:

bundle exec rake generate_secret_token

prepare DB and install all tables:

RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data

2.4 Test Redmine

replace $IP with your external IP:

bundle exec ruby bin/rails server -b $IP webrick -e production

Open your browser and visit http://$IP:3000

3 Apache

The apache service runs with the user www-data, so www-data needs access to some dirs:

sudo chown -R www-data files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets
sudo chown www-data:www-data Gemfile.lock

Link the redmine public dir to the apache root:

sudo ln -s /opt/redmine/redmine-X.X.X/public/ /var/www/html/redmine

The following VirtualHost config requieres control over your webserver.
Every Site under /var/www/html/ needs maybe an Location-directive.

We generate a new vhost config:

sudo vim /etc/apache2/sites-available/master.conf

and for redmine you need:

<VirtualHost *:80>

ServerAdmin admin@example.com
Servername hostname
DocumentRoot /var/www/html/

        <Location /redmine>
                RailsEnv production
                RackBaseURI /redmine
                Options -MultiViews
        </Location>

</VirtualHost>

Disable debians default-vhost:

sudo a2dissite 000-default.conf

and enable the new master vhost:

sudo a2ensite master.conf

To avoid permission error the passenger mod needs to run also as www-data.
Edit /etc/apache2/mods-available/passenger.conf and add this line:

PassengerUser www-data

after all restart apache:

sudo service apache2 restart

Open your browser and visit http://$IP/redmine
Finish.

Updated by Eric dLR over 7 years ago · 14 revisions