Install Redmine on Centos 6.5 - 64 bit

Update the System

Copy and execute the following command to update the critical components of the system :

yum update

After the update completed, we need to restart the system using the following command :

reboot

Install the dependencies packages

These are the basic software packages for environment settings and utility tools to compile other packages in the next section.

Copy the block command and execute in the Putty Windows :

This is a long command line, copy all and implementation.

yum -y install nano zip unzip libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel

Install Apache and MySQL

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.

Apache play an important role in the development of the internet and the world wide web.

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.

With the speed and high security, MySQL is well suited for applications that access databases on the internet.

Use the following command to install :

yum -y install httpd mysql mysql-server

Allow start services when OS boot :

chkconfig httpd on
chkconfig mysqld on
service httpd start
service mysqld start

Set the password for MySQL

/usr/bin/mysql_secure_installation

Because we not have a password for the root account so you press Enter to skip.

Enter current password for root (enter for none):

Select Yes to set the password for the MySQL root account.

Set root password? [Y/n] Y

Enter and confirm your password, remove the anonymous user, select Yes

Remove anonymous users? [Y/n] Y

Allow remote login to MySQL as root account, select No.

Disallow root login remotely? [Y/n] n

Delete the test database, select Yes

Remove test database and access to it? [Y/n] Y

Reload privilege tables, select Yes

Reload privilege tables now? [Y/n] Y

Turn off SELinux

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.

nano /etc/selinux/config

Change the file content :

SELINUX=disabled

Press CTRL + O to save the file and press CTRL + X to exit.

Set up the Hostname

By default when installing a new OS Centos not set the hostname, so we need to setting with the command :

nano /etc/hosts
127.0.0.1 localhost
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.168.226.151 iZ23lttzrggZ

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.

Configuring the Firewall

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.

In the Centos OS, you can configuration firewall by editing files iptables and ip6tables.

nano /etc/sysconfig/iptables
 # Firewall configuration written by system-config-firewall
[root@iZ23lttzrggZ lmmbao]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

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.

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

Press CTRL + O to save the file and press CTRL + X to exit.

The same applies for IP6 firewall :

nano /etc/sysconfig/ip6tables

Add these lines to the file.

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

After you finish editing both files, run the commands to apply the new rules for firewall.

/etc/init.d/iptables restart
/etc/init.d/ip6tables restart

Allow turn on the firewall when reboot the operating system.

chkconfig iptables on
chkconfig ip6tables on

Finally, we need to restart the system to apply the changes to the SELinux and Hostname.

reboot

Install PHP and phpMyAdmin

Because we use MySQL database management system, so we need to install phpMyAdmin program management.

phpMyAdmin is a free open source tool written by PHP language to manage MySQL database via a web browser.

It can create, modify or delete databases, tables, fields or records, perform SQL statements, or managing users and permissions.

The command to install PHP and the packages :

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

Restarting the Apache service :

service httpd restart

And install phpMyadmin :

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y install phpmyadmin

Editing the virtual host file to allow remote login to the phpMyadmin.

  GNU nano 2.0.9                File: /etc/httpd/conf.d/phpmyadmin.conf                                       
#
#  Web application to manage MySQL
#

<Directory "/usr/share/phpmyadmin">
  Order Deny,Allow
  Deny from all
  Allow from 127.0.0.1
</Directory>

Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

Replace text "Allow from 127.0.0.1" to "Allow from all", save the file and exit.

Editing the configuration file for the phpMyadmin

nano /usr/share/phpmyadmin/config.inc.php

Replace text :

$cfg['Servers'][$i]['auth_type'] = 'cookie';

To:

$cfg['Servers'][$i]['auth_type'] = 'http';

Save the file and exit, restarting the Apache service :

service httpd restart

After successfully installed phpMyadmin, you can check at the address :
http://your-domain/phpmyadmin
Login with account : root / your_password
With Password has been set at step install MySQL database in the above.

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.

We need add a port 8080 to the firewall and change the VirtualHost for phpMyadmin.

nano /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

Add the command line :

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

The same applies for IP6 firewall :

nano /etc/sysconfig/ip6tables

Add the command line :

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT

Restarting firewall service to allow the new port.

/etc/init.d/iptables restart
/etc/init.d/ip6tables restart

