HowTo install Redmine on CentOS 5 » History » Version 30

Nick Shel, 2012-03-05 09:06
Simplified

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