Project

General

Profile

HowTo install Redmine on CentOS 5 » History » Version 31

Nick Shel, 2012-03-05 11:20

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