2015-08-28

[Redmine]Install redmine 2.5.0 on CentOS 6.6

官方參考網站:http://www.redmine.org/projects/redmine/wiki/install_Redmine_25x_on_Centos_65_complete#Install-PHP-and-phpMyAdmin
官方網站有圖文說明比較容易理解

節錄內容並修改,偷懶沒有抓圖

Update the System
yum update(這個部份更新沒有執行)

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
Enter current password for root (enter for none):輸入 Enter
Set root password? [Y/n] 輸入 y
Remove anonymous users? [Y/n] 輸入 y
Disallow root login remotely? [Y/n] 輸入 n
Remove test database and access to it? [Y/n] 輸入 y
Reload privilege tables now? [Y/n] 輸入 y

測試 172.22.16.30 看到 Apache 2 Test Page

Turn off SELinux
vi /etc/selinux/config
改成這樣 SELINUX=disabled

Set up the Hostname
vi /etc/hosts
改成這樣
127.0.0.1; redmine.Your_domain_Name localhost localhost.localdomain localhost4 localhost4.localdomain4
::1; redmine.Your_domain_Name localhost localhost.localdomain localhost6 localhost6.localdomain6

Configuring the Firewall(這個部份,因為只有內部使用,所以沒有設定)
vi /etc/sysconfig/iptables
新增
-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
vi /etc/sysconfig/ip6tables
新增
-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

/etc/init.d/iptables restart
/etc/init.d/ip6tables restart
chkconfig iptables on
chkconfig ip6tables on
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
vi /etc/httpd/conf.d/phpmyadmin.conf
Replace "Allow from 127.0.0.1" to "Allow from all"

vi /usr/share/phpmyadmin/config.inc.php
$cfg['Servers'][$i]['auth_type'] = 'cookie'; 改成 $cfg['Servers'][$i]['auth_type'] = 'http';

service httpd restart
測試 http://172.22.16.30/phpmyadmin
root/redmine

(這部份沒有設定--Start)
vi /etc/sysconfig/iptables
增加
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
vi /etc/sysconfig/ip6tables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
/etc/init.d/iptables restart
/etc/init.d/ip6tables restart
(這部份沒有設定--End)


vi /etc/httpd/conf/httpd.conf
新增
<VirtualHost *:8080>
DocumentRoot /usr/share/phpmyadmin/
ServerName redmine.your_domain.com
ErrorLog logs/phpmyadmin_error_log
</VirtualHost>

vi /etc/httpd/conf/httpd.conf
新增 Listen 8080
service httpd restart
測試 http://172.22.16.30:8080/
root/redmine

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
會看到 ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
Install Rubygems
yum -y install rubygems

Install Passenge
gem install passenger
passenger-install-apache2-module (檢查用)
http://mrmo.cc/1602/%E5%9C%A8centos-5-6-%E8%AE%93redmine%E9%81%8B%E4%BD%9C%E6%96%BCapache-virtual-host/


會帶出這樣類似以下訊息,複製他
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>
將結果複製 vi /etc/httpd/conf.d/passenger.conf

Create Database for Redmine
mysql --user=root --password=redmine
create database redmine_db character set utf8;
create user 'redmine_admin'@'localhost' identified by 'redmineadmin';
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

vi 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
vi configuration.yml

Configuring Email
vi /var/www/redmine/config/configuration.yml
尚未設定

Create Virtual Host for Redmine
vi /etc/httpd/conf.d/redmine.conf
admin尚未設定

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


出現錯誤
Application error
Rails application failed to start properly

解決:因為不知道這條指令是作檢查 passenger-install-apache2-module
所以只有做了一半(已經補充說明)

重新開機後phpmyadmin進不去
解決:因為我沒有設定 iptables 與 ip6tables,所以必須先關閉

資料匯入使用 bigdump.php
http://redmine.chen.com.tw:8080/bigdump.php

密碼忘記偷吃步
login/hashed_password/salt
admin/db5843f975b409da9d7039cd027e6d86d6f0cded/c09da06617e7a074597d0100403447ba
以上等密碼等於admin/admin

沒有留言:

張貼留言