InstallRedmineOnDebianStableApacheMysqlPassenger¶
Preface¶
Last updated: 2013-02-17
Download a PDF of the original document from my site: http://files.hz6.de/redmine/installing_redmine.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 or correct it yourself.
About this guide¶
This is a step-by-step guide to install redmine on "Debian stable" (called Squeeze 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, but
The 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.
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.
Chapter 1: Install ruby, rails, gems and passenger¶
Read chapter 1Read chapter 1
1.1 Prepare your system¶
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 checkinstall
1.2 download, build and install ruby¶
cd ~
wget ftp://ftp.ruby-lang.org/pub/ruby/stable/ruby-1.9.3-p374.tar.gz
tar xvfz ruby-1.9.3-p374.tar.gz
cd ruby-1.9.3-p374
./configure --enable-pthread --prefix=/usr/local
make && checkinstall --type=debian --install=yes --fstrans=no --pakdir='~'
1.3 check if ruby works¶
Expected output: ruby 1.9.3p374 (2013-01-15 revision 38858) [i686-linux]
ruby –v
1.4 make ruby support OpenSSL¶
cd ext/openssl/
ruby extconf.rb
make && checkinstall --type=debian --install=yes --fstrans=no --pakdir='~'
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
:
gem -v
1.6 install rails¶
gem install rails
1.7 install passenger (application server)¶
gem install passenger
passenger-install-apache2-module
1.8 configure apache¶
Put this in /etc/apache/mods-available/passenger.load
(remember to adjust the paths if necessary).
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
And put this in /etc/apache/mods-available/passenger.conf
(remember to adjust the paths if necessary).
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18
PassengerRuby /usr/local/bin/ruby
PassengerDefaultUser www-data
1.9 activate module¶
a2enmod passenger
Chapter 2: Install redmine¶
Read chapter 2Read chapter 2
2.1 download redmine¶
Get latest zip from here and unpack to /opt/redmine
2.2 further prepare the system¶
Note: Installing libmagick9-dev
installs a lot of packages (depends / recommends)
gem install bundler
apt-get install libmagick9-dev
cd /opt/redmine
bundle install --without postgresql
2.3 create database¶
create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'XXX';
grant all privileges on redmine.* to 'redmine'@'localhost';
2.4 configure DB-connection¶
Put this in /opt/redmine/config/database.yml
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: XXX
2.5 generate a session store secret¶
rake generate_secret_token
2.6 prepare database / create tables¶
RAILS_ENV=production rake db:migrate
2.7 set filesystem permissions¶
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
2.8 test if it works¶
ruby script/rails server webrick -e production
Now go to
http://localhost:3000 and see redmine in action.
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.
Read chapter 3Read chapter 3
3.1 Configure apache (subURI deployment)¶
ln -s /opt/redmine/public /var/www/redmine
Put this in /etc/apache2/sites-available/redmine
<Location /redmine>
RailsEnv production
RailsBaseURI /redmine
Options –MultiViews
</Location>
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
.