> CentOS > CentOS教程 >

centos7安装redmine3,并升级redmine1.8到3

1.安装mysql

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-server
service mysql start
2.安装依赖包

yum install mysql-devel
yum install libcurl-devel
yum install ImageMagick-devel


3.安装ruby2.4

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable --ruby
mv /usr/bin/ruby /usr/bin/ruby2.0
ln -s /usr/local/rvm/rubies/ruby-2.4.1/bin/ruby /usr/bin/



4.安装Redmine3

wget http://www.redmine.org/releases/redmine-3.4.2.tar.gz
tar -zxvf redmine-3.4.2.tar.gz -C /opt/
gem install bundler
bundle install --with development test rmagick
RAILS_ENV=production REDMINE_LANG=zh bundle exec rake redmine:load_default_data


5.修改配置文件

cp database.yml.example  database.yml
vi database.yml
修改Production

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: root
  password: "123456"
  encoding: utf8
修改生成sercet.yml

生成密钥

rake secret
把上面命令生成的密钥写入secrets.yml

production:
  secret_key_base:xxxxxx



6.升级redmine

从redmine1里导出数据库后

然后导入到redmine3的数据库中

mysql --default-character-set=utf8 redmine3 < redmine1.sql
#升级数据库
bundle exec rake db:migrate RAILS_ENV=production
#升级插件数据库
bundle exec rake redmine:plugins:migrate RAILS_ENV=production
#清除老的session
bundle exec rake tmp:cache:clear tmp:sessions:clear RAILS_ENV=production



7.配置redmine在nginx里运行

为nginx安装passenger

gem install passenger
passenger-install-nginx
#需要选择nginx的源代码路径,然后程序会自动编译nginx
修改nginx.conf

http{
  ...
  passenger_root /usr/local/rvm/gems/ruby-2.4.1/gems/passenger-5.1.10;
  passenger_ruby /usr/local/rvm/gems/ruby-2.4.1/wrappers/ruby;
  ..
添加server :

server
{
            server_name    redmine.abc.com;
            charset utf8;
            index index.html index.htm index.php;
            root    /opt/redmine-3.4.2/public/;
            passenger_enabled on;
}


(责任编辑:IT)