redmine安裝部署文檔


############################################################################## 
官網:http://www.redmine.org/ 
Redmine是一個開源的,基於Web的項目管理和缺陷跟蹤工具.它用日曆和甘特圖輔助項目及進度可視化顯示.同時它又支持多項目管理.Redmine是一個自由開放源碼軟件解決方案,它提供集成的項目管理功能,問題跟蹤,併爲多個版本控制選項的支持.雖然說像IBM Rational Team Concert的商業項目調查工具已經很強大了,但想堅持一個自由和開放源碼的解決方案,可能會發現Redmine是一個有用的Scrum和敏捷的選擇.因爲Redmine的設計受到Rrac的較大影響,因此它們的軟件包有不少類似的特徵。Redmine創建在Ruby on Rails的框架之上,他能夠誇平臺和數據庫。 
############################################################################## 
redmine 用戶手冊: 
http://www.ossxp.com/doc/redmine/user_guide/user_guide.html 


一、ruby安裝 
查找並刪除系統默認的ruby軟件 
rpm -qa ruby 
rpm -e --nodeps ruby 

mkdir /tools/ruby -p 
cd /tools/ruby 
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz 
tar -zxvf ruby-2.0.0-p353.tar.gz 
cd ruby-2.0.0-p353 
./configure -prefix=/usr/local/ruby 
make && make install 
cd .. 

#添加系統環境變量 
echo 'export PATH=$PATH:/usr/local/ruby/bin' >>/etc/profile 
source /etc/profile 

#檢驗 
ruby -v 

二、更換gem源 (RubyGems的官方網站是http://www.rubygems.org/,是個包管理工具,至關於RPM、yum等工具。) 
a) gem sources -a http://ruby.taobao.org/ 
新增GEM源 
b) gem sources –remove https://rubygems.org/ 
刪除自帶官方源 
c) gem sources -l 
查看gem源。確保只剩下ruby.taobao.org 



三、安裝bundle等依賴 
Rake的官方網站是http://rake.rubyforge.org/,可讓gem聯網下載安裝,也能夠在官方網站下載後進行安裝。 
Ruby on Rails的官方網站是http://rubyonrails.org/ 

gem install bundler 

gem install rails 

gem install rake 

gem install mysql2 
若是mysql是編譯安裝的,可以使用 -with-mysql-config=mysql_config 的位置 

gem install mysql2 -with-mysql-config=/usr/local/mysql-5.1.68/bin/mysql_config 

四、下載redmine 
mkdir /tools/redmine -p 
cd /tools/redmine 
wget http://www.redmine.org/releases/redmine-2.4.2.tar.gz 
tar -zxvf redmine-2.4.2.tar.gz 
mv redmine-2.4.2 /usr/local/redmine 

五、#數據庫上執行以下操做: 
create database redmine; 
grant all privileges on redmine.* to redmine@localhost identified by 'redmine'; 
flush privileges; 

cd /usr/local/redmine/config 
cp database.yml.example database.yml 

vi database.yml(前幾行修改爲以下內容,注意冒號後要有空格) 
######################################################## 
production: 
adapter: mysql 
database: redmine #數據庫 
host: localhost #服務器IP 
username: redmine #數據庫用戶 
password: redmine #數據庫密碼 
encoding: utf8 
socket: /usr/local/mysql-5.0.92/tmp/mysql.sock 
######################################################## 


六、生成會話密鑰 
cd /usr/local/redmine 
rake generate_secret_token 

若出現如下錯誤提示: 
------------------------------------------------------------------------------------------------------------- 
[root@test config]# rake generate_secret_token 
(in /usr/local/redmine) 
Could not find gem 'rails (= 3.2.16) ruby' in the gems available on this machine. 
Run `bundle install` to install missing gems. 

[root@test config]# bundle update 

[root@test config]# rake generate_secret_token 
(in /usr/local/redmine) 
------------------------------------------------------------------------------------------------------------- 

七、rails數據庫生成和數據初始化 
RAILS_ENV=production rake db:migrate 
//生成表結構 
RAILS_ENV=production REDMINE_LANG=zh rake redmine:load_default_data 
////語言環境這裏配置成zh,顯示在web上的 