Editing the VirtualHost file to run phpMyadmin on the port 8080

nano /etc/httpd/conf.d/phpmyadmin.conf

change

#
#  Web application to manage MySQL
# 
<Directory "/usr/share/phpmyadmin">
  Order Deny,Allow
  Deny from all
  Allow from all
</Directory>
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

to:

<VirtualHost *:8080>
    DocumentRoot /usr/share/phpmyadmin/
    ServerName your_domain.com
</VirtualHost>

Next, add the command to allows listening on the port 8080 in the file "httpd.conf"

nano /etc/httpd/conf/httpd.conf

Add the command line :

Listen 8080

Save the file and exit, restarting the Apache service :

service httpd restart

Now, phpMyadmin will run on the port 8080 at the address :

http://your-domain:8080

Install Ruby

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.

Ruby provides programming patterns, including functional programming, object-oriented, imperative, reflective, it uses dynamic variable and automatic memory management.

Install Ruby interpreter with version management program RVM.

\curl -L https://get.rvm.io | bash

After successful, we will launch RVM

source /etc/profile.d/rvm.sh

The following command will list the versions of Ruby to install :

rvm list known
[root@iZ23lttzrggZ /]# source /etc/profile.d/rvm.sh
[root@iZ23lttzrggZ /]# rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p598]
[ruby-]2.1.4
[ruby-]2.1[.5]
[ruby-]2.1-head
ruby-head

# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.1

# JRuby
jruby-1.6.8
jruby[-1.7.17]
jruby-head

# Rubinius
rbx-1.3.3
rbx-2.0.0

We choose the stable version [ruby-] 1.9.3 [-p551], and execute the following command :

rvm install 1.9.3
ruby-1.9.3-p551 - #extracting rubygems-2.4.5....
ruby-1.9.3-p551 - #removing old rubygems.........
ruby-1.9.3-p551 - #installing rubygems-2.4.5..................
ruby-1.9.3-p551 - #gemset created /usr/local/rvm/gems/ruby-1.9.3-p551@global
ruby-1.9.3-p551 - #importing gemset /usr/local/rvm/gemsets/global.gems...........................................................
ruby-1.9.3-p551 - #generating global wrappers........
ruby-1.9.3-p551 - #gemset created /usr/local/rvm/gems/ruby-1.9.3-p551
ruby-1.9.3-p551 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-1.9.3-p551 - #generating default wrappers........
ruby-1.9.3-p551 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-1.9.3-p551 - #complete 

The installation process is pretty long time, but you do not need any intervention, after successful, you check with the following command :

ruby -v
[root@iZ23lttzrggZ /]# ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
[root@iZ23lttzrggZ /]# 

Install Rubygems

Rubygems is a Ruby's packages management program, very popular in applications written by Ruby language and the Ruby On Rails framework.

yum -y install rubygems
[root@iZ23lttzrggZ /]# yum -y install rubygems
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rubygems.noarch 0:1.3.7-5.el6 will be installed
--> Processing Dependency: ruby(abi) = 1.8 for package: rubygems-1.3.7-5.el6.noarch
--> Processing Dependency: ruby-rdoc for package: rubygems-1.3.7-5.el6.noarch
--> Processing Dependency: /usr/bin/ruby for package: rubygems-1.3.7-5.el6.noarch
--> Running transaction check
---> Package ruby.x86_64 0:1.8.7.374-3.el6_6 will be installed
---> Package ruby-libs.x86_64 0:1.8.7.374-3.el6_6 will be installed
--> Processing Dependency: libreadline.so.5()(64bit) for package: ruby-libs-1.8.7.374-3.el6_6.x86_64
---> Package ruby-rdoc.x86_64 0:1.8.7.374-3.el6_6 will be installed
--> Processing Dependency: ruby-irb = 1.8.7.374-3.el6_6 for package: ruby-rdoc-1.8.7.374-3.el6_6.x86_64
--> Running transaction check
---> Package compat-readline5.x86_64 0:5.2-17.1.el6 will be installed
---> Package ruby-irb.x86_64 0:1.8.7.374-3.el6_6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================
 Package                       Arch                Version                         Repository            Size
==============================================================================================================
Installing:
 rubygems                      noarch              1.3.7-5.el6                     base                 207 k
