Project

General

Profile

InstallRedmineOnDebianStableApacheMysqlPassenger » History » Version 7

Jan Niggemann (redmine.org team member), 2013-01-24 15:36

1 3 Jan Niggemann (redmine.org team member)
h1. InstallRedmineOnDebianStableApacheMysqlPassenger
2 1 Jan Niggemann (redmine.org team member)
3 4 Jan Niggemann (redmine.org team member)
h1. Preface
4 1 Jan Niggemann (redmine.org team member)
5 7 Jan Niggemann (redmine.org team member)
Last updated: 2013-01-23
6 1 Jan Niggemann (redmine.org team member)
7 4 Jan Niggemann (redmine.org team member)
*After reading this guide you should have a working redmine instance*.
8
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@.
9
If this guide has issues, please "contact me":http://www.redmine.org/users/55460 or correct it yourself.
10
11 3 Jan Niggemann (redmine.org team member)
h2. About this guide
12 1 Jan Niggemann (redmine.org team member)
13
This is a step-by-step guide to install redmine on "Debian stable" (called Squeeze at the moment of writing).
14 3 Jan Niggemann (redmine.org team member)
It is written for people who are familiar with Debian, the shell, MySQL, Apache and Linux in general.
15 4 Jan Niggemann (redmine.org team member)
To keep this guide short, it does not explain every step in detail, but 
16 1 Jan Niggemann (redmine.org team member)
17 4 Jan Niggemann (redmine.org team member)
*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.*
18 3 Jan Niggemann (redmine.org team member)
19 4 Jan Niggemann (redmine.org team member)
*%{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.
20
21 3 Jan Niggemann (redmine.org team member)
h1. Chapter 1: Install ruby, rails, gems and passenger
22 1 Jan Niggemann (redmine.org team member)
23
{{collapse(Read chapter 1)
24
25
h2. 1.1 Prepare your system
26
27
<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</pre>
28
29
h2. 1.2 download, build and install ruby
30
31 4 Jan Niggemann (redmine.org team member)
<pre>cd ~
32
wget ftp://ftp.ruby-lang.org/pub/ruby/stable/ruby-1.9.3-p374.tar.gz
33
tar xvfz ruby-1.9.3-p374.tar.gz
34
cd ruby-1.9.3-p374
35 1 Jan Niggemann (redmine.org team member)
./configure --enable-pthread --prefix=/usr/local
36
make && make install</pre>
37
38
h2. 1.3 check if ruby works
39
40 4 Jan Niggemann (redmine.org team member)
Expected output: @ruby 1.9.3p374 (2013-01-15 revision 38858) [i686-linux]@
41 1 Jan Niggemann (redmine.org team member)
<pre>ruby –v</pre>
42
43
h2. 1.4 make ruby support OpenSSL
44
45 4 Jan Niggemann (redmine.org team member)
<pre>cd ext/openssl/
46 1 Jan Niggemann (redmine.org team member)
ruby extconf.rb
47
make && make install</pre>
48
49
h2. 1.5 gem installed?
50
51 4 Jan Niggemann (redmine.org team member)
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@:
52 1 Jan Niggemann (redmine.org team member)
<pre>gem -v</pre>
53
54
h2. 1.6 install rails
55
56
<pre>gem install rails</pre>
57
58
h2. 1.7 install passenger (application server)
59
60
<pre>gem install passenger
61
passenger-install-apache2-module</pre>
62
63
h2. 1.8 configure apache
64
65 4 Jan Niggemann (redmine.org team member)
Put this in @/etc/apache/mods-available/passenger.load@ (remember to adjust the paths if necessary).
66 1 Jan Niggemann (redmine.org team member)
<pre>LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18/ext/apache2/mod_passenger.so</pre>
67
68 4 Jan Niggemann (redmine.org team member)
And put this in @/etc/apache/mods-available/passenger.conf@ (remember to adjust the paths if necessary).
69 1 Jan Niggemann (redmine.org team member)
<pre>PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.18
70
PassengerRuby /usr/local/bin/ruby
71
PassengerDefaultUser www-data</pre>
72
73
74
h2. 1.9 activate module
75
76 3 Jan Niggemann (redmine.org team member)
<pre>a2enmod passenger</pre>
77
78
}}
79 2 Jan Niggemann (redmine.org team member)
80 1 Jan Niggemann (redmine.org team member)
h1. Chapter 2: Install redmine
81 2 Jan Niggemann (redmine.org team member)
82 1 Jan Niggemann (redmine.org team member)
{{collapse(Read chapter 2)
83 2 Jan Niggemann (redmine.org team member)
84
h2. 2.1 download redmine
85
86 4 Jan Niggemann (redmine.org team member)
Get latest zip from "here":http://rubyforge.org/frs/?group_id=1850 and unpack to /opt/redmine
87 2 Jan Niggemann (redmine.org team member)
88
h2. 2.2 further prepare the system
89
90
Note: Installing @libmagick9-dev@ installs a lot of packages (depends / recommends)
91
<pre>gem install bundler
92 1 Jan Niggemann (redmine.org team member)
apt-get install libmagick9-dev
93 4 Jan Niggemann (redmine.org team member)
cd /opt/redmine
94 2 Jan Niggemann (redmine.org team member)
bundle install --without postgresql</pre>
95
96 4 Jan Niggemann (redmine.org team member)
h2. 2.3 create database
97 2 Jan Niggemann (redmine.org team member)
98
<pre>create database redmine character set utf8;
99
create user 'redmine'@'localhost' identified by 'XXX';
100
grant all privileges on redmine.* to 'redmine'@'localhost';
101 4 Jan Niggemann (redmine.org team member)
</pre>
102 1 Jan Niggemann (redmine.org team member)
103
104
h2. 2.4 configure DB-connection
105
106
Put this in /opt/redmine/config/database.yml
107 2 Jan Niggemann (redmine.org team member)
<pre>production:
108 6 Jan Niggemann (redmine.org team member)
  adapter: mysql2
109
  database: redmine
110
  host: localhost
111
  username: redmine
112
  password: XXX</pre>
113 2 Jan Niggemann (redmine.org team member)
114
h2. 2.5 generate a session store secret
115 1 Jan Niggemann (redmine.org team member)
116
<pre>rake generate_secret_token</pre>
117
118
h2. 2.6 prepare database / create tables
119
120
<pre>RAILS_ENV=production rake db:migrate</pre>
121 2 Jan Niggemann (redmine.org team member)
122 1 Jan Niggemann (redmine.org team member)
h2. 2.7 set filesystem permissions
123
124 4 Jan Niggemann (redmine.org team member)
<pre>cd /opt/redmine
125
mkdir tmp tmp/pdf public/plugin_assets
126
chown -R www-data:www-data files log tmp public/plugin_assets
127
chmod -R 755 files log tmp public/plugin_assets
128
</pre>
129 1 Jan Niggemann (redmine.org team member)
130
h2. 2.8 test if it works
131 4 Jan Niggemann (redmine.org team member)
132 5 Jan Niggemann (redmine.org team member)
<pre>ruby script/rails server webrick -e production</pre>
133 3 Jan Niggemann (redmine.org team member)
Now go to http://localhost:3000 and see redmine in action.
134
135
}}
136
137
h1. Chapter 3: Configure apache and passenger
138
139
In this guide, we deploy to a sub-URI. Read other guides if you want a name-based virtual host configuration.
140
141
{{collapse(Read chapter 3)
142
143 4 Jan Niggemann (redmine.org team member)
h2. 3.1 Configure apache (subURI deployment)
144 3 Jan Niggemann (redmine.org team member)
145 4 Jan Niggemann (redmine.org team member)
<pre>ln -s /opt/redmine/public /var/www/redmine</pre>
146 3 Jan Niggemann (redmine.org team member)
147 4 Jan Niggemann (redmine.org team member)
Put this in @/etc/apache2/sites-available/redmine@
148
<pre>
149
<Location /redmine>
150 3 Jan Niggemann (redmine.org team member)
		RailsEnv production
151
		RailsBaseURI /redmine
152
		Options –MultiViews
153 4 Jan Niggemann (redmine.org team member)
</Location>
154 3 Jan Niggemann (redmine.org team member)
</pre>
155 4 Jan Niggemann (redmine.org team member)
156
Restart apache, test if http://yourhost.com/redmine is working, rejoice if it is :-)
157
158
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@.
159 3 Jan Niggemann (redmine.org team member)
160 1 Jan Niggemann (redmine.org team member)
}}