本文將介紹如何在 CentOS 上安裝 Redmine
參考網址:
http://shyam.blog127.fc2.com/blog-entry-6.html
http://www.redmine.org/
本文參考以上網址資料,再以實際安裝狀況修改安裝步驟:
1. 增加 rubyworks.repo
[root@localhost ~]# vi /etc/yum.repos.d/rubyworks.repo
# Link file for RubyWorks yum repository
# Place this file in /etc/yum.repos.d
[rubyworks]
name=RubyWorks
baseurl=http://rubyworks.rubyforge.org/redhat/$releasever/RPMS/$basearch
enabled=1
gpgcheck=1
gpgkey=http://rubyworks.rubyforge.org/RubyWorks.GPG.key
priority=1
2. 安裝 Ruby on Rails
[root@localhost ~]# yum install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc ruby-mysql mysql mysql-server rubygem-mysql
3. 下載並安裝 Ruby Gems
[root@localhost ~]# wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
[root@localhost ~]# tar xvf rubygems-1.3.6.tgz
[root@localhost ~]# cd rubygems-1.3.6
[root@localhost rubygems-1.3.6]# ruby setup.rb
4. 安裝 Rails , 參考 http://www.redmine.org/wiki/redmine/RedmineInstall 安裝所需要的版本, 這裡我安裝 RedMine 1.0.x 版搭配使用 Rails 2.3.5 版本
[root@localhost rubygems-1.3.6]# gem update --system
[root@localhost rubygems-1.3.6]# gem install -v=2.3.5 rails
[root@localhost rubygems-1.3.6]# gem install rack -v=1.0.1
5. 啟動 mysql
[root@localhost ~]# service mysqld start
6. 在資料庫建立 redmine 的相關設定
[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database redmine character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> create user 'redmine'@'localhost' identified by 'PASSWORD';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)
7. 下載 redmine 並解開
[root@localhost ~]# wget http://rubyforge.org/frs/download.php/73457/redmine-1.0.4.tar.gz
[root@localhost ~]# tar zxvf redmine-1.0.4.tar.gz
8. 將 redmine 放在 /opt 底下,請依自己的習慣放置
[root@localhost ~]# mv redmine-1.0.4 /opt/
9. 切換到 redmine 底下
[root@localhost ~]# cd /opt/redmine-1.0.4/
10. 建立資料庫設定檔
[root@localhost redmine-1.0.4]# cp config/database.yml.example config/database.yml
11. 設定Redmine與資料庫連接的設定檔
[root@localhost redmine-1.0.4]# vi config/database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: root
password:
encoding: utf8
12. 設定 Redmine
[root@localhost redmine-1.0.4]# RAILS_ENV=production rake config/initializers/session_store.rb
(in /opt/redmine-1.0.4)
13. 建立資料庫, 此時必需在 RedMine 的目錄下
[root@localhost redmine-1.0.4]# rake db:migrate RAILS_ENV=production
14. 選擇預設語系
[root@localhost redmine-1.0.4]# rake redmine:load_default_data RAILS_ENV=production
(in /opt/redmine-1.0.4)
Select language: bg, bs, ca, cs, da, de, el, en, en-GB, es, eu, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk,
sl, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] zh-TW
====================================
Default configuration data loaded.
15. 啟動 Redmine
[root@localhost redmine-1.0.4]# ruby script/server -e production
16. 開啟瀏覽器輸入 http://localhost:3000 ,預設帳密為 admin/admin
17. 開機時啟動
[root@localhost redmine-1.0.4]# vi /etc/rc.local
ruby /opt/redmine-1.0.4/script/server -e production
留言列表