Installing for dependencies:
 compat-readline5              x86_64              5.2-17.1.el6                    base                 130 k
 ruby                          x86_64              1.8.7.374-3.el6_6               updates              538 k
 ruby-irb                      x86_64              1.8.7.374-3.el6_6               updates              317 k
 ruby-libs                     x86_64              1.8.7.374-3.el6_6               updates              1.7 M
 ruby-rdoc                     x86_64              1.8.7.374-3.el6_6               updates              380 k

Transaction Summary
==============================================================================================================
Install       6 Package(s)

Total download size: 3.2 M
Installed size: 11 M
Downloading Packages:
(1/6): compat-readline5-5.2-17.1.el6.x86_64.rpm                                        | 130 kB     00:00     
(2/6): ruby-1.8.7.374-3.el6_6.x86_64.rpm                                               | 538 kB     00:00     
(3/6): ruby-irb-1.8.7.374-3.el6_6.x86_64.rpm                                           | 317 kB     00:00     
(4/6): ruby-libs-1.8.7.374-3.el6_6.x86_64.rpm                                          | 1.7 MB     00:00     
(5/6): ruby-rdoc-1.8.7.374-3.el6_6.x86_64.rpm                                          | 380 kB     00:00     
(6/6): rubygems-1.3.7-5.el6.noarch.rpm                                                 | 207 kB     00:00     
--------------------------------------------------------------------------------------------------------------
Total                                                                         3.8 MB/s | 3.2 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : compat-readline5-5.2-17.1.el6.x86_64                                                       1/6 
  Installing : ruby-libs-1.8.7.374-3.el6_6.x86_64                                                         2/6 
  Installing : ruby-1.8.7.374-3.el6_6.x86_64                                                              3/6 
  Installing : ruby-irb-1.8.7.374-3.el6_6.x86_64                                                          4/6 
  Installing : ruby-rdoc-1.8.7.374-3.el6_6.x86_64                                                         5/6 
  Installing : rubygems-1.3.7-5.el6.noarch                                                                6/6 
  Verifying  : ruby-libs-1.8.7.374-3.el6_6.x86_64                                                         1/6 
  Verifying  : compat-readline5-5.2-17.1.el6.x86_64                                                       2/6 
  Verifying  : ruby-1.8.7.374-3.el6_6.x86_64                                                              3/6 
  Verifying  : ruby-irb-1.8.7.374-3.el6_6.x86_64                                                          4/6 
  Verifying  : rubygems-1.3.7-5.el6.noarch                                                                5/6 
  Verifying  : ruby-rdoc-1.8.7.374-3.el6_6.x86_64                                                         6/6 

Installed:
  rubygems.noarch 0:1.3.7-5.el6                                                                               

Dependency Installed:
  compat-readline5.x86_64 0:5.2-17.1.el6                 ruby.x86_64 0:1.8.7.374-3.el6_6                     
  ruby-irb.x86_64 0:1.8.7.374-3.el6_6                    ruby-libs.x86_64 0:1.8.7.374-3.el6_6                
  ruby-rdoc.x86_64 0:1.8.7.374-3.el6_6                  

Complete!
[root@iZ23lttzrggZ /]# 

Install Passenger

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.

Execute the following command :

gem install passenger
[root@iZ23lttzrggZ /]# gem install passenger
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: daemon_controller-1.2.0.gem (100%)
Successfully installed daemon_controller-1.2.0
Fetching: passenger-4.0.55.gem (100%)
Building native extensions.  This could take a while...
Successfully installed passenger-4.0.55
unable to convert "\x89" from ASCII-8BIT to UTF-8 for test/multipart/binary, skipping
Installing ri documentation for rack-1.5.2
Installing ri documentation for daemon_controller-1.2.0
Installing ri documentation for passenger-4.0.55
3 gems installed
[root@iZ23lttzrggZ /]# 

After last command. Execute the following command :

passenger-install-apache2-module

执行过程:

--------------------------------------------
Almost there!

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-4.0.55/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-4.0.55
     PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p551/wrappers/ruby
   </IfModule>

After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!

Press ENTER to continue.


--------------------------------------------

Deploying a web application: an example

