Project

General

Profile

Install Redmine 25x on Centos 65 complete » History » Version 4

Mr. DTTH, 2014-06-25 16:17

1 1 Mr. DTTH
h1. Install Redmine on Centos 6.5 - 64 bit
2
3
{{toc}}
4
5
You can "download":http://www.mediafire.com/download/68d5odq68ldwoua/RedmineV250CentosEnglish.zip this document as ebook format, read with the "eReader":http://edesignnetwork.org/projects/ibooks program.
6 3 Mr. DTTH
7 4 Mr. DTTH
+Origin source from+ : "eDesignNetwork.org":http://edesignnetwork.org/project/it_projects/it_projects_rubyonrails/redmineplusplus or "Wiki : Install Redmine":http://edesignnetwork.org/projects/redmineplusplus/wiki/Install_Redmine
8 1 Mr. DTTH
9
h2. The System Requirements
10
11
During the installation process we will use the Centos 6.5 - 64 bit OS, the original hardware configuration should not require high you can install on a normal PC or a virtual machine using VMWare, VirtualBox.
12
13
For the CentOS operating system, you can downloading at URL address :
14
15
http://centos.org/download
16
17
!{width: 80%}DownloadCentos.png!
18
 
19
Selecting a 64-bit version called "CentOS-6.5-x86_64-bin-DVD1.iso", after you download and install on the computer or on a virtual machine, the installation process is simple for anyone with basic computer skills.
20
21
Although this guiding document install on the Centos 6.5 operating system, but you can use any version of Centos 6.x for both 32 bit and 64 bit.
22
23
When the installation process is complete, you need the tools to connect with the Centos server via FTP and SSH protocols, you must to install FileZilla at the URL address :
24
25
https://filezilla-project.org/download.php
26
 
27
Next, we need to install Putty to communicate with Linux via SSH.
28
 
29
Download the installation package Putty for Windows at the following address :
30
31
http://www.putty.org/
32
33
To prepare for the next section, you need to set up a connection using Putty SSH to Server running Centos, enter the IP address of the computer running Centos (probably IP on the dedicated server, on the virtual machines, on the your LAN or PC).
34
35
!ConnectPutty.png!
36
 
37
After setting up SSH connection successful, we will move on to step installing the system.
38
39
!ConnectCentosOK.png!
40
41
h2. Update the System
42
43
For convenience in the next section, we follow the way :
44
45
* Select and copy command (CTRL + C)
46
47
* Right-click into the Putty window to Paste command and press Enter to execute
48
49
Copy and execute the following command to update the critical components of the system :
50
51
 yum update
52
53
!YumUpdate.png!
54
 
55
After the update completed, we need to restart the system using the following command :
56
57
 reboot
58
59
h2. Install the dependencies packages
60
61
These are the basic software packages for environment settings and utility tools to compile other packages in the next section.
62
63
Copy the block command and execute in the Putty Windows :
64
65
This is a long command line, copy all and implementation.
66
67
 yum -y install nano zip unzip libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
68
69
!InstallPackages.png!
70
71
h2. Install Apache and MySQL
72
73
Apache is a server application for communicating over the HTTP protocol. Apache runs on operating systems such as Unix, Linux, Microsoft Windows, and other operating systems.
74
75
Apache play an important role in the development of the internet and the world wide web.
76
77
MySQL is the database management free open source most popular on the world, MySQL has high speed, stability and ease of use, portability, operating on multiple operating systems offer a large system is very powerful utility functions.
78
79
With the speed and high security, MySQL is well suited for applications that access databases on the internet.
80
81
Use the following command to install :
82
83
 yum -y install httpd mysql mysql-server
84
85
!InstallApacheMysql.png!
86
 
87
Allow start services when OS boot :
88
89
<pre><code class="C">
90
chkconfig httpd on
91
chkconfig mysqld on
92
service httpd start
93
service mysqld start
94
</code></pre>
95
96
Set the password for MySQL
97
98
 /usr/bin/mysql_secure_installation
99
100
Because we not have a password for the root account so you press Enter to skip.
101
102
 Enter current password for root (enter for none):
103
104
Select Yes to set the password for the MySQL root account.
105
106
 Set root password? [Y/n] y