八、啓動redmine 
啓動須redmine根目錄下 
cd /usr/local/redmine 
nohup ruby script/rails server webrick -e production -p 8000 > /usr/local/redmine/log/webrick.log &//默認是3000 

附註:redmine默認端口的修改路徑: 
/www/redmine/vendor/rails/railties/lib/commands/server.rb 

九、http://IP:8000 訪問測試 
admin/admin 
修改密碼 管理–用戶 


十、備份還原 
Redmine的用戶和問題等信息存儲於Mysql數據庫,表名爲redmine而附件等資源存儲於Redmine安裝目錄的files目錄下.所以須要遷移的話只須要備份Mysql數據庫的對應的表和files目錄便可。 
備份配置文件config\*.yml 


但這樣只是以獨立的方式啓動redmine的服務器,在後臺執行,有些不足,由於客戶端的訪問日誌會在終端上直接顯示。 
而且你退出終端時,服務器進程也會跟着關閉,後面再介紹啓動和關閉腳本的編寫,以及如何用nginx作反向代理,或是用Apache也能夠, 
這個網上能夠搜索到不少資料。 


#### svn 中文亂碼問題 
管理 -- 配置 -- 附件和版本庫編碼 --GBK 保存就能夠了 
http://www.cnblogs.com/compulsive/archive/2011/08/23/2151380.html 

—————————————————————————————————————————————— 

參考:http://www.redmine.org/projects/redmine/wiki/RedmineInstall 
cd /usr/local/redmine/config 
cp configuration.yml.example configuration.yml //配置郵件 

—————————————————————————————————————————————— 
安裝主題 

#到http://www.redmine.org/projects/redmine/wiki/Theme_List下載本身喜歡的主題 

ModulaMartini, ModuleMojito和pixel-cooker,推薦使用 piexl-cooker,感受很cool 

#將zip包解壓到 redmine/public/themes/ 

cd /usr/local/redmine/public/themes/ 
unzip 主題.zip //解壓、 重啓redmine 

#檢查application.css是否在: 
#redmine/public/themes/<themename>/stylesheets/application.css 

在Web界面下設置新主題 
管理–配置–顯示– 從下拉列表中選擇要使用的主題,保存便可生效 

—————————————————————————————————————————————— 

安裝插件 

http://www.redmine.org/plugins //插件列表 

redmine_ckeditor //編輯器 

redmine_wiki_extensions-0.6.4.zip //wiki 擴展 

redmine_agile-1_3_0-light.zip //問題列表的功能 

redmine_wiki_books-master.zip //wiki 書籍 


redmine_lightbox-master.zip // 支持 wiki 縮略圖縮放 


一、下載插件,解壓後,放到redmine根目錄的plugins下面 
二、 Migrate plugin: 
rake redmine:plugins:migrate RAILS_ENV=production 
三、重啓redmine 就可使用了 

—————————————————————————————————————————————— 
redmine和nginx/apache整合 
默認狀況下,訪問redmine須要經過http://ip:port的形式來打開,爲方便用戶,須要用域名的方法直接打開redmine,此時就須要nginx與redmine的整合了。 

nginx與redmine的整合 

經過nginx的一個passenger模塊來實現 

使用gem安裝passenger 
gem install passenger 

獲取passenger路徑 
passenger-config about nginx-addon-dir 

從新編譯nginx,添加passenger模塊 


--add-module=/usr/local/ruby/lib/ruby/gems/2.0.0/gems/passenger-4.0.41/ext/nginx 


./configure --prefix=/usr/local/nginx-1.4.3 \
--add-module=/usr/local/ruby/lib/ruby/gems/2.0.0/gems/passenger-4.0.41/ext/nginx 


nginx 配置以下: 
passenger_root必定要配置 
具體能夠參考這個網址:http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_installing_as_a_normal_nginx_module_without_using_the_installer

