Project

General

Profile

HowTo Install Redmine on Debian 8 with Apache2-Passenger » History » Revision 12

Revision 11 (Mike Zabala, 2015-08-31 13:29) → Revision 12/14 (Raúl Priego, 2016-07-30 10:35)

h1. 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. 

 h2. 1. Install Debain Packages 

 <pre> 
 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 
 </pre> 


 h2. 2. Download and prepare Redmine 

 h3. 2.1 Download Redmine 

 <pre> 
 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 
 </pre> 


 h3. 2.2 Prepare MySQL  

 <pre> 
 mysql --user=root --password=$password 
 </pre> 


 <pre> 
 CREATE DATABASE redmine CHARACTER SET utf8; 
 CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password'; 
 GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost'; 
 exit 
 </pre> 

 Redmine DB-Config: 

 <pre> 
 cp config/database.yml.example config/database.yml 
 </pre> 

 customize config/database.yml: 

 <pre> 
 production: 
   adapter: mysql2 
   database: redmine 
   host: localhost 
   username: redmine 
   password: my_password 
 </pre> 

 h3. 2.3 Bundler 

 install bundler:  

 <pre> 
 sudo gem install bundler 
 bundle install --without development test 
 </pre> 

 generate secret token: 

 <pre> 
 bundle exec rake generate_secret_token 
 </pre> 

 prepare DB and install all tables: 

 <pre> 
 RAILS_ENV=production bundle exec rake db:migrate 
 RAILS_ENV=production bundle exec rake redmine:load_default_data 
 </pre> 

 h3. 2.4 Test Redmine 

 replace $IP with your external IP: 
 <pre> 
 bundle exec ruby bin/rails server -b $IP webrick -e production 
 </pre> 

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

 h2. 3 Apache 

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

 <pre> 
 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 
 </pre> 

 Link the redmine public dir to the apache root: 

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

 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: 
 <pre> 
 sudo vim /etc/apache2/sites-available/master.conf 
 </pre> 

 and for redmine you need: 

 <pre> 
 <VirtualHost *:80> 

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

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

 </VirtualHost> 
 </pre> 

 Disable debians default-vhost: 
 <pre> 
 sudo a2dissite 000-default.conf 
 </pre> 

 and enable the new master vhost: 
 <pre> 
 sudo a2ensite master.conf 
 </pre> 

 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: 
 <pre> 
 PassengerUser www-data 
 </pre> 

 after all restart apache: 
 <pre> 
 sudo service apache2 restart 
 </pre> 

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