Project

General

Profile

InstallRedmineOnDebianStableApacheMysqlPassenger » History » Version 32

Jan Niggemann (redmine.org team member), 2016-11-01 20:01
remove commented-out lines in scipts and notice that only wiki was updated (I made new PDFs), add another 'su'

1 4 Jan Niggemann (redmine.org team member)
h1. Preface
2 1 Jan Niggemann (redmine.org team member)
3 32 Jan Niggemann (redmine.org team member)
Last updated: Nov. 1st, 2016 (Redmine 3.3 on Deb. 8 (64 Bits))
4 27 Peter Mueller
5 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
6
*Deutsche Version* unter http://files.hz6.de/redmine/InstallingRedmine_DE.pdf
7 1 Jan Niggemann (redmine.org team member)
8 4 Jan Niggemann (redmine.org team member)
*After reading this guide you should have a working redmine instance*.
9
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@.
10
If this guide has issues, please "contact me":http://www.redmine.org/users/55460 or correct it yourself.
11
12 3 Jan Niggemann (redmine.org team member)
h2. About this guide
13 1 Jan Niggemann (redmine.org team member)
14 21 Jan Niggemann (redmine.org team member)
This is a step-by-step guide to install redmine on "Debian stable" (called Wheezy at the moment of writing).
15 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.
16 10 Jan Niggemann (redmine.org team member)
To keep this guide short, it does not explain every step in detail.
17 1 Jan Niggemann (redmine.org team member)
18 23 Jan Niggemann (redmine.org team member)
*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.*
19 3 Jan Niggemann (redmine.org team member)
20 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.
21
22 3 Jan Niggemann (redmine.org team member)
h1. Chapter 1: Install ruby, rails, gems and passenger
23 1 Jan Niggemann (redmine.org team member)
24
{{collapse(Read chapter 1)
25
26
h2. 1.1 Prepare your system
27
28 30 Peter Mueller
<pre>apt-get install gcc build-essential zlib1g zlib1g-dev zlibc libssl-dev libyaml-dev libcurl4-openssl-dev apache2-mpm-prefork apache2-dev libapr1-dev libxslt1-dev checkinstall
29 28 Peter Mueller
apt-get build-dep ruby
30
</pre>
31 1 Jan Niggemann (redmine.org team member)
32 23 Jan Niggemann (redmine.org team member)
h2. 1.2 download, build and install ruby
33 1 Jan Niggemann (redmine.org team member)
34 27 Peter Mueller
double check for compliance with here:
35
36
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
37
38
<pre>cd ~
39 30 Peter Mueller
wget -c ftp://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz
40
tar xvfz ruby-2.3.1.tar.gz
41
cd ruby-2.3.1
42 1 Jan Niggemann (redmine.org team member)
./configure --enable-pthread --prefix=/usr/local
43 27 Peter Mueller
</pre>
44 1 Jan Niggemann (redmine.org team member)
45 27 Peter Mueller
* read and check the output carefully :)
46
* add if needed missed packages
47
48
<pre>
49 1 Jan Niggemann (redmine.org team member)
make 
50 27 Peter Mueller
su
51
checkinstall --type=debian --install=yes --fstrans=no --pakdir='~'</pre>
52
53
h2. 1.3 check if ruby works
54 1 Jan Niggemann (redmine.org team member)
55 32 Jan Niggemann (redmine.org team member)
Expected output: @ruby 2.3.1pXXX (2016-06-27 revision 41675) [x86_64-linux]@
56 1 Jan Niggemann (redmine.org team member)
<pre>ruby –v</pre>
57
58
h2. 1.4 make ruby support OpenSSL
59
60
<pre>cd ext/openssl/
61 8 Jan Niggemann (redmine.org team member)
ruby extconf.rb
62 32 Jan Niggemann (redmine.org team member)
make
63
su
64
checkinstall --type=debian --install=yes --fstrans=no --pakdir='~'</pre>
65 4 Jan Niggemann (redmine.org team member)
66 1 Jan Niggemann (redmine.org team member)
h2. 1.5 gem installed?
67 11 Jan Niggemann (redmine.org team member)
68
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@:
69 1 Jan Niggemann (redmine.org team member)
<pre>gem -v</pre>
70
We can now install rdoc:
71
<pre>gem install rdoc</pre>
72
73
h2. 1.6 install rails
74
75 27 Peter Mueller
check with here:
76
77
https://rubygems.org/gems/rails/versions
78
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
79
80
and force the version number (otherwise the latest version will be installed)
81
82
<pre>
83 31 Peter Mueller
gem install rails -v=4.2.7.1 --no-ri --no-rdoc
84 27 Peter Mueller
</pre>
85 23 Jan Niggemann (redmine.org team member)
Note: You may be getting the error message _"no such file to load --zlib (LoadError)"_. In this case
86 11 Jan Niggemann (redmine.org team member)
you need to install zlib first:
87
<pre>cd ruby-1.9.3-p547/ext/zlib/
88
ruby extconf.rb
89 1 Jan Niggemann (redmine.org team member)
make
90
make install</pre>
91
92
h2. 1.7 install passenger (application server)
93
94
<pre>gem install passenger
95
passenger-install-apache2-module</pre>
96
97 4 Jan Niggemann (redmine.org team member)
h2. 1.8 configure apache
98 23 Jan Niggemann (redmine.org team member)
99 1 Jan Niggemann (redmine.org team member)
Put this in @/etc/apache/mods-available/passenger.load@ (remember to adjust the paths if necessary).
100 4 Jan Niggemann (redmine.org team member)
<pre>LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.46/ext/apache2/mod_passenger.so</pre>
101 23 Jan Niggemann (redmine.org team member)
102 1 Jan Niggemann (redmine.org team member)
And put this in @/etc/apache/mods-available/passenger.conf@ (remember to adjust the paths if necessary).
103
<pre>PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.46
104
PassengerRuby /usr/local/bin/ruby
105
PassengerDefaultUser www-data</pre>
106
107
108 3 Jan Niggemann (redmine.org team member)
h2. 1.9 activate module
109
110
<pre>a2enmod passenger</pre>
111 2 Jan Niggemann (redmine.org team member)
112 1 Jan Niggemann (redmine.org team member)
}}
113 2 Jan Niggemann (redmine.org team member)
114 1 Jan Niggemann (redmine.org team member)
h1. Chapter 2: Install redmine
115 2 Jan Niggemann (redmine.org team member)
116
{{collapse(Read chapter 2)
117
118 26 Jan Niggemann (redmine.org team member)
h2. 2.1 download redmine
119 2 Jan Niggemann (redmine.org team member)
120
Get latest zip from "here":http://www.redmine.org/projects/redmine/wiki/Download and unpack to /opt/redmine
121
122 16 Jan Niggemann (redmine.org team member)
h2. 2.2 further prepare the system
123 18 Andrew Tropin
124 19 Maik Nergert
Note: Installing @libmagickwand-dev@ installs a lot of packages (depends / recommends)
125 18 Andrew Tropin
Note: If you have bundle install error then you may try to purge, then install *-dev packages
126 4 Jan Niggemann (redmine.org team member)
<pre>gem install bundler mysql2
127 2 Jan Niggemann (redmine.org team member)
apt-get install libmagickwand-dev libmysqlclient-dev
128
cd /opt/redmine
129 4 Jan Niggemann (redmine.org team member)
bundle install --without postgresql</pre>
130 2 Jan Niggemann (redmine.org team member)
131
h2. 2.3 create database
132
133
<pre>create database redmine character set utf8;
134 4 Jan Niggemann (redmine.org team member)
create user 'redmine'@'localhost' identified by 'XXX';
135 1 Jan Niggemann (redmine.org team member)
grant all privileges on redmine.* to 'redmine'@'localhost';
136
</pre>
137
138
139
h2. 2.4 configure DB-connection
140 2 Jan Niggemann (redmine.org team member)
141 6 Jan Niggemann (redmine.org team member)
Put this in /opt/redmine/config/database.yml
142
<pre>production:
143
  adapter: mysql2
144
  database: redmine
145
  host: localhost
146 2 Jan Niggemann (redmine.org team member)
  username: redmine
147
  password: XXX</pre>
148 1 Jan Niggemann (redmine.org team member)
149
h2. 2.5 generate a session store secret
150
151
<pre>rake generate_secret_token</pre>
152
153
h2. 2.6 prepare database / create tables
154 2 Jan Niggemann (redmine.org team member)
155 1 Jan Niggemann (redmine.org team member)
<pre>RAILS_ENV=production rake db:migrate</pre>
156
157 4 Jan Niggemann (redmine.org team member)
h2. 2.7 set filesystem permissions
158
159
<pre>cd /opt/redmine
160
mkdir tmp tmp/pdf public/plugin_assets
161
chown -R www-data:www-data files log tmp public/plugin_assets
162 1 Jan Niggemann (redmine.org team member)
chmod -R 755 files log tmp public/plugin_assets
163
</pre>
164 4 Jan Niggemann (redmine.org team member)
165 24 Anonymous
h2. 2.8 test if it works
166 5 Jan Niggemann (redmine.org team member)
167 24 Anonymous
Redmine 2.x.x
168
<pre>ruby script/rails server webrick -e production</pre>
169
170
Redmine 3.x.x
171 3 Jan Niggemann (redmine.org team member)
<pre>bundle exec rails server webrick -e production</pre>
172
173
Now go to http://localhost:3000 and see redmine in action.
174
175
}}
176
177
h1. Chapter 3: Configure apache and passenger
178
179
In this guide, we deploy to a sub-URI. Read other guides if you want a name-based virtual host configuration.
180 1 Jan Niggemann (redmine.org team member)
181 3 Jan Niggemann (redmine.org team member)
{{collapse(Read chapter 3)
182 4 Jan Niggemann (redmine.org team member)
183 3 Jan Niggemann (redmine.org team member)
h2. 3.1 Configure apache (subURI deployment)
184 4 Jan Niggemann (redmine.org team member)
185 3 Jan Niggemann (redmine.org team member)
<pre>ln -s /opt/redmine/public /var/www/redmine</pre>
186 20 Jan Niggemann (redmine.org team member)
187 4 Jan Niggemann (redmine.org team member)
Put this in @/etc/apache2/sites-available/redmine@
188 1 Jan Niggemann (redmine.org team member)
Note: The option _RackBaseURI_ is for rails 3, in rails 2 it was called _RailsBaseURI_. It is in no case called _RakeBaseURI_.
189 3 Jan Niggemann (redmine.org team member)
<pre>
190 19 Maik Nergert
<Location /redmine>
191
		RailsEnv production
192 4 Jan Niggemann (redmine.org team member)
		RackBaseURI /redmine
193 3 Jan Niggemann (redmine.org team member)
		Options -MultiViews
194 4 Jan Niggemann (redmine.org team member)
</Location>
195
</pre>
196
197
Restart apache, test if http://yourhost.com/redmine is working, rejoice if it is :-)
198 3 Jan Niggemann (redmine.org team member)
199 1 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@.
200
201
}}