107
108
Enter and confirm your password, remove the anonymous user, select Yes
109
110
 Remove anonymous users? [Y/n] y
111
112
Allow remote login to MySQL as root account, select No.
113
114
 Disallow root login remotely? [Y/n] n
115
116
Delete the test database, select Yes
117
118
 Remove test database and access to it? [Y/n] y
119
120
Reload privilege tables, select Yes
121
122
 Reload privilege tables now? [Y/n] y
123
124
h2. Turn off SELinux
125
126
SELinux is a security feature advanced for Linux operating system, when installing the system you need to turn off this feature to get the process done smoothly, after successful you can turn on back if you want.
127
128
 nano /etc/selinux/config
129
130
Change the file content :
131
132
 SELINUX=disabled
133
134
!EditSELinux.png!
135
136
Press CTRL + O to save the file and press CTRL + X to exit.
137
138
h2. Set up the Hostname
139
140
By default when installing a new OS Centos not set the hostname, so we need to setting with the command :
141
142
 nano /etc/hosts
143
144
!SetHostname.png!
145
 
146
Add your domain name or host name that you set on both the command line, save the file and exit, the server name will be changed when restarting.
147
148
h2. Configuring the Firewall
149
150
We do not want to turn off the firewall because it's quite important, so you need to add rules to allow port 80 for HTTP and port 443 for HTTPS.
151
152
In the Centos OS, you can configuration firewall by editing files iptables and ip6tables.
153
154
 nano /etc/sysconfig/iptables
155
156
!ConfigFirewall.png!
157
158
Press Enter to create a new line after the line of port 22, copy the following two commands and right click on the window to the Paste command.
159
160
<pre><code class="C">
161
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
162
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
163
</code></pre>
164
165
Press CTRL + O to save the file and press CTRL + X to exit.
166
167
The same applies for IP6 firewall :
168
169
 nano /etc/sysconfig/ip6tables
170
171
Add these lines to the file.
172
173
<pre><code class="C">
174
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
175
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
176
</code></pre>
177
178
After you finish editing both files, run the commands to apply the new rules for firewall.
179
180
<pre><code class="C">
181
/etc/init.d/iptables restart
182
/etc/init.d/ip6tables restart
183
</code></pre>
184
185
Allow turn on the firewall when reboot the operating system.
186
187
<pre><code class="C">
188
chkconfig iptables on
189
chkconfig ip6tables on
190
</code></pre>
191
192
Finally, we need to restart the system to apply the changes to the SELinux and Hostname.
193
194
 reboot
195
196
h2. Install PHP and phpMyAdmin
197
198
Because we use MySQL database management system, so we need to install phpMyAdmin program management.
199
200
phpMyAdmin is a free open source tool written by PHP language to manage MySQL database via a web browser.
201
202
It can create, modify or delete databases, tables, fields or records, perform SQL statements, or managing users and permissions.
203
204
The command to install PHP and the packages :
205
206
 yum -y install php php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc php-pecl-apc php-soap
207
208
!InstallPHP.png!
209
210
Restarting the Apache service :
211
212
 service httpd restart
213
214
And install phpMyadmin :
215
216
<pre><code class="C">
217
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
218
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
219
yum -y install phpmyadmin
220
</code></pre>
221
222
!InstallphpMyadmin.png!
223
224
Editing the virtual host file to allow remote login to the phpMyadmin.
225
226
 nano /etc/httpd/conf.d/phpmyadmin.conf
227
228
!EditVirtualHostPHPMyadmin.png!
229
 
230
Replace text "Allow from 127.0.0.1" to "Allow from all", save the file and exit.
231
232
Editing the configuration file for the phpMyadmin
233
234
 nano /usr/share/phpmyadmin/config.inc.php
235
236
!EditConfigPHPMyadmin.png!
237
 
238
Replace text :
239
240
 $cfg['Servers'][$i]['auth_type'] = 'cookie';
241
242
To :
243
244
 $cfg['Servers'][$i]['auth_type'] = 'http';
245
246
Save the file and exit, restarting the Apache service :
247
248
 service httpd restart
