在centos6.5上安裝redmine 2.53

redmine是很適合用于小型團(tuán)隊(duì)的項(xiàng)目管理軟件,而且開源,界面也清爽,功能也全面。不過(guò)它是ruby開發(fā)的,各種調(diào)試不太適應(yīng),慶幸的是按照官網(wǎng)文檔step by step就可以很容易完成部署了,redmine對(duì)安裝步驟要求和安裝版本比較嚴(yán)格,要一絲不茍。

關(guān)于這個(gè)安裝部署,官網(wǎng)文檔并不能適用于所有情況,所以記錄本次安裝的過(guò)程也能更好的記錄下適配當(dāng)前我遇到的情況。


step 1:安裝相關(guān)軟件環(huán)境依賴

yum -y install 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

step 2:安裝apache和mysql

yum -y install httpd mysql mysql-server

因?yàn)闊o(wú)需要做極限的優(yōu)化,能夠正常使用就行,yum 安裝套件還是很適合一般使用的,最大的好處就是一鍵完成。

step 3:將apache和mysql配置為開機(jī)自啟動(dòng),并在當(dāng)下啟動(dòng)apache和mysql,以便做余下的配置

chkconfig httpd on
chkconfig mysqld on

service httpd start
service mysqld start

step 4:配置mysql 賬號(hào)密碼信息,使用mysql_secure_installation來(lái)配置,也是一個(gè)簡(jiǎn)單的交互式配置工具

按照提示完成配置即可

Because we not have a password for the root account so you press Enter to skip.
Enter current password for root (enter for none):      #輸入當(dāng)前mysql的root密碼,因?yàn)閥um套件關(guān)系,root密碼為空,直接回車即可
Select Yes to set the password for the MySQL root account.  #是否設(shè)置新的mysql root密碼,選是
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 #是否關(guān)閉root遠(yuǎn)程登錄,看你如何選擇了,官網(wǎng)說(shuō)否,如果不是外網(wǎng)服務(wù)器的話,開放也無(wú)所謂。
Delete the test database, select Yes
Remove test database and access to it? [Y/n] y  #移除測(cè)試數(shù)據(jù)庫(kù)
Reload privilege tables, select Yes  #刷新權(quán)限配置信息
Reload privilege tables now? [Y/n] y

step 5: 關(guān)閉selinux

編輯該文件,然后改為以下內(nèi)容

vi /etc/selinux/config
SELINUX=disabled

編輯保存退出后,輸入以下命令,不重啟系統(tǒng)關(guān)閉selinux

setenforce 0

注:

setenforce 1 設(shè)置SELinux 成為enforcing模式

setenforce 0 設(shè)置SELinux 成為permissive模式,即關(guān)閉selinux

step 6 :關(guān)閉iptables

service iptables stop

chkconfig iptables off

因?yàn)椴皇峭饩W(wǎng)服務(wù)器用不到iptables做安全過(guò)濾。

step 7:安裝php和phpmyadmin(選做)

因?yàn)閞edmine是ruby開發(fā),安裝php和phpmyadmin主要是為了方便管理mysql數(shù)據(jù)庫(kù)

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

重啟apache

service httpd restart

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

建立apache配置文件
vi /etc/httpd/conf.d/phpmyadmin.conf


將Allow from 127.0.0.1 改為Allow from all,讓所有人都可以訪問(wèn)

修改phpmyadmin的驗(yàn)證方式為cookie,官網(wǎng)是改成http的,我這里使用cookie,我覺(jué)得cookie更方便
vi /usr/share/phpmyadmin/config.inc.php

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

貌似新版本的都默認(rèn)cookie了

添加mysql 用戶名和密碼,因?yàn)轵?yàn)證是使用mysql的賬號(hào)密碼來(lái)驗(yàn)證的,默認(rèn)配置文件沒(méi)有,所以需要手動(dòng)添加

$cfg['Servers'][$i]['user'] = 'root'; // MySQL user 訪問(wèn)phpmyadmin使用的mysql用戶名 
$cfg['Servers'][$i]['password'] = ''; // MySQL password (only needed對(duì)應(yīng)上述mysql用戶名的密碼 

配置短語(yǔ)密碼(blowfish_secret)

$cfg['blowfish_secret'] = ''; 

如果認(rèn)證方法設(shè)置為cookie,就需要設(shè)置短語(yǔ)密碼,這個(gè)短語(yǔ)密碼是需要生成才比較安全的,置于他的機(jī)制是cookie的加密密碼。

相關(guān)信息:

https://wiki.archlinux.org/index.php/PhpMyAdmin#Add_blowfish_secret_passphrase