Suppose you have a web application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

   <VirtualHost *:80>
      ServerName www.yourhost.com
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /somewhere/public    
      <Directory /somewhere/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
         # Uncomment this if you're on Apache >= 2.4:
         #Require all granted
      </Directory>
   </VirtualHost>

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

  /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-4.0.55/doc/Users guide Apache.html
  https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
https://www.phusionpassenger.com

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
[root@iZ23lttzrggZ /]# 

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).

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-4.0.55/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
   PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p551/gems/passenger-4.0.55
   PassengerDefaultRuby /usr/local/rvm/gems/ruby-1.9.3-p551/wrappers/ruby
</IfModule>

Create a new virtual host file for Passenger :

nano /etc/httpd/conf.d/passenger.conf

Paste the command blocks into the empty file and save it, then restart the Apache service.

service httpd restart

Success!!!!!

[root@iZ23lttzrggZ /]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@iZ23lttzrggZ /]# 

Create Database for Redmine

Use MySQLAdmin to create an empty database for Redmine, saved password to fill in the configuration file in the next steps.

mysql --user=root --password=root_password_mysql
create database redmine_db character set utf8;
create user 'redmine_admin'@'localhost' identified by 'your_new_password';
grant all privileges on redmine_db.* to 'redmine_admin'@'localhost';
quit;
[root@iZ23lttzrggZ /]# mysql --user=root --password=root_password_mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database redmine_db character set utf8;
Query OK, 1 row affected (0.00 sec)

mysql> create user 'redmine_admin'@'localhost' identified by 'your_new_password';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on redmine_db.* to 'redmine_admin'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> quit;
Bye
[root@iZ23lttzrggZ /]# 

Install Redmine

Redmine is a main program of the project management system, we will download and install the program from the website of Redmine.

Download Redmine version 2.5.x to directory "/var/www" on the Centos OS.

cd /var/www
wget http://www.redmine.org/releases/redmine-2.5.0.tar.gz

Extract the folder and rename directory

tar xvfz redmine-2.5.0.tar.gz
mv redmine-2.5.0 redmine
rm -rf redmine-2.5.0.tar.gz

Configuring the Database

The next, we need to configure the database was created from the above steps.

cd /var/www/redmine/config
cp database.yml.example database.yml
nano database.yml

database.yml infomations:

# Default setup is given for MySQL with ruby1.9. If you're running Redmine
# with MySQL and ruby1.8, replace the adapter name with `mysql`.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: root
  password: ""
  encoding: utf8

development:
  adapter: mysql2
  database: redmine_development
  host: localhost
  username: root
  password: ""
  encoding: utf8

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
# Default setup is given for MySQL with ruby1.9. If you're running Redmine
# with MySQL and ruby1.8, replace the adapter name with `mysql`.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).

production:
   adapter: mysql2
  database: redmine
  host: localhost
  username: root
  password: ""
  encoding: utf8

development:
  adapter: mysql2
  database: redmine_development
  host: localhost
  username: root
  password: ""
  encoding: utf8

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql2
  database: redmine_test
  host: localhost
  username: root
  password: ""
  encoding: utf8

# PostgreSQL configuration example
#production:
#  adapter: postgresql
#  database: redmine
#  host: localhost
#  username: postgres
#  password: "postgres"

# SQLite3 configuration example
#production:
#  adapter: sqlite3
#  database: db/redmine.sqlite3

# SQL Server configuration example
#production:
#  adapter: sqlserver
#  database: redmine
#  host: localhost
#  username: jenkins
#  password: jenkins

Enter name for database, enter username and password of the database.
Change this:

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: root
  password: ""
  encoding: utf8

To:

production:
  adapter: mysql2
  database: redmine_db
  host: localhost
  username: redmine_admin
  password: "LmmBao@2014"
  encoding: utf8

Press CTRL + O to save the file and CTRL + X to exit.

Setting up Rails

Install the package library support for Rails using the Bundle.

cd /var/www/redmine
gem install bundler
bundle install
rake generate_secret_token
[root@iZ23lttzrggZ config]# cd /var/www/redmine
[root@iZ23lttzrggZ redmine]# gem install bundler
Fetching: bundler-1.7.9.gem (100%)
Successfully installed bundler-1.7.9
Installing ri documentation for bundler-1.7.9
1 gem installed
[root@iZ23lttzrggZ redmine]# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will
break this application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Installing rake 10.4.2
Installing i18n 0.6.11
Installing multi_json 1.10.1
Installing activesupport 3.2.17

