Monday, September 8, 2014

How to install Redmine

===============================================================
Install the dependencies packages
===============================================================
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

===============================================================
Install Apache and MySQL
===============================================================

yum -y install httpd mysql mysql-server

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

/usr/bin/mysql_secure_installation

===============================================================
Turn off SELinux
===============================================================
vim /etc/selinux/config
SELINUX=disabled

===============================================================
Set up the Hostname
===============================================================
vim /etc/hosts

===============================================================
Disable IPTALBES
===============================================================
/etc/init.d/iptables stop
/etc/init.d/ip6tables stop
chkconfig iptables off
chkconfig ip6tables off

reboot

===============================================================
Install PHP and phpMyAdmin
===============================================================
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

service httpd restart


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


vim /etc/httpd/conf.d/phpmyadmin.conf
change "Allow from 127.0.0.1" to "Allow from all"


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

Replace text :
$cfg['Servers'][$i]['auth_type'] = 'cookie';

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

service httpd restart


vim /etc/httpd/conf.d/phpmyadmin.conf

<VirtualHost *:8081>
    DocumentRoot /usr/share/phpmyadmin/
    ServerName costi02
</VirtualHost>

vim /etc/httpd/conf/httpd.conf

add

Listen 8081

service httpd restart


http://localhost:8081

==================================================================
Install Ruby
==================================================================
curl -L https://get.rvm.io | bash
source /etc/profile.d/rvm.sh
rvm list known

rvm install 1.9.3
ruby -v

==================================================================
Install Rubygems
==================================================================

yum -y install rubygems

==================================================================
Install Passenger
==================================================================
gem install passenger
passenger-install-apache2-module

vim /etc/httpd/conf.d/passenger.conf

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

service httpd restart

=================================================================
Create Database for Redmine
=================================================================

mysql --user=root --password=omnibis
create database redmine_db character set utf8;
create user 'redmine_admin'@'localhost' identified by 'redadmin';
grant all privileges on redmine_db.* to 'redmine_admin'@'localhost';
quit;

================================================================
Install Redmine
================================================================

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

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

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

================================================================
Setting up Rails
================================================================

cd /var/www/redmine
gem install bundler
bundle install
rake generate_secret_token

RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data

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

mkdir -p /opt/redmine/files
chown -R apache:apache /opt/redmine
cd /var/www/redmine/config
cp configuration.yml.example configuration.yml
vim configuration.yml

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 ":"

=================================================================
Configuring Email
=================================================================

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

email_delivery:
   delivery_method: :sendmail
 
For GMAIL

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"


=================================================================
Create Virtual Host for Redmine
=================================================================

vim  /etc/httpd/conf.d/redmine.conf

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

==================================================================
Running Redmine
==================================================================

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

==================================================================
Install Subversion
==================================================================

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

yum install mod_dav_svn subversion subversion-ruby


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

vim /etc/httpd/conf.d/subversion.conf

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>


==================================================================
Install Sample DATA
==================================================================

cd /var/www/redmine

RAILS_ENV=production bundle exec rake generate_session_store
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data



If you change any db keep mind to do following

cd /var/www/redmine
RAILS_ENV=production rake db:migrate