訪問(wèn)這個(gè)頁(yè)面可以自動(dòng)生成一個(gè)質(zhì)量好的短語(yǔ)密碼

http://www.question-defense.com/tools/phpmyadmin-blowfish-secret-generator

配置完成后重啟apache

service httpd restart

驗(yàn)證phpmyadmin是否可以用(用mysql賬號(hào)密碼登陸)

http://your-domain/phpmyadmin

step 8:安裝ruby

完整運(yùn)行以下命令

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

運(yùn)行成功會(huì)生成一個(gè)文件,然后運(yùn)行以下命令

source /etc/profile.d/rvm.sh

安裝ruby 1.9.3

rvm install 1.9.3

注:
這個(gè)ruby版本很考究的,目前安裝官網(wǎng)文檔,安裝redmine 2.5X的都可以用1.9.3

安裝完成后檢查ruby版本

ruby -v

安裝rubygems

yum -y install rubygems

注:rubygems是Ruby's packages management program 包管理程序,相當(dāng)于yum 或者apt-get,所有ruby的東西由它來(lái)保(an)護(hù)(zhuang)

安裝Passenger

gem install passenger

passenger-install-apache2-module

注:

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.
總的來(lái)說(shuō)就是ruby和apache結(jié)合的代謝物

上述安裝完成后會(huì)提出提示
如:

<a ><img src="http://www.godblessyuan.com/wp-content/uploads/2015/01/centos6-5_install_redmine2-53__01.png" alt="centos6-5_install_redmine2-53__01" width="901" height="98" class="alignnone size-full wp-image-41" /></a>

.......等

這個(gè)是官網(wǎng)當(dāng)時(shí)做教程的時(shí)候的版本,現(xiàn)在的版本有變化了,一切已事實(shí)為準(zhǔn),注意是安裝完成的提示,復(fù)制出來(lái)然后使用,將復(fù)制的內(nèi)容保存為一個(gè)新的apache配置文件

vi /etc/httpd/conf.d/passenger.conf

粘貼內(nèi)容后保存退出

重啟apache

service httpd restart

step 9: 創(chuàng)建redmine數(shù)據(jù)庫(kù)

mysql --user=root --password=root_password_mysql #命令行登錄數(shù)據(jù)庫(kù)

create database redmine_db character set utf8;  #創(chuàng)建數(shù)據(jù)庫(kù)
create user 'redmine_admin'@'localhost' identified by 'your_new_password'; #創(chuàng)建用戶
grant all privileges on redmine_db.* to 'redmine_admin'@'localhost';  #授權(quán)

quit;

step 10:安裝redmine

cd /var/www #yum套件的web文件存放目錄
wget http://www.redmine.org/releases/redmine-2.5.0.tar.gz #下載最新版本,只要是2.5X范圍即可

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
vi database.yml  #輸入mysql訪問(wèn)信息,賬號(hào),密碼,數(shù)據(jù)庫(kù)名字,使用第一個(gè)production配置,編輯完成后保存退出

step 11:安裝rails

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

注:因?yàn)閴Ω绲脑颍圆荒苤苯影惭b官網(wǎng)源,所以需要先做一步,然后再執(zhí)行g(shù)em install bundler和其他命令

gem sources --remove https://rubygems.org/

gem sources -a http://ruby.taobao.org/   #執(zhí)行失敗的原因是網(wǎng)址格式?jīng)]有完全一致,不能少一個(gè)/或者字母

gem sources -l
*** CURRENT SOURCES ***

http://ruby.taobao.org

確保只有 ruby.taobao.org

安裝過(guò)程稍稍比較緩慢,耐心等待。

安裝完成后初始化數(shù)據(jù)庫(kù),默認(rèn)選擇即可。

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

step 12:激活fcgi

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

step 13: 安裝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

step 14:創(chuàng)建redmine的文件存儲(chǔ)位置

mkdir -p /opt/redmine/files  #這里官網(wǎng)是選了一個(gè)自定義的位置,這個(gè)隨你喜歡,但以此作為例子,文件目錄無(wú)所謂,只要保證權(quán)限能夠被redmine訪問(wèn)即可
chown -R apache:apache /opt/redmine
cd /var/www/redmine/config
cp configuration.yml.example configuration.yml
vi configuration.yml

修改attachements_storage_path: 為你想要配置的目錄即可。

step 15:配置email,redmine可以與郵件聯(lián)動(dòng),類似通知提示。

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

有很多種方式,我這邊一般使用第三方郵件系統(tǒng),方便。

  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" 

