Installation von redmine 3.1 auf Ubuntu Server 14.04.3 LTS

Diese Dokumentation basiert auf den Versionen
– Ubuntu Server 14.04.3 LTS
– Redmine 3.1.1 (2015-09-20)
Sicherlich kann diese jedoch auch für andere Versionen verwendet werden.

Installation grundlegender Pakete

$ sudo apt-get install -y vim ntp open-vm-tools ssh ldap-utils sendmail mailutils

Installation Ruby

$ sudo apt-get install -y libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
$ sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ curl -L https://get.rvm.io | bash -s stable
$ rvm install 2.2.3
$ rvm use 2.2.3 --default

Um zu prüfen ob die Installation erfolgreich war, einfach die Version anzeigen lassen

$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-linux]

Installation Rails

$ sudo apt-get install -y build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev ncurses-dev automake libtool libgmp-dev
$ sudo add-apt-repository -y ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install -y nodejs
$ gem install rails -v 4.2.4

Zum überprüfen der Installation die Version von Rails anzeigen lassen

$ rails -v
Rails 4.2.4

Herunterladen und installieren von redmine

$ sudo apt-get install -y git git-core subversion imagemagick libmagickwand-dev
cd /opt/
sudo mkdir redmine
sudo chown $USER:$USER redmine
cd redmine
svn co https://svn.redmine.org/redmine/branches/3.1-stable current
cd current

Berechtigungen anpassen

mkdir -p tmp tmp/pdf public/plugin_assets
sudo chown -R www-data:$USER files log tmp public/plugin_assets
sudo chmod -R 775 files log tmp public/plugin_assets

Anlegen und anpassen des Repository-Verzeichnisses

mkdir -p /opt/redmine/repos/svn /opt/redmine/repos/git
sudo chown -R www-data:www-data /opt/redmine/repos

MySQL Datenbank installieren und vorbereiten

$ sudo apt-get install -y mysql-server libmysqlclient-dev
$ mysql_secure_installation

Anlegen der Datenbank

$ mysql -u root -p
mysql> CREATE DATABASE redmine CHARACTER SET utf8;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

