HowTo Install Redmine on Debian 8 with Apache2-Passenger » History » Version 7

« Previous - Version 7/14 (diff) - Next » - Current version
Dirk Abe, 2015-04-06 10:57

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.

Run all commands as normal user. If root privileges required i used sudo.

1. Install Debain Packages

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

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 USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

Redmine DB-Config:

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

customize config/database.yml:

  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: my_password

2.3 Bundler

install bundler:

sudo gem install bundler
bundle install --without development test rmagick

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

Link the redmine public dir to the apache root:

sudo ln -s /opt/redmine/redmine-3.0.1/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>

Servername hostname
DocumentRoot /var/www/html/

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


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