HowTo install Redmine on CentOS 5 » History » Version 29

Nick Shel, 2012-03-05 09:03

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