HowTo install Redmine on CentOS 5 » History » Version 38

Stephan Schuberth, 2012-03-27 17:33

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