Redmine 3.x 升级 4.x[升级前请注意插件版本是否兼容4.X]

发布于 2019-04-07  3726 次阅读


因公司项目的redmine安装到一台6.5的centos上,计划升级,开始我在原来机器上准备安装4.0.3,但是发现安装有错误提示

The version of glibc installed in the system 2.12 is not compatible. You can
find more information here:
https://docs.bitnami.com/installer/faq/linux-faq/troubleshooting/check-glibc-linux/
Please use this installer in an operating system with glibc greater than 2.17.

使用

ldd --version

发现centOS 的Glibc版本是 2.12,4.X需要最低版本是2.17,也就是说需要用centos7.

Ubuntu 8.04: 2.7
Ubuntu 10.04: 2.11
Ubuntu 12.04: 2.15
Ubuntu 14.04: 2.19
Debian 5 (Lenny): 2.7
Debian 6 (Squeeze): 2.11
Debian 7 (Wheezy): 2.13
Debian 8 (Jessie): 2.19
RHEL 5: 2.5
RHEL 6: 2.12
RHEL 7: 2.17

[title]在CentOS7 上操作[/title]

mkdir /db &&cd /db
wget https://bitnami.com/redirect/to/501550/bitnami-redmine-4.0.3-0-linux-x64-installer.run
chmod +x bitnami-redmine-4.0.3-0-linux-x64-installer.run
./bitnami-redmine-4.0.3-0-linux-x64-installer.run

安装过程略,请看我上一篇日志的安装部分。

    http://bilibala.cc/archives/redmine-3-2-1-0-server/

把redmine 4.0.3 安装好后
将旧mysql库传到新服务器上。

[title]Centos 6.5 上操作[/title]
备份数据库、附件、插件

cd /opt/redmine-3.2.1-0/
./user_redmine
mysqldump  -ubitnami -p【密码可以在opt/redmine-3.2.1-0/apps/redmine/htdocs/config/database.yml查看】 bitnami_redmine > /db/redmine_db/redmine-`date +%Y%m%d%H`.sql;
cd /opt/redmine-3.2.1-0/apps/redmine/htdocs
zip -r files-plugins.zip ./files/ ./plugins/
cp files-plugins.zip /db/

将备份数据库与附件,插件传到Centos7 /db/目录下

scp -r /db/* root@10.0.0.228:/db/

[title]在CentOS7 上操作[/title]
先看看数据库的密码

cat /opt/redmine-4.0.3-0/apps/redmine/htdocs/config/database.yml

production:
password: ebb7e6c07d

cd /opt/redmine-4.0.3-0/
./user_redmine
mysql -ubitnami -pebb7e6c07d -P3307

删除原数据库

mysql > drop database bitnami_redmine;

建立数据库,编码为UTF8

mysql > create database bitnami_redmine DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql > use bitnami_redmine;

导入数据

mysql > source /db/redmine-2019040709.sql;

升级数据结构

cd /opt/redmine-4.0.3-0/apps/redmine/htdocs/
ruby bin/rake db:migrate RAILS_ENV=production

恢复附件与插件

cd /db
unzip -o files-plugins.zip -d /opt/redmine-4.0.3-0/apps/redmine/htdocs/
cd /opt/redmine-4.0.3-0/
./use_redmine
cd /opt/redmine-4.0.3-0/apps/redmine/htdocs/
ruby bin/rake redmine:plugins RAILS_ENV="production" 

注:如果插件版本不兼容会报错,请三思后再升级。
清理缓存和会话:

ruby bin/rake tmp:cache:clear
ruby bin/rake tmp:sessions:clear

重启 redmine

cd /opt/redmine-4.0.3-0 && ./ctlscript.sh restart

一沙一世界,一花一天堂。君掌盛无边,刹那成永恒。