249
250
After successfully installed phpMyadmin, you can check at the address :
251
252
http://your-domain/phpmyadmin
253
254
Login with account :  root / your_password
255
256
With Password has been set at step install MySQL database in the above.
257
258
!CompleteInstallphpMyadmin.png!
259
260
Note: If you install the Redmine system on the PC or in a virtual machine which not on the dedicated server, we need to switch the application phpMyadmin to run on port 8080 because port 80 will be used for Redmine in the next steps.
261
262
We need add a port 8080 to the firewall and change the VirtualHost for phpMyadmin.
263
264
 nano /etc/sysconfig/iptables
265
266
!Iptables.png!
267
 
268
Add the command line :
269
270
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
271
272
The same applies for IP6 firewall :
273
274
 nano /etc/sysconfig/ip6tables
275
276
Add the command line :
277
278
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
279
280
Restarting firewall service to allow the new port.
281
282
<pre><code class="C">
283
/etc/init.d/iptables restart
284
/etc/init.d/ip6tables restart
285
</code></pre>
286
287
Editing the VirtualHost file to run phpMyadmin on the port 8080
288
289
 nano /etc/httpd/conf.d/phpmyadmin.conf
290
291
!PhpMyadmin8080.png!
292
 
293
Change the file content :
294
295
<pre><code class="C">
296
<VirtualHost *:8080>
297
    DocumentRoot /usr/share/phpmyadmin/
298
    ServerName your_domain.com
299
</VirtualHost>
300
</code></pre>
301
302
Next, add the command to allows listening on the port 8080 in the file "httpd.conf"
303
304
 nano /etc/httpd/conf/httpd.conf
305
306
!httpd.png!
307
 
308
Add the command line :
309
310
 Listen 8080
311
312
Save the file and exit, restarting the Apache service :
313
314
 service httpd restart
315
316
!RunPHPMyadmin.png!
317
 
318
Now, phpMyadmin will run on the port 8080 at the address :
319
320
http://your-domain:8080
321
322
h2. Install Ruby
323
324
Ruby is a object-oriented programming language, capable of reflection. Syntax inherited from Ada and Perl with object-oriented features of Smalltalk, and also share some features with Python, Lisp, Dylan and CLU, Ruby is a single phase interpreter.
325
326
Ruby provides programming patterns, including functional programming, object-oriented, imperative, reflective, it uses dynamic variable and automatic memory management.
327
328
Install Ruby interpreter with version management program RVM.
329
330
 \curl -L https://get.rvm.io | bash
331
332
After successful, we will launch RVM
333
334
 source /etc/profile.d/rvm.sh
335
336
The following command will list the versions of Ruby to install :
337
338
 rvm list known
339
340
!ListAllVersionRuby.png!
341
 
342
We choose the stable version [ruby-] 1.9.3 [-p545], and execute the following command :
343
344
 rvm install 1.9.3
345
346
!InstallRuby.png!
347
 
348
The installation process is pretty long time, but you do not need any intervention, after successful, you check with the following command :
349
350
 ruby -v
351
352
h2. Install Rubygems
353
354
Rubygems is a Ruby's packages management program, very popular in applications written by Ruby language and the Ruby On Rails framework.
355
356
 yum -y install rubygems
357
358
!InstallRubyGem.png!
359
360
h2. Install Passenger
361
362
The full name of the Passenger is Phusion Passenger, known as mod_rails or mod_rack, it is a web application intergrate with Apache and it can operate as a standalone web server support for the Ruby On Rails applications.
363
364
Execute the following commands :
365
366
<pre><code class="C">
367
gem install passenger
368
passenger-install-apache2-module
369
</code></pre>
370
371
!InstallPassenger.png!
372
373
After completed, we copy a notification block in the window to create the configuration file in the next steps (select block notification and press C to copy).
374
375
<pre><code class="C">
376
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p545/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
377
<IfModule mod_passenger.c>
378
   PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p545/gems/passenger-4.0.37
379
   PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p545/wrappers/ruby
380
</IfModule>
381
</code></pre>
382
383
Create a new virtual host file for Passenger :
384
385
 nano /etc/httpd/conf.d/passenger.conf
386
387
Paste the command blocks into the empty file and save it, then restart the Apache service.
388
389
 service httpd restart