passenger_root /usr/local/ruby/lib/ruby/gems/2.0.0/gems/passenger-4.0.41; 
upstream redmine_sa { 
server 127.0.0.1:8000; 


server 

listen 80; 
server_name redmine_sa.com; 
root /usr/local/redmine/public; 

location / { 
proxy_pass http://redmine_sa
proxy_set_header Host $host; 
proxy_set_header X-Real_IP $remote_addr; 
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
passenger_enabled on; 





Apache反向代理 

gem install passenger 
passenger-install-apache2-module 

若是報passenger-install-apache2-module這條命令找不到的話,那麼經過下面的命令查看執行路徑: 
gem environment 
RubyGems Environment: 
– RUBYGEMS VERSION: 1.3.7 
– RUBY VERSION: 1.8.7 (2009-04-08 patchlevel 160) [i686-linux] 
– INSTALLATION DIRECTORY: /usr/local/ruby/lib/ruby/gems/1.8 
– RUBY EXECUTABLE: /usr/local/ruby/bin/ruby 
– EXECUTABLE DIRECTORY: /usr/local/ruby/bin 
– RUBYGEMS PLATFORMS: 
– ruby 
– x86-linux 
– GEM PATHS: 
– /usr/local/ruby/lib/ruby/gems/1.8 
– /root/.gem/ruby/1.8 
– GEM CONFIGURATION: 
– :update_sources => true 
– :verbose => true 
– :benchmark => false 
– :backtrace => false 
– :bulk_threshold => 1000 
– REMOTE SOURCES: 
– http://rubygems.org/ 
其中,EXECUTABLE DIRECTORY就是命令的全路徑,因此對於我例子裏的狀況執行/usr/local/ruby/bin/passenger-install-apache2-module 
根據提示安裝和部署。passenger會在本機編譯併成爲apache的一個模塊。安裝過程當中會遇到下面的提示信息(根據版本的不一樣,信息也會稍有變化): 
Welcome to the Phusion Passenger Apache 2 module installer, v2.2.15. 
This installer will guide you through the entire installation process. It 
shouldn’t take more than 3 minutes in total. 
Here’s what you can expect from the installation process: 
1. The Apache 2 module will be installed for you. 
2. You’ll learn how to configure Apache. 
3. You’ll learn how to deploy a Ruby on Rails application. 
Don’t worry if anything goes wrong. This installer will advise you on how to 
solve any problems. 
The Apache 2 module was successfully installed. 
Please edit your Apache configuration file, and add these lines: 
LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so 
PassengerRoot /usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.15 
PassengerRuby /usr/local/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! 
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: 
/usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.15/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. 
根據提示信息部署: 
首先,編輯apache的配置文件(/etc/httpd/conf/httpd.conf)並添加下面的信息: 
LoadModule passenger_module /usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so 
PassengerRoot /usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-2.2.15 
PassengerRuby /usr/local/ruby/bin/ruby 

而後啓用Apache的虛擬主機支持: 
一、註釋掉原有的ServerName,ServerAdmin,DocumentRoot的信息; 
二、啓用虛擬主機的支持,去掉NameVirtualHost *:80前面的#; 
三、在配置文件的末尾加上: 
<VirtualHost *:80> 
ServerName redmine.loosky.net 
ServerAdmin loosky@fjut.edu.cn 
DocumentRoot /var/www/redmine/public 
ErrorLog logs/redmine_error_log 
<Directory 「/var/www/redmine/public」> 
Allow from all 
AllowOverride all 
</Directory> 
</VirtualHost> 
四、重啓Apache服務器:service httpd restart css


——————————————————————————————————————————————————————html


參考博客:node

http://blog.sina.com.cn/s/blog_55a7d3ea0101ebt9.htmlmysql

http://blog.csdn.net/benkaoya/article/details/8762935linux

http://jartai.i234.me/wordpress/?p=116nginx

http://blog.csdn.net/wangzh1013/article/details/8558390web

http://dl528888.blog.51cto.com/2382721/1217139sql

http://blog.csdn.net/renkai611919/article/details/7879877數據庫

http://ruby-china.org/wiki/mac-nginx-passenger-railsapache

相關文章
相關標籤/搜索