欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Redmine升级/迁移

程序员文章站 2022-04-13 14:24:33
...

http://bitnami.org/article/how-to-backup-and-update-the-bitnami-redmine-stack#updating-stack

原环境说明

安装目录:/opt/redmine

数据库文件:/opt/redmine/apps/redmine/config/database.yml

邮件文件:/opt/redmine/apps/redmine/config/email.yml

步骤

首先停止正在运行的redmine服务:

#cd /opt/redmine

#./ctlscript.sh stop

然后单独启动mysql服务,并将数据库进行备份,在关闭服务:

#./ctlscript.sh start mysql

#/opt/redmine/mysql/bin/mysqldump -u bitnami -p bitnami_redmine > bitnami_redmine.sql

#./ctlscript.sh stop mysql

将原来的安装文件重命名为redmine-old

#mv /opt/redmine /opt/redmine-old

接着安装最新版的bitnami_redmine文件,下载地址:http://bitnami.org/stack/redmine

下载完成后,添加可执行权限,然后运行文件,按照提示进行安装即可,新的redmine的安装目录为/opt/redmine

将之前备份的数据库文件导入到新的数据库中,提供的用户名和密码在新的配置文件中/opt/redmine/apps/redmine/htdocs/config/database.ymlproduction:部分查看;

如果是迁移:

 

$ mysql -u root -p 
Password: ****
mysql> drop database bitnami_redmine;
mysql> create database bitnami_redmine;
mysql> grant all privileges on bitnami_redmine.* to 'bitnami_redmine'@'localhost' identified by 'DATABASE_PASSWORD';

 

导入数据

#/opt/redmin/mysql/bin/mysql -u bitnami -p bitnami_redmine < bitnami_redmine.sql

然后将redmine-old目录下的fils文件中的所有内容拷贝到redmine

#cp /opt/redmine-old/apps/redmine/files /opt/redmine/apps/redmine/htdocs/files

如果安装了相关插件的话,需要将插件目录文件拷贝到新的里面:

#cp /opt/redmine-old/apps/redmine/htdocs/plugins/<plugin_name> /opt/redmine/apps/redmine/htdocs/plugins/

最后需要migrations:(这一步非常关键,否则会出现error 500)

#vim /etc/profile

export PATH=$PATH:/opt/redmine/ruby/bin

#source /etc/profile

#cd /opt/redmine/apps/redmine/htdocs

# bundle install

#rake db:migrate RAILS_ENV=production

rake redmine:plugins:migrate RAILS_ENV=production

最后清除缓存会话:

#rake tmp:cache:clear

#rake tmp:sessions:clear

重启服务即可完成:

#/opt/redmine/ctlscript.sh restart