Project

General

Profile

How to Install Redmine on CentOS (Detailed) » History » Version 2

Nick Shel, 2012-03-05 11:50

1 1 Nick Shel
h1. How to Install Redmine on CentOS (Detailed)
2
3
{{>toc}}
4
5
h2. Introduction
6
7 2 Nick Shel
I spent a fair bit of time looking for a good issue tracking / project management solution.  Having considered extensively both open source and commercial solutions (up to about $200/month price range like Jira+Confluence and Zoho Projects) I decided to go with Redmine as it offers a good mix of issue tracking and project management capability, most specifically status workflows, sub-tasking and task dependencies and everything else we need.
8
9
However, when I decided to deploy Redmine I encountered numerous difficulties, as at my workplace we use PHP and are not familiar with Ruby on Rails and setting up Ruby on Rails for anyone not familiar with it is rather difficult, largely due to the various version dependencies and incompatibilities and lack of decent detailed documentation on how to do it.  I managed to setup Redmine on Windows XP using MySQL, Apache and Mongrel, but when I tried to install the same setup on Windows Server 2008 I encountered all sorts of issues with RoR and MySQL, so I decided to setup on CentOS, which is what we use for our production web hosting anyway.
10
11 1 Nick Shel
CentOS is one of the most frequently chosen Linux operating systems for Linux based production environments. There is extensive documentation available on setting up CentOS and it is arguably the best choice for deploying and running production Linux servers for organisation with all levels of in-house Linux server deployment and administration capability.
12
13
Redmine is one of the best (if not THE best) open source issue tracking and project management applications, but because it is developed using Ruby on Rails it can be rather complex to deploy for anyone not familiar with the Ruby on Rails environment.
14
15
This How-To provides detailed steps required to get Redmine up and running on a CentOS operating system using the following components:
16
* Apache web server
17
* MySQL database management system
18
* Ruby on Rails
19
* Mod Passenger Apache module
20
21
The How-To provides detailed instructions on the installation and explains what each step does, so that it can be easily follows by people experienced and new to the Ruby on Rails environment.
22
23
h2. Assumptions
24
25
* CentOS is installed and works
26
* Apache is installed and works 
27
* MySQL is installed and works
28
* Your are logged as root
29
* The next steps are done successively without errors
30
31
h2. Installation Instructions
32
33
h3. Install gem and passenger dependencies
34
35
36
37
<pre>
38
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
39
</pre>
40
41
h3. Get Ruby
42
43
<pre>
44
# Create the directory where you will store the Downloads
45
mkdir ~/Downloads # This can be any directory.
46
47
# Change to directory where you will store the download
48
cd ~/Downloads # This can be any directory.
49
50
# FTP to where you will download ruby from.
51
# When asked to login use user/password of anonymous/anonymous
52
ftp ftp.ruby-lang.org 
53
Name (ftp.ruby-lang.org:root): anonymous
54
Password: anonymous
55
56
ftp> cd /pub/ruby
57
ftp> get ruby-1.8.7-pXXX.tar.gz
58
ftp> quit
59
60
# You have now downloaded ruby and need to untar it
61
tar zxvf ruby-1.8.7-pXXX.tar.gz
62
63
# Compile ruby
64
cd ruby-1.8.7-pXXX
65
./configure
66
make
67
make install
68
69
# Verify ruby installation
70
ruby -v
71
which ruby
72
73
# Change back into your downloads directory
74
cd ..
75
</pre>
76
77
h3. Get Gems 1.4.2 (does not work with Gems 1.5)
78
79
<pre>
80
wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.2.tgz
81
tar zxvf rubygems-1.4.2.tgz
82
cd rubygems-1.4.2
83
ruby setup.rb
84
gem -v
85
which gem
86
cd ..
87
</pre>
88
89
h3. Install Passenger (requires gcc)
90
91
<pre>
92
gem install passenger
93
passenger-install-apache2-module
94
</pre>
95
96
An alternate method is to install mod_passenger RPM for Apache from the following location: 
97
http://passenger.stealthymonkeys.com/
98
99
RHEL/CentOS 5
100
<pre>
101
rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm
102
yum install mod_passenger
103
</pre>
104
105
RHEL/CentOS 6
106
<pre>
107
rpm --import http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc
108
yum install http://passenger.stealthymonkeys.com/rhel/6/passenger-release.noarch.rpm
109
yum install mod_passenger
110
</pre>
111
112
h3. Restart Apache
113
114
<pre>service httpd restart</pre>
115
116
h3. Download Redmine
117
118
Download page: http://rubyforge.org/frs/?group_id=1850
119
120
<pre>
121
wget http://rubyforge.org/frs/download.php/75597/redmine-1.3.0.tar.gz  # GET LATEST VERSION ON RUBYFORGE
122
tar zxvf redmine-1.3.0.tar.gz
123
</pre>
124
125
h3. Copy the folder to its HTTP document root folder
126
127
<pre>cp -av redmine-1.3.0/* /var/www/redmine</pre>
128
129
h3. Configure Apache to host the documents
130
131
more information can be found here: [[HowTo configure Apache to run Redmine]]
132
133
h3. Install Bundler
134
135
<pre>gem install bundler</pre>
136
137
h3. Add the Bundler Boot and preinitializer code
138
139
For more info go to the "Bundler site":http://gembundler.com/.
140
141
h3. Create the Gemfile and register these gems in it
142
143
<pre>vi /var/www/redmine/Gemfile</pre>
144
145
<pre>
146
# file: /var/www/redmine/Gemfile
147
source "http://rubygems.org"
148
gem "rake", "0.8.3"
149
gem "rack", "1.1.0"
150
gem "i18n", "0.4.2"
151
gem "rubytree", "0.5.2", :require => "tree"
152
gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay
153
gem "mysql"
154
gem "coderay", "~>0.9.7"
155
</pre>
156
157
<pre>bundle install</pre>
158
159
h3. Create the Redmine MySQL database
160
161
<pre>
162
yum install mysql-server
163
chkconfig mysqld on
164
service mysqld start
165
/usr/bin/mysql_secure_installation
166
</pre>
167
168
> For MySQL:
169
> start the mysql client (@mysql -u root -p@) and enter the following commands
170
> > <pre>create database redmine character set utf8;
171
create user 'redmine'@'localhost' identified by 'my_password';
172
grant all privileges on redmine.* to 'redmine'@'localhost'; </pre>
173
174
> For versions of MySQL prior to 5.0.2 - skip the 'create user' step and instead:
175
176
> > <pre> grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';</pre>
177
178
h3. Configure /var/www/redmine/config/database.yml (rename database.yml.example)
179
180
h3. Set the production environment (optional)
181
182
Uncomment the following line in file redmine/config/environment.rb:
183
184
<pre>ENV['RAILS_ENV'] ||= 'production'</pre>
185
186
h3. Generate the session store
187
188
<pre>RAILS_ENV=production bundle exec rake generate_session_store</pre>
189
190
h3. Migrate the database models
191
192
<pre>RAILS_ENV=production bundle exec rake db:migrate</pre>
193
194
h3. Load default data (optional)
195
196
<pre>RAILS_ENV=production bundle exec rake redmine:load_default_data</pre>
197
198
Follow instructions.
199
200
h3. Rename dispatch CGI files in /var/www/redmine/public/
201
202
<pre>
203
mv dispatch.cgi.example dispatch.cgi
204
mv dispatch.fcgi.example dispatch.fcgi
205
mv dispatch.rb.example dispatch.rb
206
</pre>
207
208
h3. Edit .htaccess file for CGI dispatch configuration
209
210
<pre>
211
mv htaccess.fcgi.example .htaccess
212
</pre>
213
214
h3. Chown and Chmod files for read/write access for the Apache user
215
216
<pre>
217
cd ..
218
chown -R apache:apache redmine-1.x
219
chmod -R 755 redmine-1.x
220
</pre>
221
222
h3. Redmine should be fully installed now and fully usable
223
224
Enjoy!