HowTo install Redmine on CentOS 5 » History » Version 37

Stephan Schuberth, 2012-03-27 16:18

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