**When i run bundle install command, an error occurred while installing rmagick (2.13.4), and Bundler cannot continue.*

Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p551/gems/rmagick-2.13.4 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p551/extensions/x86_64-linux/1.9.1/rmagick-2.13.4/gem_make.out
An error occurred while installing rmagick (2.13.4), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.4'` succeeds before bundling.
[root@iZ23lttzrggZ redmine]# yum install ImageMagick-devel

Get solution fromStack Overflow
Stack Overflow
Then run bundle install again.
Success!!

Installing rmagick 2.13.4
Installing rubyzip 1.1.6
Installing websocket 1.2.1
Installing selenium-webdriver 2.44.0
Installing shoulda-context 1.0.2
Installing shoulda-matchers 1.4.1
Installing shoulda 3.3.2
Installing yard 0.8.7.6
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from rmagick:
Please report any bugs. See https://github.com/gemhome/rmagick/compare/RMagick_2-13-2...master and https://github.com/rmagick/rmagick/issues/18
[root@iZ23lttzrggZ redmine]# 


The next, we create the database table for the Redmine application.

RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
[root@iZ23lttzrggZ redmine]# RAILS_ENV=production rake redmine:load_default_data

Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] 
====================================
Default configuration data loaded.
[root@iZ23lttzrggZ redmine]# 

Activate FCGI

cd /var/www/redmine/public
mkdir plugin_assets
cp dispatch.fcgi.example dispatch.fcgi
cp htaccess.fcgi.example .htaccess

Setting up Apache and FastCGI

cd /var/www/
rpm --import https://fedoraproject.org/static/0608B895.txt
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum -y install mod_fcgid
rm -rf epel-release-6-8.noarch.rpm

Creating Files Directory

This directory contains data files generated during the operation of Redmine as document or image file, we create a new directory in the "/opt".

mkdir -p /opt/redmine/files
chown -R apache:apache /opt/redmine
cd /var/www/redmine/config
cp configuration.yml.example configuration.yml
nano configuration.yml
 94   # Absolute path to the directory where attachments are stored.
 95   # The default is the 'files' directory in your Redmine instance.
 96   # Your Redmine instance needs to have write permission on this
 97   # directory.
 98   # Examples:
 99   # attachments_storage_path: /var/redmine/files
100   # attachments_storage_path: D:/redmine/files
101   attachments_storage_path:

Enter the directory path containing the data files you just created in the previous step into the line "attachments_storage_path".

Note: You must add a space at the begin of the path "/opt/redmine/files" after character ":"

 94   # Absolute path to the directory where attachments are stored.
 95   # The default is the 'files' directory in your Redmine instance.
 96   # Your Redmine instance needs to have write permission on this
 97   # directory.
 98   # Examples:
 99   # attachments_storage_path: /var/redmine/files
100   # attachments_storage_path: D:/redmine/files
101   attachments_storage_path: /opt/redmine/files 

Configuring Email

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 ...

To configure the email we will edit the configuration file.

nano /var/www/redmine/config/configuration.yml

The simplest is you use features of the default SendMail in the Centos OS by settings :

  email_delivery:
   delivery_method: :sendmail

Note : Do not use the Tab key to indent when editing the configuration file, you need to use the space bar on the keyboard.

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.

Enter your Gmail account as below :

  email_delivery:
   delivery_method: :smtp
   smtp_settings:
        enable_starttls_auto: true
        address: "smtp.gmail.com" 
        port: 587
        domain: "smtp.gmail.com" 
        authentication: :plain
        user_name: "your_email@gmail.com" 
        password: "your_password"

Save the file configuration and exit.

Create Virtual Host for Redmine

Create an Apache configuration file for the Redmine application at the port 80.

nano /etc/httpd/conf.d/redmine.conf

Copy the text below and paste into the editor window, note the information to change your domain name.

<VirtualHost *:80>
        ServerName your_domain
        ServerAdmin your_domain@domain.com
        DocumentRoot /var/www/redmine/public/
        ErrorLog logs/redmine_error_log
        <Directory "/var/www/redmine/public/">
                Options Indexes ExecCGI FollowSymLinks
                Order allow,deny
                Allow from all
                AllowOverride all
        </Directory>
