在Ubuntu 16.04 LTS上安裝redmine 3.2.0
Ubuntu安裝redmine詳細(xì)過(guò)程
1.安裝依賴庫(kù)
apt-get install libssl-dev libssl1.0.0 libaio-dev libaio1 libmagickcore-dev libmagickwand-dev imagemagick libcurl4-openssl-dev
2.安裝Ruby
cd /usr/local
wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz
tar -zxvf ruby-2.3.0.tar.gz
cd ruby-2.3.0
./configure
make
make install
3.修改gem源
gem source -r https://rubygems.org/
gem source -a https://gems.ruby-china.com
gem update
注意: 原來(lái)的https://ruby.taobao.org已經(jīng)不再維護(hù)寸谜,官網(wǎng)說(shuō)交由https://gems.ruby-china.org維護(hù),https://gems.ruby-china.org官網(wǎng)說(shuō)鏡像地址已經(jīng)改為https://gems.ruby-china.com属桦,只能說(shuō)有點(diǎn)坑含友。
4.安裝bundler
gem install bundler -v=1.17.0 #不加版本號(hào)安裝的是最新的2.x.x笋敞,但是因?yàn)閞edmine使用的比較早的版本,必須指定版本疾牲,否則后續(xù)無(wú)法進(jìn)行 rails這里不安裝庭砍,后續(xù)會(huì)通過(guò)Gemfile一并其他的一起安裝戴质。
5.安裝MySQL
mysql安裝有多種方式抗俄,這里直接使用apt來(lái)安裝:
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
啟動(dòng)mysql服務(wù)
service mysqld start
登錄mysql
mysql -u root -p
這里如果不知道初始密碼可以百度一下忘記mysql密碼裹刮,這里就不再細(xì)說(shuō)了。
6.創(chuàng)建redmine數(shù)據(jù)庫(kù)
登錄mysql
CREATE DATABASE redmine CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'%' IDENTIFIED BY '123456';
FLUSH PRIVILEGES;
7.安裝Redmine
cd /usr/local
wget https://github.com/redmine/redmine/archive/3.4.10.tar.gz
mkdir redmine-3.4.10
tar -zxvf 3.4.10.tar.gz redmine-3.4.10
cd /usr/local/redmine-3.4.10
為redmine配置數(shù)據(jù)庫(kù)連接:
cp config/database.yml.example config/database.yml
修改database.yml中“production”小結(jié)內(nèi)容如下:
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: 123456
encoding: utf8
編輯redmine的Gemfile:
修改source為https://gems.ruby-china.com
在“gem rbpdf”一行下面添加:
gem "rbpdf-font", "~> 1.19.0"
執(zhí)行以下命令
bundle install --without development test
rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate #創(chuàng)建表
RAILS_ENV=production bundle exec rake redmine:load_default_data #選擇語(yǔ)言區(qū)域
mkdir -p tmp tmp/pdf public/plugin_assets
配置附件存放目錄
cp config/configuration.yml.example config/configuration.yml
修改config/configuration.yml內(nèi)容如下:
# = Redmine configuration file
#
# Each environment has it's own configuration options. If you are only
# running in production, only the production block needs to be configured.
# Environment specific configuration options override the default ones.
#
# Note that this file needs to be a valid YAML file.
# DO NOT USE TABS! Use 2 spaces instead of tabs for identation.
# default configuration options for all environments
default:
# Outgoing emails configuration
# See the examples below and the Rails guide for more configuration options:
# http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
# email_delivery:
attachments_storage_path: /opt/redmine/files
# specific configuration options for production environment
# that overrides the default ones
production:
# specific configuration options for development environment
# that overrides the default ones
development:
其實(shí)主要是配置attachments_storage_path蔚鸥,其他可以看需要自行配置。
啟動(dòng)Ruby服務(wù)器:
ruby bin/rails server webrick -e production
本機(jī)可以通過(guò)瀏覽器打開http://127.0.0.1:3000
如果要在其他機(jī)器上訪問(wèn)的話
ruby bin/rails server webrick -e production -b 0.0.0.0 -p 8080