Project

General

Profile

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

Nick Shel, 2012-03-05 11:52

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
<pre>
36
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
37
</pre>
38
39
h3. Get Ruby
40
41
<pre>
42
# Create the directory where you will store the Downloads
43
mkdir ~/Downloads # This can be any directory.
44
45
# Change to directory where you will store the download
46
cd ~/Downloads # This can be any directory.
47
48
# FTP to where you will download ruby from.
49
# When asked to login use user/password of anonymous/anonymous
50
ftp ftp.ruby-lang.org 
51
Name (ftp.ruby-lang.org:root): anonymous
52
Password: anonymous
53
54
ftp> cd /pub/ruby
55
ftp> get ruby-1.8.7-pXXX.tar.gz
56
ftp> quit
57
58
# You have now downloaded ruby and need to untar it
59
tar zxvf ruby-1.8.7-pXXX.tar.gz
60
61
# Compile ruby
62
cd ruby-1.8.7-pXXX
63
./configure
64
make
65
make install
66
67
# Verify ruby installation
68
ruby -v
69
which ruby
70
71
# Change back into your downloads directory
72
cd ..
73
</pre>
74
75
h3. Get Gems 1.4.2 (does not work with Gems 1.5)
76
77
<pre>
78
wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.2.tgz
79
tar zxvf rubygems-1.4.2.tgz
80
cd rubygems-1.4.2
81
ruby setup.rb
82
gem -v
83
which gem
84
cd ..
85
</pre>
86
87
h3. Install Passenger (requires gcc)
88
89
<pre>
90
gem install passenger
91
passenger-install-apache2-module
92
</pre>
93
94
An alternate method is to install mod_passenger RPM for Apache from the following location: 
95
http://passenger.stealthymonkeys.com/
96
97
RHEL/CentOS 5
98
<pre>
99
rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm
100
yum install mod_passenger
101
</pre>
102
103
RHEL/CentOS 6
104
<pre>
105
rpm --import http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc
106
yum install http://passenger.stealthymonkeys.com/rhel/6/passenger-release.noarch.rpm
107
yum install mod_passenger
108
</pre>
109
110
h3. Restart Apache
111
112
<pre>service httpd restart</pre>
113
114
h3. Download Redmine
115
116
Download page: http://rubyforge.org/frs/?group_id=1850
117
118
<pre>
119
wget http://rubyforge.org/frs/download.php/75597/redmine-1.3.0.tar.gz  # GET LATEST VERSION ON RUBYFORGE
120
tar zxvf redmine-1.3.0.tar.gz
121
</pre>
122
123
h3. Copy the folder to its HTTP document root folder
124
125
<pre>cp -av redmine-1.3.0/* /var/www/redmine</pre>
126
127
h3. Configure Apache to host the documents
128
129
more information can be found here: [[HowTo configure Apache to run Redmine]]
130
131
h3. Install Bundler
132
133
<pre>gem install bundler</pre>
134
135
h3. Add the Bundler Boot and preinitializer code
136
137
For more info go to the "Bundler site":http://gembundler.com/.
138
139
h3. Create the Gemfile and register these gems in it
140
141
<pre>vi /var/www/redmine/Gemfile</pre>
142
143
<pre>
144
# file: /var/www/redmine/Gemfile
145
source "http://rubygems.org"
146
gem "rake", "0.8.3"
147
gem "rack", "1.1.0"
148
gem "i18n", "0.4.2"
149
gem "rubytree", "0.5.2", :require => "tree"
150
gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay
151
gem "mysql"
152
gem "coderay", "~>0.9.7"
153
</pre>
154
155
<pre>bundle install</pre>
156
157
h3. Create the Redmine MySQL database
158
159
<pre>
160
yum install mysql-server
161
chkconfig mysqld on
162
service mysqld start
163
/usr/bin/mysql_secure_installation
164
</pre>
165
166
> For MySQL:
167
> start the mysql client (@mysql -u root -p@) and enter the following commands
168
> > <pre>create database redmine character set utf8;
169
create user 'redmine'@'localhost' identified by 'my_password';
170
grant all privileges on redmine.* to 'redmine'@'localhost'; </pre>
171
172
> For versions of MySQL prior to 5.0.2 - skip the 'create user' step and instead:
173
174
> > <pre> grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';</pre>
175
176
h3. Configure /var/www/redmine/config/database.yml (rename database.yml.example)
177
178
h3. Set the production environment (optional)
179
180
Uncomment the following line in file redmine/config/environment.rb:
181
182
<pre>ENV['RAILS_ENV'] ||= 'production'</pre>
183
184
h3. Generate the session store
185
186
<pre>RAILS_ENV=production bundle exec rake generate_session_store</pre>
187
188
h3. Migrate the database models
189
190
<pre>RAILS_ENV=production bundle exec rake db:migrate</pre>
191
192
h3. Load default data (optional)
193
194
<pre>RAILS_ENV=production bundle exec rake redmine:load_default_data</pre>
195
196
Follow instructions.
197
198
h3. Rename dispatch CGI files in /var/www/redmine/public/
199
200
<pre>
201
mv dispatch.cgi.example dispatch.cgi
202
mv dispatch.fcgi.example dispatch.fcgi
203
mv dispatch.rb.example dispatch.rb
204
</pre>
205
206
h3. Edit .htaccess file for CGI dispatch configuration
207
208
<pre>
209
mv htaccess.fcgi.example .htaccess
210
</pre>
211
212
h3. Chown and Chmod files for read/write access for the Apache user
213
214
<pre>
215
cd ..
216
chown -R apache:apache redmine-1.x
217
chmod -R 755 redmine-1.x
218
</pre>
219
220
h3. Redmine should be fully installed now and fully usable
221
222
Enjoy!