Manually upgrade owncloud from 10.0.5 to 10.0.7

จาก Wiki Opensource

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

Manually upgrade owncloud from 10.0.5 to 10.0.7

Start upgrade,
sudo su

# 10.0.7 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

#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.7.tar.bz2
tar xjf owncloud-10.0.7.tar.bz2 
service apache2 stop
cd ..
mv owncloud owncloud1005
mv mytmp/owncloud .
cp owncloud1005/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-03-09T02:46:35+00:00 Update successful
2018-03-09T02:46:35+00:00 Maintenance mode is kept active
2018-03-09T02:46:35+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 owncloud1005
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
Creating possible missing Directories
chmod Files and Directories
chown Directories
chmod/chown .htaccess
#