如何升级ownCloud?
- By : Will
- Category : Cloud storage
- Tags: ownCloud
1 理论知识
1.1 手动升级的方法
– 禁用第三方应用程序,升级完成后再重新启用
– 应用程序目录下删除现有的owncloud文件(data/与config除外)
– 上传owncloud文件到应用程序目录
1.2 注意事项
– 升级前请进行数据全备份
– 升级请不要跳过任何一个版本,否者会增加出错的风险
– 不支持降级
2 最佳实践
2.1 基础的环境
本文以你已经搭建或者使用ownCloud云存储为基础,如果你尚未建立该环境,请按照如下教程建立,
https://www.cmdschool.org/archives/523
2.2 升级前的准备
2.2.1 查看启用的APP
sudo -u apache php /var/www/owncloud/occ app:list
信息显示如下:
Enabled: - activity - comments: 0.2 - dav: 0.1.6 - external: 1.2 - federatedfilesharing: 0.1.0 - federation: 0.0.4 - files: 1.4.4 - files_external: 0.5.2 - files_pdfviewer: 0.8.1 - files_sharing: 0.9.1 - files_texteditor: 2.1 - files_trashbin: 0.8.0 - files_versions: 1.2.0 - files_videoplayer: 0.9.8 - firstrunwizard: 1.1 - gallery: 14.5.0 - notifications: 0.2.3 - provisioning_api: 0.4.1 - systemtags: 0.2 - templateeditor: 0.1 - updatenotification: 0.1.0 - user_external: 0.4 - user_ldap: 0.8.0 Disabled: - encryption - files_antivirus
2.2.2 开启维护模式
sudo -u apache php /var/www/owncloud/occ maintenance:mode --on
显示如下:
Maintenance mode enabled
确认维护模式开启成功,
grep maintenanc /var/www/owncloud/config/config.php
提示信息如下,则维护模式修改成功,
'maintenance' => true,
2.2.3 禁用核心APP
sudo -u apache php /var/www/owncloud/occ app:disable activity sudo -u apache php /var/www/owncloud/occ app:disable comments sudo -u apache php /var/www/owncloud/occ app:disable external sudo -u apache php /var/www/owncloud/occ app:disable federation sudo -u apache php /var/www/owncloud/occ app:disable files_external sudo -u apache php /var/www/owncloud/occ app:disable files_pdfviewer sudo -u apache php /var/www/owncloud/occ app:disable files_sharing sudo -u apache php /var/www/owncloud/occ app:disable files_texteditor sudo -u apache php /var/www/owncloud/occ app:disable files_trashbin sudo -u apache php /var/www/owncloud/occ app:disable files_versions sudo -u apache php /var/www/owncloud/occ app:disable files_videoplayer sudo -u apache php /var/www/owncloud/occ app:disable gallery sudo -u apache php /var/www/owncloud/occ app:disable provisioning_api sudo -u apache php /var/www/owncloud/occ app:disable systemtags sudo -u apache php /var/www/owncloud/occ app:disable templateeditor sudo -u apache php /var/www/owncloud/occ app:disable updatenotification sudo -u apache php /var/www/owncloud/occ app:disable user_ldap sudo -u apache php /var/www/owncloud/occ app:disable user_external sudo -u apache php /var/www/owncloud/occ app:disable firstrunwizard sudo -u apache php /var/www/owncloud/occ app:disable notifications
2.2.4 备份非结构化数据
rsync -av --delete /var/www/owncloud/ /data/backup/owncloud/
2.2.5 备份结构化数据
mysqldump -uroot -p --all-database > /data/dbbackup/`date "+%Y%m%d"`-owncloud.sql
2.2.6 查看当前的版本号
sudo -u apache php /var/www/owncloud/occ -V
显示如下:
ownCloud is in maintenance mode - no app have been loaded ownCloud version 9.0.5
2.2.7 下载历史版本
cd ~ wget https://download.owncloud.org/community/owncloud-9.0.6.tar.bz2 wget https://download.owncloud.org/community/owncloud-9.0.7.tar.bz2 wget https://download.owncloud.org/community/owncloud-9.0.8.tar.bz2 [...]
注:请不要错过任何的下一个版本,可以以探测的方式逐个下载
2.2.8 解压压缩包
cd ~ tar -xf owncloud-9.0.6.tar.bz2
注:以下逐个版本执行
2.3 执行升级
2.3.1 停止web服务
/etc/init.d/httpd stop
2.3.2 重命名应用程序目录
rm -rf /var/www/owncloud-old/ mv /var/www/owncloud/ /var/www/owncloud-old
2.3.3 部署新的代码
cd ~ mv owncloud /var/www/
2.3.4 恢复配置文件
cp /var/www/owncloud-old/config/config.php /var/www/owncloud/config/
2.3.5 恢复数据目录
mv /var/www/owncloud-old/data /var/www/owncloud/
或者,可以重新建立软链接的方式重新指向,
ln -s /data/owncloudData/ /var/www/owncloud/data
如果硬盘空间和时间充裕,建议复制,
cp -a /var/www/owncloud-old/data /var/www/owncloud/
2.3.6 恢复第三方
cp -a /var/www/owncloud-old/apps/xxx /var/www/owncloud/apps/
注:xxx代表第三方应用的名称
2.3.7 配置目录权限
chown -R apache:apache /var/www/owncloud chmod -R 775 /var/www/owncloud
2.3.8 启动web服务
/etc/init.d/httpd start
2.3.9 执行升级
sudo -u apache php /var/www/owncloud/occ upgrade
如果顺利可见如下提示,
Set log level to debug Checking whether the database schema can be updated (this can take a long time depending on the database size) Checked database schema update Checking updates of apps Checked database schema update for apps Updating database schema Updated database Starting code integrity check... Finished code integrity check Update successful Maintenance mode is kept active Reset log level
2.5 升级APP
2.5.1 启用APP
sudo -u apache php /var/www/owncloud/occ app:enable activity sudo -u apache php /var/www/owncloud/occ app:enable comments sudo -u apache php /var/www/owncloud/occ app:enable external sudo -u apache php /var/www/owncloud/occ app:enable federation sudo -u apache php /var/www/owncloud/occ app:enable files_external sudo -u apache php /var/www/owncloud/occ app:enable files_pdfviewer sudo -u apache php /var/www/owncloud/occ app:enable files_sharing sudo -u apache php /var/www/owncloud/occ app:enable files_texteditor sudo -u apache php /var/www/owncloud/occ app:enable files_trashbin sudo -u apache php /var/www/owncloud/occ app:enable files_versions sudo -u apache php /var/www/owncloud/occ app:enable files_videoplayer sudo -u apache php /var/www/owncloud/occ app:enable gallery sudo -u apache php /var/www/owncloud/occ app:enable provisioning_api sudo -u apache php /var/www/owncloud/occ app:enable systemtags sudo -u apache php /var/www/owncloud/occ app:enable templateeditor sudo -u apache php /var/www/owncloud/occ app:enable updatenotification sudo -u apache php /var/www/owncloud/occ app:enable user_ldap sudo -u apache php /var/www/owncloud/occ app:enable user_external sudo -u apache php /var/www/owncloud/occ app:enable firstrunwizard sudo -u apache php /var/www/owncloud/occ app:enable notifications
2.5.2 修复启用APP的错误
sudo -u apache php /var/www/owncloud/occ upgrade
如果出现错误提示,可参阅如下文档,
2.6 升级完成的操作
sudo -u apache php /var/www/owncloud/occ maintenance:mode --off
更新的历史版本
===============
https://owncloud.com/older-versions/#server
https://owncloud.org/download/older-versions/
https://owncloud.org/changelog/
更新的手册
===============
https://doc.owncloud.org/server/9.1/admin_manual/maintenance/upgrade.html
手动升级的步骤:
================
https://doc.owncloud.org/server/9.1/admin_manual/maintenance/manual_upgrade.html
没有评论