Manually upgrade owncloud from 10.0.7 to 10.0.9

จาก Wiki Opensource

ปรับปรุงครั้งล่าสุดวันที่ 24-7-2561
เขียนโดย วิบูลย์

Manually upgrade owncloud from 10.0.7 to 10.0.9

Start upgrade,
sudo su

# 10.0.8 no new modules required
#

/////If use cron.php, then stop cron.
vi /etc/cron.d/owncloud-cron-dot-php
#*/15  *  *  *  * www-data php -f /var/www/html/owncloud/cron.php

backup first,
# This example assumes Ubuntu Linux and MariaDB
mkdir -p /root/backupowncloud/
cp -rv /var/www/owncloud /root/backupowncloud/owncloud-1007
mysqldump -u root -p <db_name> > /root/backupowncloud/backup-file-1007.sql

#Working directory
cd /var/www/html

/////Start upgrade
sudo -u www-data php owncloud/occ maintenance:mode --on

mkdir mytmp
cd mytmp
wget https://download.owncloud.org/community/owncloud-10.0.8.tar.bz2
tar xjf owncloud-10.0.8.tar.bz2 
service apache2 stop
cd ..
mv owncloud owncloud1007
mv mytmp/owncloud .
cp owncloud1007/config/config.php owncloud/config/
cd owncloud
REM Because our owncloud data is soft link to /srv/data so I need to make a soft link
ln -s /srv/data/ data
REM
service apache2 start
cd ..
chown -R www-data:www-data owncloud
sudo -u www-data php owncloud/occ upgrade

/////Finish upgrade
2018-07-24T03:08:45+00:00 Finished code integrity check
2018-07-24T03:08:45+00:00 Update successful
2018-07-24T03:08:45+00:00 Maintenance mode is kept active
2018-07-24T03:08:45+00:00 Reset log level

then, do
sudo -u www-data php owncloud/occ maintenance:mode --off

/////Testing via web interfaces
https://servername.domain

/////Clean unwanted directories and files
rm -rf owncloud1007
rm -rf mytmp


Next upgrade 10.0.8 to 10.0.9

# 10.0.9 no new modules required
#

backup first,
# This example assumes Ubuntu Linux and MariaDB
mkdir -p /root/backupowncloud/
cp -rv /var/www/owncloud /root/backupowncloud/owncloud-1008
mysqldump -u root -p <db_name> > /root/backupowncloud/backup-file-1008.sql

#Working directory
cd /var/www/html

/////Start upgrade
sudo -u www-data php owncloud/occ maintenance:mode --on

mkdir mytmp
cd mytmp
wget https://download.owncloud.org/community/owncloud-10.0.9.tar.bz2
tar xjf owncloud-10.0.9.tar.bz2 
service apache2 stop
cd ..
mv owncloud owncloud1008
mv mytmp/owncloud .
cp owncloud1008/config/config.php owncloud/config/
cd owncloud
REM Because our owncloud data is soft link to /srv/data so I need to make a soft link
ln -s /srv/data/ data
REM
service apache2 start
cd ..
chown -R www-data:www-data owncloud
sudo -u www-data php owncloud/occ upgrade

/////Finish upgrade
2018-07-24T03:28:45+00:00 Finished code integrity check
2018-07-24T03:28:45+00:00 Update successful
2018-07-24T03:28:45+00:00 Maintenance mode is kept active
2018-07-24T03:28:45+00:00 Reset log level

then, do
sudo -u www-data php owncloud/occ maintenance:mode --off

/////Testing via web interfaces
https://servername.domain

/////Clean unwanted directories and files
rm -rf owncloud1008
rm -rf mytmp


/////If use cron.php, then start cron.
vi /etc/cron.d/owncloud-cron-dot-php
*/15  *  *  *  * www-data php -f /var/www/html/owncloud/cron.php

[Setting strong directory permissions]
# cd
# mkdir manage_owncloud
# cd manage_owncloud/
# cat setting-strong-directory-permissions.sh
#!/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 $ocdata
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}/themes/
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

# bash setting-strong-directory-permissions.sh
output...
Creating possible missing Directories
chmod Files and Directories
chown Directories
chmod/chown .htaccess
#