InstallRedmineOnDebianStableApacheMysqlPassenger » History » Version 11

Jan Niggemann (redmine.org team member), 2013-03-02 00:05
Added info about zlib error, THX to Thomas Romera

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