390
391
h2. Create Database for Redmine
392
393
Use MySQLAdmin to create an empty database for Redmine, saved password to fill in the configuration file in the next steps.
394
395
<pre><code class="C">
396
mysql --user=root --password=root_password_mysql
397
create database redmine_db character set utf8;
398
create user 'redmine_admin'@'localhost' identified by 'your_new_password';
399
grant all privileges on redmine_db.* to 'redmine_admin'@'localhost';
400
quit;
401
</code></pre>
402
403
!RedmineDB.png!
404
405
h2. Install Redmine
406
407
Redmine is a main program of the project management system, we will download and install the program from the website of Redmine.
408
409
Download Redmine version 2.5.x to directory "/var/www" on the Centos OS.
410
411
<pre><code class="C">
412
cd /var/www
413
wget http://www.redmine.org/releases/redmine-2.5.0.tar.gz
414
</code></pre>
415
416
Extract the folder and rename directory
417
418
<pre><code class="C">
419
tar xvfz redmine-2.5.0.tar.gz
420
mv redmine-2.5.0 redmine
421
rm -rf redmine-2.5.0.tar.gz
422
</code></pre>
423
424
Configuring the Database
425
426
The next, we need to configure the database was created from the above steps.
427
428
<pre><code class="C">
429
cd /var/www/redmine/config
430
cp database.yml.example database.yml
431
nano database.yml
432
</code></pre>
433
434
!ConfigDBRedmine.png!
435
436
Enter name for database, enter username and password of the database. Press CTRL + O to save the file and CTRL + X to exit.
437
438
h2. Setting up Rails
439
440
Install the package library support for Rails using the Bundle.
441
442
<pre><code class="C">
443
cd /var/www/redmine
444
gem install bundler
445
bundle install
446
rake generate_secret_token
447
</code></pre>
448
449
!BundleInstall.png!
450
451
The next, we create the database table for the Redmine application.
452
453
<pre><code class="C">
454
RAILS_ENV=production rake db:migrate
455
RAILS_ENV=production rake redmine:load_default_data
456
</code></pre>
457
458
h2. Activate FCGI
459
460
<pre><code class="C">
461
cd /var/www/redmine/public
462
mkdir plugin_assets
463
cp dispatch.fcgi.example dispatch.fcgi
464
cp htaccess.fcgi.example .htaccess
465
</code></pre>
466
467
h2. Setting up Apache and FastCGI
468
469
<pre><code class="C">
470
cd /var/www/
471
rpm --import https://fedoraproject.org/static/0608B895.txt
472
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
473
rpm -ivh epel-release-6-8.noarch.rpm
474
yum -y install mod_fcgid
475
rm -rf epel-release-6-8.noarch.rpm
476
</code></pre>
477
478
h2. Creating Files Directory
479
480
This directory contains data files generated during the operation of Redmine as document or image file, we create a new directory in the "/opt".
481
482
<pre><code class="C">
483
mkdir -p /opt/redmine/files
484
chown -R apache:apache /opt/redmine
485
cd /var/www/redmine/config
486
cp configuration.yml.example configuration.yml
487
nano configuration.yml
488
</code></pre>
489
490
!AttachFilesPath.png!
491
 
492
Enter the directory path containing the data files you just created in the previous step into the line "attachments_storage_path".
493
494
Note: You must add a space at the begin of the path "/opt/redmine/files" after character ":"
495
496
h2. Configuring Email
497
498
Another very important function of Redmine is using email to notify members when the contents of each project changes, Redmine can use many different methods to send email that is Sendmail, SMTP, GMail ...
499
500
To configure the email we will edit the configuration file.
501
502
 nano /var/www/redmine/config/configuration.yml
503
504
The simplest is you use features of the default SendMail in the Centos OS by settings :
505
506
<pre><code class="C">
507
  email_delivery:
508
   delivery_method: :sendmail
509
</code></pre>
510
511
Note : Do not use the Tab key to indent when editing the configuration file, you need to use the space bar on the keyboard.
512
513
If you use GMail's SMTP, you need to register an email account with the login methods used password normal and disable two-step authentication by smart phone.
514
515
Enter your Gmail account as below :
516
517
<pre><code class="C">
518
  email_delivery:
519
   delivery_method: :smtp
520
   smtp_settings:
521
        enable_starttls_auto: true
