Project

General

Profile

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

Revision 7 (Dirk Abe, 2015-04-06 10:57) → Revision 8/14 (Greg Stevenson, 2015-06-04 01:29)

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 libzlib-ruby libssl-dev libyaml-dev libcurl4-openssl-dev ruby gem libapache2-mod-passenger apache2-mpm-prefork apache2-dev apache2-prefork-dev libapr1-dev libxslt1-dev libxslt-dev checkinstall libxml2-dev ruby-dev vim 
 </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: mysql 
   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 rmagick 
 </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 
 </pre> 

 Link the redmine public dir to the apache root: 

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