Project

General

Profile

HowTo install Redmine on CentOS Detailed » History » Version 1

Nick Shel, 2012-03-05 11:26

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