HowTo install Redmine on CentOS 5 » History » Version 33

Nick Shel, 2012-03-05 11:22

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