注:這里需要注意是格式不能寫錯(cuò),要完全安裝它的格式來(lái)修改,另外delivery method使用smtp,不要使用async,如果發(fā)郵件慢了的話,redmine也會(huì)被卡住,訪問(wèn)緩慢。另外第三方郵件系統(tǒng)有固有的配置方式,參考著配置就可以了,需要有一個(gè)獨(dú)立的郵件發(fā)信賬號(hào)就可以了。

step 16:創(chuàng)建redmine虛擬主機(jī)

vi /etc/httpd/conf.d/redmine.conf
<a ><img src="http://www.godblessyuan.com/wp-content/uploads/2015/01/centos6-5_install_redmine2-53__02.png" alt="centos6-5_install_redmine2-53__02" width="399" height="224" class="alignnone size-full wp-image-42" /></a>
注:redmine目錄要正確,指定好對(duì)于的域名。

授權(quán)apache權(quán)限到redmine目錄,以便apache可以訪問(wèn)redmine
cd /var/www
chown -R apache:apache redmine
chmod -R 755 redmine

service httpd restart

萬(wàn)惡分割線下是 trouble-shooting

  • 重啟apache報(bào)錯(cuò)

    service httpd restart
    Stopping httpd:[FAILED]
    Starting httpd: httpd: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.d/passenger.conf: Cannot load /usr/local/rvm/gems/ruby-1.9.3-p550/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so into server: /usr/local/rvm/gems/ruby-1.9.3-p550/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so: failed to map segment from shared object: Permission denied
    [FAILED]

需要查看apache的日志和redmine的日志REDMINE_DIR/log/production.log
網(wǎng)上查到可以參考的方法,但一定以日志為準(zhǔn),不然就解決不了了:

chcon -R -h -t httpd_sys_script_exec_t /usr/local/rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.33/buildout/apache2/mod_passenger.so #需要注意ruby版本號(hào)和passenger版本目錄

http://stackoverflow.com/questions/20919771/centos-6-4-failed-to-map-segment-from-shared-object-permission-denied

or

ruby版本不對(duì),這個(gè)可能是錯(cuò)誤安裝沒(méi)安裝文檔step by step安裝導(dǎo)致的
重裝ruby即可,當(dāng)然最好是全部推倒重來(lái)。

http://stackoverflow.com/questions/4464985/rails-3-ruby-1-9-2-does-it-need-usr-bin-ruby1-8


  • 訪問(wèn)redmine主頁(yè)出現(xiàn)報(bào)錯(cuò)

    "Internal error
    An error occurred on the page you were trying to access.
    If you continue to experience problems please contact your Redmine administrator for assistance.
    If you are the Redmine administrator, check your log files for details about the error.

還是需要查看apache的日志和redmine的日志REDMINE_DIR/log/production.log

一般原因是沒(méi)有初始化數(shù)據(jù)庫(kù),重新初始化即可

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

http://www.redmine.org/boards/2/topics/12458

鳴謝:
http://www.redmine.org/projects/redmine/wiki/Install_Redmine_25x_on_Centos_65_complete


原文鏈接:http://www.godblessyuan.com/2015/01/07/centos6-5_install_redmine2-53/

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容

  • Tags: redmine 項(xiàng)目管理工具 團(tuán)隊(duì)管理工具 問(wèn)題管理工具 centos下安裝redmine 目錄 作者...
    水士白閱讀 2,519評(píng)論 1 6
  • 文章轉(zhuǎn)自: http://www.lupaworld.com/portal.php?mod=vie...
    liuboxx1閱讀 5,798評(píng)論 1 1
  • 在我們的校園里,充滿知識(shí)的芬芳,誘人的書香。同學(xué)們?cè)谥R(shí)的陶冶下茁壯地成長(zhǎng)。校園里處處景物都會(huì)讓你流連忘返。...
    丞的作文集閱讀 466評(píng)論 2 5
  • 牛奶是最好的蛋白質(zhì)及鈣的食物來(lái)源之一。隨著人們健康意識(shí)的提高,牛奶已經(jīng)成為了人們餐桌上必不可少的一部分。可是超市中...
    寫點(diǎn)小書法閱讀 311評(píng)論 0 0
  • 1.TMBRT分別指5個(gè)關(guān)鍵詞:觸發(fā)器-動(dòng)機(jī)-行為-獎(jiǎng)勵(lì)-觸發(fā)器敏銳度。 2.行為是由觸發(fā)器觸發(fā)的,你撓撓癢癢是“...
    琢磨概念者閱讀 870評(píng)論 0 2