Manually upgrade owncloud from 10.9.0 to 10.9.1
ปรับปรุงล่าสุดเมื่อ 23-02-2565 โดย วิบูลย์
///// This is not shell script, you run one command at a time. ///// php command line use php7.4 ///// 10.9.0 to 10.9.1 ///// Manual upgrade need root privileged sudo su - ///// Working directory cd /var/www/html ///// Check and download latest mkdir mytmp cd mytmp wget https://download.owncloud.org/community/owncloud-10.9.1.tar.bz2 tar -xjf owncloud-10.9.1.tar.bz2 cd .. ///// Inform user it is maintenance time sudo -u www-data php7.4 owncloud/occ maintenance:mode --on ///// If use cron, then stop cron. vi /etc/cron.d/owncloud-cron-dot-php #*/15 * * * * www-data php7.4 -f /var/www/html/owncloud/occ system:cron ///// Backup first, ///// This example assumes Ubuntu Linux and MariaDB mkdir -p /root/backupowncloud/ cp -rv /var/www/html/owncloud /root/backupowncloud/owncloud-10.9.0 mysqldump -u root -p your_db_name > /root/backupowncloud/backup-file-10.9.0.sql ///// This command lists all apps by <app-id> and app version sudo -u www-data php7.4 owncloud/occ app:list ///// Disable Core Apps sudo -u www-data php7.4 owncloud/occ app:disable activity sudo -u www-data php7.4 owncloud/occ app:disable files_pdfviewer sudo -u www-data php7.4 owncloud/occ app:disable files_texteditor sudo -u www-data php7.4 owncloud/occ app:disable files_mediaviewer sudo -u www-data php7.4 owncloud/occ app:disable templateeditor sudo -u www-data php7.4 owncloud/occ app:disable twofactor_totp ///// Stop web server service apache2 stop ///// Use latest owncloud directory mv owncloud owncloud10.9.0 mv mytmp/owncloud . cp owncloud10.9.0/config/config.php owncloud/config/ ///// Because our owncloud data is soft link to /srv/data so I need to make a soft link ln -s /srv/data/ owncloud/data ///// Need start apache2 before run upgrade command service apache2 start chown -R www-data:www-data owncloud sudo -u www-data php7.4 owncloud/occ upgrade 2022-02-23T07:11:03+00:00 Starting code integrity check... 2022-02-23T07:11:05+00:00 Finished code integrity check 2022-02-23T07:11:05+00:00 Update successful 2022-02-23T07:11:05+00:00 Maintenance mode is kept active 2022-02-23T07:11:05+00:00 Reset log level ///// copy folder of Core Apps from old that disable before upgrade cp -rp owncloud10.9.0/apps/activity/ owncloud/apps/ cp -rp owncloud10.9.0/apps/files_pdfviewer/ owncloud/apps/ cp -rp owncloud10.9.0/apps/files_texteditor/ owncloud/apps/ cp -rp owncloud10.9.0/apps/files_mediaviewer/ owncloud/apps/ cp -rp owncloud10.9.0/apps/templateeditor/ owncloud/apps/ cp -rp owncloud10.9.0/apps/twofactor_totp/ owncloud/apps/ chmod o+rx owncloud/apps/activity/ chmod o+rx owncloud/apps/files_pdfviewer/ chmod o+rx owncloud/apps/files_texteditor/ chmod o+rx owncloud/apps/files_mediaviewer/ chmod o+rx owncloud/apps/templateeditor/ chmod o+rx owncloud/apps/twofactor_totp/ ///// do enable core apps activity, files_pdfviewer, files_texteditor and mediaviewer sudo -u www-data php7.4 owncloud/occ app:enable activity sudo -u www-data php7.4 owncloud/occ app:enable files_pdfviewer sudo -u www-data php7.4 owncloud/occ app:enable files_texteditor sudo -u www-data php7.4 owncloud/occ app:enable files_mediaviewer sudo -u www-data php7.4 owncloud/occ app:enable templateeditor sudo -u www-data php7.4 owncloud/occ app:enable twofactor_totp ///// Then, do sudo -u www-data php7.4 owncloud/occ maintenance:mode --off ///// HTTP APIs have been added with Server 10.3 -WebDAV Trash bin API. -OCS API for public link share email notifications -WebDAV endpoint for public links. explicitly enable them using the new config.php option: 'dav.enable.tech_preview' ⇒ true,. ///// Testing via web interface, login as admin https://servername.domain ///// If do disable core apps, review settings > apps > show disabled apps ///// Finalize With maintenance mode disabled, login and: Check that the version number reflects the new installation. It’s visible at the bottom of your Admin page. [OK] Check that your other settings are correct. [OK] Go to the Apps page and review the core apps to make sure the right ones are enabled. [OK apps activity, files_pdfviewer, files_texteditor and mediaviewer] Re-enable your third-party apps if neccessary. [OK none] ///// If use cron, then start cron. (ownCloud 10.3+ use system:cron) vi /etc/cron.d/owncloud-cron-dot-php */15 * * * * www-data php7.4 -f /var/www/html/owncloud/occ system:cron ///// Clean unwanted directories and files rm -rf owncloud10.9.0 rm -rf mytmp ///// Setting strong directory permissions ///// make a directory to keep files cd mkdir -p manage_owncloud cd manage_owncloud/ ///// create a bash file named setting-strong-directory-permissions.sh ------------------------ Start script -------------- #!/bin/bash ocpath='/var/www/html/owncloud' ocdata='/var/www/html/owncloud/data' htuser='www-data' htgroup='www-data' rootuser='root' printf "Creating possible missing Directories\n" mkdir -p $ocpath/updater printf "chmod Files and Directories\n" find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640 find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750 find ${ocdata}/ -type f -print0 | xargs -0 chmod 0640 find ${ocdata}/ -type d -print0 | xargs -0 chmod 0750 printf "chown Directories\n" chown -R ${rootuser}:${htgroup} ${ocpath}/ chown -R ${htuser}:${htgroup} ${ocpath}/apps/ chown -R ${htuser}:${htgroup} ${ocpath}/config/ chown -R ${htuser}:${htgroup} ${ocdata}/ chown -R ${htuser}:${htgroup} ${ocpath}/updater/ chmod +x ${ocpath}/occ printf "chmod/chown .htaccess\n" if [ -f ${ocpath}/.htaccess ] then chmod 0644 ${ocpath}/.htaccess chown ${rootuser}:${htgroup} ${ocpath}/.htaccess fi if [ -f ${ocdata}/.htaccess ] then chmod 0644 ${ocdata}/.htaccess chown ${rootuser}:${htgroup} ${ocdata}/.htaccess fi ------------------------ End script -------------- //// Run bash script bash setting-strong-directory-permissions.sh //// output... Creating possible missing Directories chmod Files and Directories chown Directories chmod/chown .htaccess #