</VirtualHost>

Save the file configuration and exit.

Running Redmine

Before execute Redmine in the first time, we must permission for the directory installed Redmine and restart Apache service.

cd /var/www
chown -R apache:apache redmine
chmod -R 755 redmine
service httpd restart


Redmine will run at the following address URL :
http://your-domain
Login to system with an administrator account : admin / admin
You can change your password after successful login.
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.

Install Subversion

Subversion, also known as SVN, it is a version management system is very popular and easy to use, most programmers can use it competently.

We need to create a folder to store data for Redmine, the following command creates a directory and permissions for the Apache service.

mkdir -p /opt/repositories/svn
chown -R apache:apache /opt/repositories/
chmod 0755 /opt/repositories

The following command install Subversion and the packages :

yum install mod_dav_svn subversion subversion-ruby
[root@iZ23lttzrggZ /]# yum install mod_dav_svn subversion subversion-ruby
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mod_dav_svn.x86_64 0:1.6.11-10.el6_5 will be installed
---> Package subversion.x86_64 0:1.6.11-10.el6_5 will be installed
---> Package subversion-ruby.x86_64 0:1.6.11-10.el6_5 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================
 Package                       Arch                 Version                          Repository          Size
==============================================================================================================
Installing:
 mod_dav_svn                   x86_64               1.6.11-10.el6_5                  base                79 k
 subversion                    x86_64               1.6.11-10.el6_5                  base               2.3 M
 subversion-ruby               x86_64               1.6.11-10.el6_5                  base               382 k

Transaction Summary
==============================================================================================================
Install       3 Package(s)

Total size: 2.7 M
Total download size: 2.3 M
Installed size: 13 M
Is this ok [y/N]: y
Downloading Packages:
subversion-1.6.11-10.el6_5.x86_64.rpm                                                  | 2.3 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : subversion-1.6.11-10.el6_5.x86_64                                                          1/3 
  Installing : subversion-ruby-1.6.11-10.el6_5.x86_64                                                     2/3 
  Installing : mod_dav_svn-1.6.11-10.el6_5.x86_64                                                         3/3 
  Verifying  : subversion-ruby-1.6.11-10.el6_5.x86_64                                                     1/3 
  Verifying  : mod_dav_svn-1.6.11-10.el6_5.x86_64                                                         2/3 
  Verifying  : subversion-1.6.11-10.el6_5.x86_64                                                          3/3 

Installed:
  mod_dav_svn.x86_64 0:1.6.11-10.el6_5                     subversion.x86_64 0:1.6.11-10.el6_5                
  subversion-ruby.x86_64 0:1.6.11-10.el6_5                

Complete!
[root@iZ23lttzrggZ /]# 

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.

mkdir /usr/lib64/perl5/vendor_perl/Apache
ln -s /var/www/redmine/extra/svn/Redmine.pm /usr/lib64/perl5/vendor_perl/Apache/Redmine.pm

Note : If you are using 32 bit Centos, change the path "/usr/lib64" to "/usr/lib"

After installation is complete, from the Redmine application, go to the page Administration> Settings> Repositories to check the results.

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.

nano /etc/httpd/conf.d/subversion.conf

Add the following lines to the end and still retain the old contents of the file :

PerlLoadModule Apache::Redmine
<Location /svn>
        DAV svn
        SVNParentPath "/opt/repositories/svn" 
        SVNListParentPath on
        Order deny,allow
        Deny from all
        Satisfy any
        LimitXMLRequestBody 0
        SVNPathAuthz off
        PerlAccessHandler Apache::Authn::Redmine::access_handler
        PerlAuthenHandler Apache::Authn::Redmine::authen_handler
        AuthType Basic
        AuthName "Subversion Repository" 
        Require valid-user
        RedmineDSN "DBI:mysql:database=redmine_db;host=localhost:3306" 
        RedmineDbUser "redmine_admin" 
        RedmineDbPass "your_password_database_redmine" 
</Location>

Note : You need to change the password in the "RedmineDbPass" to correct the database password of Redmine.

At this point, we have finished the basic settings for Redmine.

Thank you!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值