新聞中心
0. 簡(jiǎn)介

0.1 基礎(chǔ)概念
[Redmine] Redmine是用Ruby開(kāi)發(fā)的基于web的項(xiàng)目管理軟件,是用ROR框架開(kāi)發(fā)的一套跨平臺(tái)項(xiàng)目管理系統(tǒng),據(jù)說(shuō)是源于Basecamp的ror版而來(lái),支持多種數(shù)據(jù)庫(kù),有不少自己獨(dú)特的功能,例如提供wiki、新聞臺(tái)等,還可以集成其他版本管理系統(tǒng)和BUG跟蹤系統(tǒng),例如SVN、CVS、TD等等。(百度百科)
[Ruby on Rails] Ruby on Rails 是一個(gè)可以使你開(kāi)發(fā),部署,維護(hù) web 應(yīng)用程序變得簡(jiǎn)單的框架。(百度百科)
0.2 本文說(shuō)明
1)本文沒(méi)有使用apt-get和yum命令,所以對(duì)于各種linux的發(fā)行版本都適用,包括ubuntu,fedora,centos,redhat等。
2)作者在32位和64位系統(tǒng)下均測(cè)試成功,本文提供的方法支持32位和64位系統(tǒng),有不同的地方在文中都已標(biāo)明。
3)本文支持兩個(gè)Redmine版本,分別是1.1.0和1.2.2,細(xì)微差別也在文中說(shuō)明,請(qǐng)讀者按照1.2資源下載表格中對(duì)應(yīng)的版本進(jìn)行安裝,因?yàn)镽edmine對(duì)于版本是敏感的,必須是特定版本,不能過(guò)高也不能過(guò)低,其他組合不保證部署成功。
4)作者在寫(xiě)作本文的時(shí)候Redmine已出另一個(gè)更新版本1.3.0,后續(xù)本文會(huì)作相應(yīng)更新。
5)有任何問(wèn)題,歡迎留言或發(fā)郵件溝通。
1. 環(huán)境 &資源下載
1.1 環(huán)境
Red Hat Enterprise Linux AS release 4 (Nahant Update 3) 64bit
GCC 3.4.5
1.2 資源下載
MySQL 5.1.60 (http://www.mysql.com/downloads/mysql/5.1.html)
Apache httpd server 2.2.21 (http://httpd.apache.org/download.cgi)
|
redmine |
1.2.2 |
1.1.0 | http://rubyforge.org/frs/?group_id=1850 |
|
ruby |
1.8.7 |
1.8.7 | http://ftp.ruby-lang.org/pub/ruby/1.8/ |
|
rubygems |
1.6.2 |
1.3.7 | http://rubyforge.org/frs/?group_id=126 |
|
rake |
0.8.7 |
0.8.7 | |
|
rack |
1.1.1 |
1.0.1 | |
|
rails |
2.3.11 |
2.3.5 |
zlib 1.2.5 (http://www.zlib.org/)
i18n 0.4.2
mysql-ruby 2.8.2 (http://rubyforge.org/frs/?group_id=4550)
passenger 3.0.11 (http://rubyforge.org/frs/?group_id=5873)
openssl 0.9.8k (http://www.openssl.org/source/)
Run the following commands to get some gem files:
wget http://rubygems.org/downloads/rake-0.8.7.gem
wget http://rubygems.org/downloads/rack-1.1.1.gem
wget http://rubygems.org/downloads/rails-2.3.11.gem
wget http://rubygems.org/downloads/activesupport-2.3.11.gem
wget http://rubygems.org/downloads/activerecord-2.3.11.gem
wget http://rubygems.org/downloads/actionpack-2.3.11.gem
wget http://rubygems.org/downloads/actionmailer-2.3.11.gem
wget http://rubygems.org/downloads/activeresource-2.3.11.gem
wget http://rubygems.org/downloads/rack-1.0.1.gem
wget http://rubygems.org/downloads/rails-2.3.5.gem
wget http://rubygems.org/downloads/activesupport-2.3.5.gem
wget http://rubygems.org/downloads/activerecord-2.3.5.gem
wget http://rubygems.org/downloads/actionpack-2.3.5.gem
wget http://rubygems.org/downloads/actionmailer-2.3.5.gem
wget http://rubygems.org/downloads/activeresource-2.3.5.gem
wget http://rubygems.org/downloads/i18n-0.4.2.gem
你可以和本文附錄6.3的下載文件列表進(jìn)行對(duì)比。
2. 步驟
2.0 添加環(huán)境變量
打開(kāi)用戶目錄下的.bashrc文件
vim ~/.bashrc
在.bashrc文件中添加下面兩行:
- export CYN_USR="$HOME/usr"
- export CYN_DOWNLOAD="$HOME/download"
執(zhí)行下面的語(yǔ)句使環(huán)境變量設(shè)置立即生效,而不用重啟
- source ~/.bashrc
注意?。?!你完全不必使用$CYN_USR和$CYN_DOWNLOAD,它們只是方便我后面的操作以及目錄描述,強(qiáng)烈推薦大家使用絕對(duì)路徑。在本文中,$CYN_USR表示我的程序安裝目錄,就像windows系統(tǒng)中的C:Program Files目錄一樣,$CYN_DOWNLOAD是我下載安裝包的保存路徑。
32位還是64位???本文的演示是在64位linux上做的,但我也在32位機(jī)器上部署過(guò)Redmine,步驟上是一樣的。唯一的不同就是MySQL的安裝包不一樣,有32位和64位之分,它們的下載地址是相同的。還有一些軟件采用源代碼安裝方式,也避免了選擇32位還是64位的問(wèn)題。其他基于ruby的軟件,因?yàn)閞uby的跨平臺(tái)性安裝包和部署方法沒(méi)有差別。
$CYN_DOWNLOAD文件列表作者的$CYN_DOWNLOAD目錄內(nèi)容見(jiàn)本文的附錄6.3。
2.1 安裝MySQLcd $CYN_USR
tar zxvf $CYN_DOWNLOAD/mysql-5.1.60-linux-x86_64-glibc23.tar.gz
(或者在32位系統(tǒng)中 tar zxvf $CYN_DOWNLOAD/mysql-5.1.60-linux-i686-glibc23.tar.gz)
ln -s mysql-5.1.60-linux-x86_64-glibc23 mysql
(或者在32位系統(tǒng)中 ln -s mysql-5.1.60-linux-i686-glibc23 mysql)
cd mysql
scripts/mysql_install_db --user=work
其中,work是你的linux用戶名,有的文章說(shuō)新建一個(gè)mysql用戶組和一個(gè)mysql用戶,讀者可以嘗試
安裝后MySQL會(huì)有提示,參考本文附錄6.1
開(kāi)啟MySQL服務(wù):
- $CYN_USR/mysql/bin/mysqld_safe &
關(guān)閉MySQL服務(wù):
- $CYN_USR/mysql/bin/mysqladmin -u root -p SHUTDOWN
2.2 安裝Apache Http服務(wù)器cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/httpd-2.2.21.tar.gz
cd httpd-2.2.21
./configure --prefix=$CYN_USR/httpd
make
make install
開(kāi)啟、關(guān)閉、重啟apache服務(wù)器:
- $CYN_USR/httpd/bin/apachectl start
- $CYN_USR/httpd/bin/apachectl stop
- $CYN_USR/httpd/bin/apachectl restart
2.3 安裝Rubycd $CYN_USR
tar zxvf $CYN_DOWNLOAD/ruby-1.8.7-p174.tar.gz
cd ruby-1.8.7-p174
./configure --prefix=$CYN_USR/ruby
make
make install
2.4 為MySQL、Apache、Ruby添加環(huán)境變量vim ~/.bashrc
在用戶目錄下的.bashrc文件中添加下面幾行內(nèi)容:
- export MYSQL_HOME="$CYN_USR/mysql"
- export HTTPD_HOME="$CYN_USR/httpd"
- export RUBY_HOME="$CYN_USR/ruby"
- export PATH="$PATH:$RUBY_HOME/bin:$MYSQL_HOME/bin:$MYSQL_HOME/lib:$HTTPD_HOME/bin"
執(zhí)行下面語(yǔ)句讓配置立即生效:
source ~/.bashrc
2.5 安裝Rubygemscd $CYN_USR
tar zxvf $CYN_DOWNLOAD/rubygems-1.6.2.tgz
cd rubygems-1.6.2
ruby setup.rb
2.6 安裝zlib
這個(gè)包應(yīng)該是和解壓.gem包有關(guān)
- cd $CYN_USR
- tar zxvf $CYN_DOWNLOAD/zlib-1.2.5.tar.gz
- cd zlib-1.2.5
- ./configure
- make
- make test
- make install
- cd $CYN_USR/ruby-1.8.7-p174/ext/zlib
- ruby extconf.rb
- make
- make install
2.7 安裝Rake、Rack和Rails
如果你要配置Redmine-1.2.2,請(qǐng)安裝rails-2.3.11,act*-2.3.11.gem會(huì)自動(dòng)安裝,但要保證和rails-2.3.11.gem在同一個(gè)目錄下:
- cd $CYN_DOWNLOAD
- gem install --local rake-0.8.7.gem
- gem install --local rack-1.1.1.gem
- gem install --local rails-2.3.11.gem
如果你要配置Redmine-1.1.0,請(qǐng)安裝rails-2.3.5:
- cd $CYN_DOWNLOAD
- gem install --local rake-0.8.7.gem
- gem install --local rack-1.0.1.gem
- gem install --local activesupport-2.3.5.gem
- gem install --local activerecord-2.3.5.gem
- gem install --local actionpack-2.3.5.gem
- gem install --local actionmailer-2.3.5.gem
- gem install --local activeresource-2.3.5.gem
- gem install --local rails-2.3.5.gem
2.8 安裝i18ngem install --local i18n-0.4.2.gem
2.9 配置MySQL
新建一個(gè)名為redmine的數(shù)據(jù)庫(kù),新建一個(gè)名為redmine的用戶,密碼是redminepwd,并賦予對(duì)名為redmine的數(shù)據(jù)庫(kù)的所有權(quán)限
- mysql -u root -p
- CREATE DATABASE redmine CHARACTER SET utf8 COLLATE utf8_general_ci;
- CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redminepwd';
- GRANT ALL ON redmine.* TO 'redmine'@'localhost';
2.10 安裝MySQL-Rubycd $CYN_USR
- tar zxvf $CYN_DOWNLOAD/mysql-ruby-2.8.2.tar.gz
- cd mysql-ruby-2.8.2
- ruby extconf.rb --with-mysql-dir=$CYN_USR/mysql
- make
- ruby ./test.rb -- localhost redmine redminepwd redmine 3306
- make install
2.11 安裝Passenger
passenger可以讓apache服務(wù)器搭載ruby on rails網(wǎng)站
cd $CYN_USR
tar zxvf $CYN_DOWNLOAD/passenger-3.0.11.tar.gz
cd passenger-3.0.11
./bin/passenger-install-apache2-module
安裝完成后會(huì)有類似附錄6.2的提示
2.12 安裝Redminecd $CYN_USR
tar zxvf $CYN_DOWNLOAD/redmine-1.2.2.tar.gz
2.13 配置Redmine
主要是配置數(shù)據(jù)庫(kù)
cd $CYN_USR/redmine-1.2.2
cp config/database.yml.example config/database.yml
vim config/database.yml
在config/database.yml文件中,修改production/development/test節(jié)的內(nèi)容,填寫(xiě)數(shù)據(jù)庫(kù)信息,下面是production節(jié)的示例
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: redminepwd
encoding: utf8
執(zhí)行下面三條語(yǔ)句,初始化數(shù)據(jù)庫(kù),建立表結(jié)構(gòu),并且寫(xiě)入相應(yīng)數(shù)據(jù)
rake generate_session_store
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
2.14 配置Apache Server
在$CYN_USR/httpd/conf/httpd.conf文件中添加下面內(nèi)容,注意把$CYN_USR換成你的絕對(duì)路徑
LoadModule passenger_module $CYN_USR/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot $CYN_USR/passenger-3.0.11
PassengerRuby $CYN_USR/ruby/bin/ruby
Listen 8085
ServerName www.yourhost.com
DocumentRoot $CYN_USR/redmine-1.2.2/public
AllowOverride all
Options -MultiViews
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
2.15 測(cè)試網(wǎng)站
在瀏覽器中訪問(wèn)http://localhost:8085/
3. 可能遇到的問(wèn)題
本部分內(nèi)容有待添加,歡迎讀者留言與我討論
4. 引用
[1] http://www.redmine.org/projects/redmine/wiki/RedmineInstall
[2] http://www.cnblogs.com/wuchang/archive/2011/10/04/2199018.html
5. 更多信息
5.1 官方網(wǎng)站
[1] http://www.redmine.org/
[2] http://rubyonrails.org/
[3] http://www.ruby-lang.org/en/
[4] http://httpd.apache.org/
[5] http://www.mysql.com/
[6] http://rack.rubyforge.org/
[7] http://tmtm.org/en/mysql/ruby/
5.2 Wikis
[1] http://en.wikipedia.org/wiki/Redmine
[2] http://en.wikipedia.org/wiki/Ruby_on_Rails
[3] http://en.wikipedia.org/wiki/Ruby_(programming_language)
6. 附錄
6.1 安裝MySQL的提示Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h your_host_name password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ;./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ;perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
6.2 安裝Passenger的提示--------------------------------------------
The Apache 2 module was successfully installed.
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module $CYN_USR/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot $CYN_USR/passenger-3.0.11
PassengerRuby $CYN_USR/ruby/bin/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
Press ENTER to continue.
--------------------------------------------
Deploying a Ruby on Rails application: an example
Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
ServerName www.yourhost.com
DocumentRoot /somewhere/public # <-- be sure to point to 'public'!
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:
$CYN_USR/passenger-3.0.11/doc/Users guide Apache.html
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) ????
http://www.modrails.com/
Phusion Passenger is a trademark of Hongli Lai &Ninh Bui.
6.3 目錄$CYN_DOWNLOAD下的文件列表
actionmailer-2.3.11.gem
actionmailer-2.3.5.gem
actionpack-2.3.11.gem
actionpack-2.3.5.gem
activerecord-2.3.11.gem
activerecord-2.3.5.gem
activeresource-2.3.11.gem
activeresource-2.3.5.gem
activesupport-2.3.11.gem
activesupport-2.3.5.gem
httpd-2.2.21.tar.gz
i18n-0.4.2.gem
mysql-5.1.60-linux-i686-glibc23.tar.gz
mysql-5.1.60-linux-x86_64-glibc23.tar.gz
mysql-ruby-2.8.2.tar.gz
openssl-0.9.8k.tar.gz
passenger-3.0.11.tar.gz
rack-1.0.1.gem
rack-1.1.1.gem
rails-2.3.11.gem
rails-2.3.5.gem
rake-0.8.7.gem
redmine-1.2.2.tar.gz
ruby-1.8.7-p174.tar.gz
rubygems-1.3.7.tgz
rubygems-1.6.2.tgz
zlib-1.2.5.tar.gz
OK, 這就是Redmine部署的全部?jī)?nèi)容,恭喜你完成Redmine的部署,感謝你的閱讀!
新聞名稱:在Linux上部署Redmine項(xiàng)目管理軟件
本文路徑:http://www.dlmjj.cn/article/dhihcpp.html


咨詢
建站咨詢
