InstallRedmineOnDebianStableApacheMysqlPassenger » History » Version 28

Version 27 (Peter Mueller, 2016-01-09 11:42) → Version 28/32 (Peter Mueller, 2016-01-15 19:18)

h1. Preface

Last updated: 9 Jan 2016 (Redmine 3.2 on Deb. 7 (32 Bits))

(only this Wiki was updated)

Download a PDF of the original document from my site: http://files.hz6.de/redmine/InstallingRedmine_EN.pdf
*Deutsche Version* unter http://files.hz6.de/redmine/InstallingRedmine_DE.pdf

*After reading this guide you should have a working redmine instance*.
If this is not the case or if a step fails, please post details on the forums and refer to this wiki page. Make sure to include the output of @gem env@ and / or @RAILS_ENV=production /opt/redmine/script/about@.
If this guide has issues, please "contact me":http://www.redmine.org/users/55460 or correct it yourself.

h2. About this guide

This is a step-by-step guide to install redmine on "Debian stable" (called Wheezy at the moment of writing).
It is written for people who are familiar with Debian, the shell, MySQL, Apache and Linux in general.
To keep this guide short, it does not explain every step in detail.

*The versions, filenames and paths in this document are subject to frequent change. I'll do my best to keep them up-to-date, but please check anyway.*

*%{color:red}Please note:%* I'm assuming that you know how to use the tools at hand. If that's not the case (eg. you don't know how to create a new database or you don't know how to restart apache) please use the search engine of your choice and come back afterwards.

h1. Chapter 1: Install ruby, rails, gems and passenger

{{collapse(Read chapter 1)

h2. 1.1 Prepare your system

<pre>apt-get install gcc build-essential zlib1g zlib1g-dev zlibc libzlib-ruby libssl-dev libyaml-dev libcurl4-openssl-dev apache2-mpm-prefork apache2-prefork-dev libapr1-dev libxslt-dev checkinstall
apt-get build-dep ruby
</pre>
checkinstall&lt;/pre&gt;

h2. 1.2 download, build and install ruby

double check for compliance with here:

http://www.redmine.org/projects/redmine/wiki/RedmineInstall

<pre>cd ~
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p547.tar.gz
# tar xvfz ruby-1.9.3-p547.tar.gz
# cd ruby-1.9.3-p547
wget ftp://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.gz
tar xvfz ruby-2.2.4.tar.gz
cd ruby-2.2.4
./configure --enable-pthread --prefix=/usr/local
</pre>

* read and check the output carefully :)
* add if needed missed packages

<pre>
make
su
checkinstall --type=debian --install=yes --fstrans=no --pakdir='~'</pre>

h2. 1.3 check if ruby works

Expected output: @ruby 1.9.3p547 (2013-06-27 revision 41675) [i686-linux]@
<pre>ruby –v</pre>

h2. 1.4 make ruby support OpenSSL

<pre>cd ext/openssl/
ruby extconf.rb
make && checkinstall --type=debian --install=yes --fstrans=no --pakdir='~'</pre>

h2. 1.5 gem installed?

Ruby 1.9 comes with RubyGems by default, so by now @gem@ should be installed. If correctly installed, the following command will output a version number like @1.8.2x@:
<pre>gem -v</pre>
We can now install rdoc:
<pre>gem install rdoc</pre>

h2. 1.6 install rails

check with here:

https://rubygems.org/gems/rails/versions
http://www.redmine.org/projects/redmine/wiki/RedmineInstall

and force the version number (otherwise the latest version will be installed)

<pre>
#gem install rails --no-ri --no-rdoc
gem install rails -v=3.2.22 --no-ri --no-rdoc
</pre>
Note: You may be getting the error message _"no such file to load --zlib (LoadError)"_. In this case
you need to install zlib first:
<pre>cd ruby-1.9.3-p547/ext/zlib/
ruby extconf.rb
make
make install</pre>

h2. 1.7 install passenger (application server)

<pre>gem install passenger
passenger-install-apache2-module</pre>

h2. 1.8 configure apache

Put this in @/etc/apache/mods-available/passenger.load@ (remember to adjust the paths if necessary).
<pre>LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.46/ext/apache2/mod_passenger.so</pre>

And put this in @/etc/apache/mods-available/passenger.conf@ (remember to adjust the paths if necessary).
<pre>PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.46
PassengerRuby /usr/local/bin/ruby
PassengerDefaultUser www-data</pre>

h2. 1.9 activate module

<pre>a2enmod passenger</pre>

}}

h1. Chapter 2: Install redmine

{{collapse(Read chapter 2)

h2. 2.1 download redmine

Get latest zip from "here":http://www.redmine.org/projects/redmine/wiki/Download and unpack to /opt/redmine

h2. 2.2 further prepare the system

Note: Installing @libmagickwand-dev@ installs a lot of packages (depends / recommends)
Note: If you have bundle install error then you may try to purge, then install *-dev packages
<pre>gem install bundler mysql2
apt-get install libmagickwand-dev libmysqlclient-dev
cd /opt/redmine
bundle install --without postgresql</pre>

h2. 2.3 create database

<pre>create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'XXX';
grant all privileges on redmine.* to 'redmine'@'localhost';
</pre>

h2. 2.4 configure DB-connection

Put this in /opt/redmine/config/database.yml
<pre>production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: XXX</pre>

h2. 2.5 generate a session store secret

<pre>rake generate_secret_token</pre>

h2. 2.6 prepare database / create tables

<pre>RAILS_ENV=production rake db:migrate</pre>

h2. 2.7 set filesystem permissions

<pre>cd /opt/redmine
mkdir tmp tmp/pdf public/plugin_assets
chown -R www-data:www-data files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets
</pre>

h2. 2.8 test if it works

Redmine 2.x.x
<pre>ruby script/rails server webrick -e production</pre>

Redmine 3.x.x
<pre>bundle exec rails server webrick -e production</pre>

Now go to http://localhost:3000 and see redmine in action.

}}

h1. Chapter 3: Configure apache and passenger

In this guide, we deploy to a sub-URI. Read other guides if you want a name-based virtual host configuration.

{{collapse(Read chapter 3)

h2. 3.1 Configure apache (subURI deployment)

<pre>ln -s /opt/redmine/public /var/www/redmine</pre>

Put this in @/etc/apache2/sites-available/redmine@
Note: The option _RackBaseURI_ is for rails 3, in rails 2 it was called _RailsBaseURI_. It is in no case called _RakeBaseURI_.
<pre>
<Location /redmine>
RailsEnv production
RackBaseURI /redmine
Options -MultiViews
</Location>
</pre>

Restart apache, test if http://yourhost.com/redmine is working, rejoice if it is :-)

If you see something unexpected, please post details on the forums and refer to this wiki page. Make sure to include the output of @gem env@ and / or @RAILS_ENV=production /opt/redmine/script/about@.

}}