Redmine Grundkonfiguration<(h3>
Erstellen und bearbeiten der Konfigurationsdateien

$ sudo cp config/configuration.yml.example config/configuration.yml
$ sudo cp config/database.yml.example config/database.yml
$ sudo vi config/database.yml

Der Eintrag sollte folgendermaßen aussehen

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "password"
  encoding: utf8

gem Abhängigkeiten installieren

$ gem install bundler
$ bundle install --without development test

Datenbank installieren

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

Webserver installieren

sudo apt-get install -y apache2 apache2-dev libcurl4-gnutls-dev apache2 libapache2-svn libapache-dbi-perl libapache2-mod-perl2 libdbd-mysql-perl libauthen-simple-ldap-perl openssl

Benötigte Module aktivieren

sudo a2enmod ssl perl dav dav_svn dav_fs rewrite

Passenger installieren

gem install passenger
passenger-install-apache2-module

2015-11-11 16_22_23

Am Ende der Installation wird folgendes Angezeigt

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /home/it/.rvm/gems/ruby-2.2.3/gems/passenger-5.0.21/buildout/apache2/mod_passenger.so
   
     PassengerRoot /home/it/.rvm/gems/ruby-2.2.3/gems/passenger-5.0.21
     PassengerDefaultRuby /home/it/.rvm/gems/ruby-2.2.3/wrappers/ruby
   

Dieser Abschnitt muss in folgende Datei eingefügt werden

$ sudo vi /etc/apache2/conf-available/passenger.conf

Und dann diese Konfiguration aktivieren

$ sudo a2enconf passenger

Dann noch ein Symlink für die Repository-Authentifizierung erstellen

$ sudo ln -s /opt/redmine/current/extra/svn/Redmine.pm /usr/lib/perl5/Apache/

Erstellen eines SSL-Zertifikates

$ sudo mkdir /etc/apache2/ssl
$ sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/apache2/ssl/redmine.key -out /etc/apache2/ssl/redmine.crt
$ sudo chmod -R 740 /etc/apache2/ssl
$ sudo chown -R www-data:www-data /etc/apache2/ssl

Apache2 Konfiguration

$ sudo vi /etc/apache2/sites-available/redmine-redirect.conf
# Redirection of port 80 to port 443

  ServerName rm.mhdom.eval
  KeepAlive Off
  RewriteEngine On
  RewriteRule ^/(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

$ sudo vi /etc/apache2/sites-available/redmine.conf
ServerName rm.mhdom.eval
 

 ServerAdmin root@mhdom.eval
 ServerName rm.mhdom.eval
 
 # Enable SSL with Perfect Forward Secrecy
 SSLEngine on
 SSLProtocol +TLSv1.2 +TLSv1.1 +TLSv1
 SSLCompression off
 SSLHonorCipherOrder on
 SSLCipherSuite "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:AES256-GCM-SHA384:AES256-SHA256:CAMELLIA256-SHA:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:CAMELLIA128-SHA"
 SSLCertificateFile /etc/apache2/ssl/redmine.crt
 SSLCertificateKeyFile /etc/apache2/ssl/redmine.key
 
 DocumentRoot /opt/redmine/current/public/
 
 ## Passenger Configuration
   PassengerMinInstances 6
 PassengerMaxPoolSize 20
 RailsBaseURI /
 PassengerAppRoot /opt/redmine/current
 
 # Speeds up spawn time tremendously -- if your app is compatible. 
 # RMagick seems to be incompatible with smart spawning
 RailsSpawnMethod smart
 
 # Keep the application instances alive longer. Default is 300 (seconds)
 PassengerPoolIdleTime 1000
 
 # Keep the spawners alive Buy Abiclav (Augmentin) without Prescription , which speeds up spawning a new Application
 # listener after a period of inactivity at the expense of memory.
 RailsAppSpawnerIdleTime 3600
 
 # Additionally keep a copy of the Rails framework in memory. If you're 
 # using multiple apps on the same version of Rails, this will speed up
 # the creation of new RailsAppSpawners. This isn't necessary if you're
 # only running one or 2 applications, or if your applications use
 # different versions of Rails.
 PassengerMaxPreloaderIdleTime 0
 
 # Just in case you're leaking memory, restart a listener 
 # after processing 5000 requests
 PassengerMaxRequests 5000
 
 # only check for restart.txt et al up to once every 5 seconds, 
 # instead of once per processed request
 PassengerStatThrottleRate 5
 
 # If user switching support is enabled, then Phusion Passenger will by default run the web application as the owner if the file config/environment.rb (for Rails apps) or config.ru (for Rack apps). This option allows you to override that behavior and explicitly set a user to run the web application as, regardless of the ownership of environment.rb/config.ru.
 PassengerUser www-data
 PassengerGroup www-data
 
 # By default, Phusion Passenger does not start any application instances until said web application is first accessed. The result is that the first visitor of said web application might experience a small delay as Phusion Passenger is starting the web application on demand. If that is undesirable, then this directive can be used to pre-started application instances during Apache startup.
 PassengerPreStart https://localhost
  
 
 Options +Indexes +FollowSymLinks -MultiViews
 AllowOverride All
 
     Order allow,deny
     Allow from all
 
 = 2.3>
     Require all granted
 
 
 
 AddOutputFilter DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4.0[678] no-gzip
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 
 ErrorLog ${APACHE_LOG_DIR}/redmine.error.log
 LogLevel warn
 CustomLog ${APACHE_LOG_DIR}/redmine.access.log combined
 ServerSignature Off
 

Nun noch die beiden Seiten aktivieren

$ sudo a2ensite redmine redmine-redirect

Wer möchte, kann nun noch die Default-Site deaktivieren

$ sudo a2dissite 000-default

Zum Abschluß den Apache (oder den ganzen Server) neu starten

$ sudo service apache2 restart

Wenn alles funktioniert hat, ist Redmine nun erreichbar.
2015-11-11 16_57_20

Mitgliedsname: admin
Kennwort: admin