動作
如何在 CentOS 上安裝 Redmine (詳細)¶
- 目錄
- 如何在 CentOS 上安裝 Redmine (詳細)
- 簡介
- 假設
- 安裝說明
- 安裝 gem 和 passenger 的相依套件
- 取得 Ruby
- 取得 Gems 1.4.2 (不適用於 Gems 1.5)
- 安裝 Passenger (需要 gcc)
- 重新啟動 Apache
- 下載 Redmine
- 將資料夾複製到其 HTTP 文件根目錄資料夾
- 設定 Apache 以託管文件
- 安裝 Bundler
- 新增 Bundler 啟動和預先初始化程式碼
- 建立 Gemfile 並在其中註冊這些 gems
- 建立 Redmine MySQL 資料庫
- 設定 /var/www/redmine/config/database.yml (重新命名 database.yml.example)
- 設定生產環境 (選用)
- 產生工作階段儲存
- 遷移資料庫模型
- 載入預設資料 (選用)
- 重新命名 /var/www/redmine/public/ 中的 dispatch CGI 檔案
- 編輯 .htaccess 檔案以進行 CGI 發送設定
- 為 Apache 使用者設定 Chown 和 Chmod 檔案的讀/寫權限
- Redmine 現在應該已完全安裝並可完全使用
簡介¶
CentOS 是基於 Linux 的生產環境中最常選擇的 Linux 作業系統之一。有大量關於設定 CentOS 的文件,對於擁有各種內部 Linux 伺服器部署和管理能力的組織來說,它可以說是部署和運行生產 Linux 伺服器的最佳選擇。
Redmine 是最好的(如果不是最好的)開源問題追蹤和專案管理應用程式之一,但因為它是使用 Ruby on Rails 開發的,所以對於不熟悉 Ruby on Rails 環境的人來說,部署可能會相當複雜。
本操作指南提供了使用以下元件在 CentOS 作業系統上啟動和運行 Redmine 所需的詳細步驟- Apache 網頁伺服器
- MySQL 資料庫管理系統
- Ruby on Rails
- Mod Passenger Apache 模組
本操作指南提供了安裝的詳細說明,並說明了每個步驟的作用,以便熟悉和不熟悉 Ruby on Rails 環境的人都能輕鬆遵循。
假設¶
- CentOS 已安裝並正常運作
- Apache 已安裝並正常運作
- MySQL 已安裝並正常運作
- 您是以 root 身分登入
- 後續步驟會依序完成,不會出現錯誤
安裝說明¶
安裝 gem 和 passenger 的相依套件¶
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
取得 Ruby¶
# Create the directory where you will store the Downloads mkdir ~/Downloads # This can be any directory. # Change to directory where you will store the download cd ~/Downloads # This can be any directory. # FTP to where you will download ruby from. # When asked to login use user/password of anonymous/anonymous ftp ftp.ruby-lang.org Name (ftp.ruby-lang.org:root): anonymous Password: anonymous ftp> cd /pub/ruby ftp> get ruby-1.8.7-pXXX.tar.gz ftp> quit # You have now downloaded ruby and need to untar it tar zxvf ruby-1.8.7-pXXX.tar.gz # Compile ruby cd ruby-1.8.7-pXXX ./configure make make install # Verify ruby installation ruby -v which ruby # Change back into your downloads directory cd ..
取得 Gems 1.4.2 (不適用於 Gems 1.5)¶
wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.2.tgz tar zxvf rubygems-1.4.2.tgz cd rubygems-1.4.2 ruby setup.rb gem -v which gem cd ..
安裝 Passenger (需要 gcc)¶
gem install passenger passenger-install-apache2-module
另一種方法是從以下位置安裝適用於 Apache 的 mod_passenger RPM
http://passenger.stealthymonkeys.com/
RHEL/CentOS 5
rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm yum install mod_passenger
RHEL/CentOS 6
rpm --import http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc yum install http://passenger.stealthymonkeys.com/rhel/6/passenger-release.noarch.rpm yum install mod_passenger
重新啟動 Apache¶
service httpd restart
下載 Redmine¶
下載頁面:http://rubyforge.org/frs/?group_id=1850
wget http://rubyforge.org/frs/download.php/75597/redmine-1.3.0.tar.gz # GET LATEST VERSION ON RUBYFORGE tar zxvf redmine-1.3.0.tar.gz
將資料夾複製到其 HTTP 文件根目錄資料夾¶
cp -av redmine-1.3.0/* /var/www/redmine
配置 Apache 以託管文件¶
更多資訊請參閱:如何配置 Apache 以運行 Redmine
安裝 Bundler¶
gem install bundler
新增 Bundler 啟動和預先初始化程式碼¶
如需更多資訊,請前往 Bundler 網站。
建立 Gemfile 並在其中註冊這些 gem¶
vi /var/www/redmine/Gemfile
# file: /var/www/redmine/Gemfile source "http://rubygems.org" gem "rake", "0.8.3" gem "rack", "1.1.0" gem "i18n", "0.4.2" gem "rubytree", "0.5.2", :require => "tree" gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay gem "mysql" gem "coderay", "~>0.9.7"
bundle install
建立 Redmine MySQL 資料庫¶
yum install mysql-server chkconfig mysqld on service mysqld start /usr/bin/mysql_secure_installation
對於 MySQL
啟動 mysql 用戶端(mysql -u root -p
)並輸入以下命令create database redmine character set utf8; create user 'redmine'@'localhost' identified by 'my_password'; grant all privileges on redmine.* to 'redmine'@'localhost';
對於 5.0.2 之前的 MySQL 版本 - 跳過「建立使用者」步驟,改為
grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';
設定 /var/www/redmine/config/database.yml(重新命名 database.yml.example)¶
設定生產環境(可選)¶
取消註解 redmine/config/environment.rb 檔案中的以下行
ENV['RAILS_ENV'] ||= 'production'
產生工作階段存放區¶
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
按照指示操作。
重新命名 /var/www/redmine/public/ 中的 dispatch CGI 檔案¶
mv dispatch.cgi.example dispatch.cgi mv dispatch.fcgi.example dispatch.fcgi mv dispatch.rb.example dispatch.rb
編輯 .htaccess 檔案以進行 CGI 發送配置¶
mv htaccess.fcgi.example .htaccess
為 Apache 使用者設定檔案的讀/寫權限¶
cd .. chown -R apache:apache redmine-1.x chmod -R 755 redmine-1.x
Redmine 現在應該已完全安裝並可完全使用¶
好好享受吧!