Project

General

Profile

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

Mr. DTTH, 2015-01-06 03:52

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