1.安装依赖库
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
注意: 原来的https://ruby.taobao.org已经不再维护,官网说交由https://gems.ruby-china.org维护,https://gems.ruby-china.org官网说镜像地址已经改为https://gems.ruby-china.com,只能说有点坑。
4.安装bundler
gem install bundler -v=1.17.0 #不加版本号安装的是最新的2.x.x,但是因为redmine使用的比较早的版本,必须指定版本,否则后续无法进行 rails这里不安装,后续会通过Gemfile一并其他的一起安装。
5.安装MySQL
mysql安装有多种方式,这里直接使用apt来安装:
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
启动mysql服务
service mysqld start
登录mysql
mysql -u root -p
这里如果不知道初始密码可以百度一下忘记mysql密码,这里就不再细说了。
6.创建redmine数据库
登录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配置数据库连接:
cp config/database.yml.example config/database.yml
修改database.yml中“production”小结内容如下:
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"
执行以下命令
bundle install --without development test
rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate #创建表
RAILS_ENV=production bundle exec rake redmine:load_default_data #选择语言区域
mkdir -p tmp tmp/pdf public/plugin_assets
配置附件存放目录
cp config/configuration.yml.example config/configuration.yml
修改config/configuration.yml内容如下:
# = 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:
其实主要是配置attachments_storage_path,其他可以看需要自行配置。
启动Ruby服务器:
ruby bin/rails server webrick -e production
本机可以通过浏览器打开http://127.0.0.1:3000
如果要在其他机器上访问的话
ruby bin/rails server webrick -e production -b 0.0.0.0 -p 8080
网友评论