標籤:style http color os io strong ar 檔案 資料
Redmine是用Ruby開發的基於web的專案管理軟體,所以先要下載安裝Ruby,再下載對 Ruby組件進行打包的 Ruby 打包系統RubyGems。
第一步:下載必要的軟體
1、依賴包安裝
# yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
2、下載安裝軟體
Redmine下載:# wget -P ~/tools http://www.redmine.org/releases/redmine-2.5.2.tar.gz
Ruby下載:# wget -P ~/tools http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
RubyGems下載:# wget -P ~/tools http://production.cf.rubygems.org/rubygems/rubygems-2.4.1.tgz
第二步:安裝必要軟體
1、解壓安裝ruby
# cd ~/tools
# tar zxvf ruby-2.1.2.tar.gz
# cd ruby-2.1.2
# ./configure && make && make install
注意:如果編譯時間指定安裝目錄./configure --prefix=/usr/local/ruby,要在安裝完成後要添加環境變數,在/etc/profile最後加入兩行:
PATH=/usr/local/ruby/bin:$PATH
export PATH
查看安裝的ruby版本號碼:# ruby –v
參考結果:ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
2、解壓安裝rubygems
# cd ~/tools
# tar zxvf rubygems-2.4.1.tgz
# cd rubygems-2.4.1
# ruby setup.rb
查看安裝的rubygems版本號碼:# gem –v
參考結果:2.4.1
3、安裝rails
由於國內網路原因(你懂的),導致 rubygems.org 存放在 Amazon S3 上面的資源檔間歇性串連失敗。所以更新一下gem源:
# gem sources --r https://rubygems.org/
# gem sources -a https://ruby.taobao.org/
# gem sources –l
*** CURRENT SOURCES ***
https://ruby.taobao.org
# 請確保只有 ruby.taobao.org
# gem install rails
查看安裝的rails版本號碼:# rails -v
參考結果:Rails 4.1.5
第三步:安裝redmine
1、進入mysql,建立資料庫
mysql> CREATE DATABASE redmine CHARACTER SET utf8;
mysql> CREATE USER ‘redmine‘@‘localhost‘ IDENTIFIED BY ‘my_password‘;
mysql> GRANT ALL PRIVILEGES ON redmine.* TO ‘redmine‘@‘localhost‘;
//注 my_password為自己的mysql密碼。
2、解壓拷貝redmine
# cd ~/tools
# tar zxvf redmine-2.5.2.tar.gz
把解壓後的redmine-2.5.2拷貝到Web目錄下,後文所說的redmine目錄,指的是這個解壓縮後產生的目錄。
3、修改redmine目錄中的設定檔
# cp config/database.yml.example config/database.yml
# vi config/database.yml
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: my_password
//注 my_password為自己的mysql密碼。
4、安裝依賴包
# gem install bundler
# bundle install --without development test rmagick
5、產生會話儲存:
# rake generate_secret_token
6、建立資料庫結構:
# RAILS_ENV=production rake db:migrate
7、插入預設資料:
RAILS_ENV=production REDMINE_LANG=zh rake redmine:load_default_data
8、設定檔案許可權
# mkdir -p tmp tmp/pdf public/plugin_assets
# chown -R redmine:redmine files log tmp public/plugin_assets
# chmod -R 755 files log tmp public/plugin_assets
第四步:啟動redmine
# ruby script/rails server webrick -e production
等待啟動完結後,訪問:http://localhost:3000/。
使用者名稱:admin
密碼:admin
//注localhost為伺服器實際ip,商品許可權要開啟。
第五步:加入自啟動
編輯開機檔案。
# vi /etc/rc.local
最後一行或者適當的位置,加入一下內容。此處必須用絕對路徑。注意根據實際redmine路徑來填寫。
/usr/local/ruby/bin/ruby /www/redmine/script/rails server webrick -e production
CentOS下安裝Redmine 2.5.2