ownCloud Backup, Upgrade

最後更新: 2023-11-27






  1. service apache2 stop
  2. sudo -u www-data ./occ maintenance:mode --on
  3. rsync ...
  4. mysqldump ...
  5. sudo -u www-data ./occ maintenance:mode --off
  6. service apache2 start




0. Check current version & status

# 要以 data/ 同身份執行

sudo -u apache php occ status

  - installed: true
  - first_install_version:
  - version:
  - versionstring: 10.13.2
  - edition: Community

sudo -u apache php occ check

1. Stop Service

service crond stop & service httpd stop

2. maintenance mode

sudo -u apache ./occ maintenance:mode --on

3. Backup DB & data


4. Start the Upgrade

cd /usr/src

wget https://download.owncloud.com/server/stable/owncloud-10.13.4.tar.bz2

tar -jxf owncloud-10.13.4.tar.bz2

chown -R apache:apache owncloud

cd /var/www

mv owncloud owncloud.bak

mv /usr/src/owncloud ./

cp owncloud.bak/config/config.php owncloud/config/config.php

du -sh owncloud.bak/data                      # 當 size 不小時就要搬它

mv owncloud.bak/data owncloud/

ls -1 owncloud.bak/apps/ | wc -l

ls -1 owncloud.bak/apps-external/ | wc -l             # 額外安的非 core app

# 當有不同時


ls -1 owncloud.bak/apps/ > /tmp/old.txt

ls -1 owncloud/apps/ > /tmp/new.txt

diff /tmp/old.txt /tmp/new.txt


cp -a owncloud.bak/apps-external owncloud/

# Run upgrade routines after upgrading to a new release.

cd owncloud

sudo -u apache php occ upgrade -v

... Repair step: Repair unmerged shares
... Repair step: Disable extra themes
... Starting code integrity check...
... Finished code integrity check
... Update successful
... Maintenance mode is kept active
... Reset log level


... Repair warning: You have incompatible or missing apps enabled that could not be found or updated via the marketplace.
... Repair warning: Please install or update the following apps manually or disable them with:
occ app:disable files_textviewer

sudo -u www-data php occ app:disable files_textviewer

5. Checking

sudo -u apache php occ status

ownCloud is in maintenance mode - no app have been loaded

  - installed: true
  - first_install_version: unknown
  - version:
  - versionstring: 10.5.0
  - edition: Community

sudo -u apache php occ check

ownCloud is in maintenance mode - no app have been loaded

6. Start Service

sudo -u apache php occ maintenance:mode --off

service redis restart

service httpd start

service crond start




Creative Commons license icon Creative Commons license icon