522
        address: "smtp.gmail.com"
523
        port: 587
524
        domain: "smtp.gmail.com"
525
        authentication: :plain
526
        user_name: "your_email@gmail.com"
527
        password: "your_password"
528
</code></pre>
529
530
Save the file configuration and exit.
531
532
h2. Create Virtual Host for Redmine
533
534
Create an Apache configuration file for the Redmine application at the port 80.
535
536
 nano /etc/httpd/conf.d/redmine.conf
537
538
Copy the text below and paste into the editor window, note the information to change your domain name.
539
540
<pre><code class="C">
541
<VirtualHost *:80>
542
        ServerName your_domain
543
        ServerAdmin your_domain@domain.com
544
        DocumentRoot /var/www/redmine/public/
545
        ErrorLog logs/redmine_error_log
546
        <Directory "/var/www/redmine/public/">
547
                Options Indexes ExecCGI FollowSymLinks
548
                Order allow,deny
549
                Allow from all
550
                AllowOverride all
551
        </Directory>
552
</VirtualHost>
553
</code></pre>
554
555
Save the file configuration and exit.
556
557
h2. Running Redmine
558
559
Before execute Redmine in the first time, we must permission for the directory installed Redmine and restart Apache service.
560
561
<pre><code class="C">
562
cd /var/www
563
chown -R apache:apache redmine
564
chmod -R 755 redmine
565
service httpd restart
566
</code></pre>
567
568
!Redmine.png!
569
570
Redmine will run at the following address URL :
571
572
http://your-domain
573
574
Login to system with an administrator account : admin / admin
575
576
You can change your password after successful login.
577
578
We can see Redmine has running but very primitive, in the next steps we will install the support plugins and customized Redmine to use professional.
579
580
h2. Install Subversion
581
582
Subversion, also known as SVN, it is a version management system is very popular and easy to use, most programmers can use it competently.
583
584
We need to create a folder to store data for Redmine, the following command creates a directory and permissions for the Apache service.
585
586
<pre><code class="C">
587
mkdir -p /opt/repositories/svn
588
chown -R apache:apache /opt/repositories/
589
chmod 0755 /opt/repositories
590
</code></pre>
591
592
The following command install Subversion and the packages :
593
594
 yum install mod_dav_svn subversion subversion-ruby
595
596
!InstallSVN.png!
597
 
598
The next, we will create a directory and copy the file called "Redmine.pm", it responsible for interface data repository with Redmine and it is written by Perl language programming.
599
600
<pre><code class="C">
601
mkdir /usr/lib64/perl5/vendor_perl/Apache
602
ln -s /var/www/redmine/extra/svn/Redmine.pm /usr/lib64/perl5/vendor_perl/Apache/Redmine.pm
603
</code></pre>
604
605
Note : If you are using 32 bit Centos, change the path "/usr/lib64" to "/usr/lib"
606
607
After installation is complete, from the Redmine application, go to the page *Administration> Settings> Repositories* to check the results.
608
 
609
To support the authentication and access to data repository for each member, we need to create a virtual host for the Apache service can access Redmine database.
610
611
 nano /etc/httpd/conf.d/subversion.conf
612
613
Add the following lines to the end and still retain the old contents of the file :
614
615
<pre><code class="C">
616
PerlLoadModule Apache::Redmine
617
<Location /svn>
618
        DAV svn
619
        SVNParentPath "/opt/repositories/svn" 
620
        SVNListParentPath on
621
        Order deny,allow
622
        Deny from all
623
        Satisfy any
624
        LimitXMLRequestBody 0
625
        SVNPathAuthz off
626
        PerlAccessHandler Apache::Authn::Redmine::access_handler
627
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
628
        AuthType Basic
629
        AuthName "Subversion Repository" 
630
        Require valid-user
631
        RedmineDSN "DBI:mysql:database=redmine_db;host=localhost:3306" 
632
        RedmineDbUser "redmine_admin" 
633
        RedmineDbPass "your_password_database_redmine" 
634
</Location> 
635
</code></pre>
636
637
Note : You need to change the password in the "RedmineDbPass" to correct the database password of Redmine.
638
639
At this point, we have finished the basic settings for Redmine.
640
641
Thank you!