What is the recommended installation method?

Hi,

I was wondering what the recommended installation method is/will be.
Previously the tar/zip method wasn’t great at providing upgrades.
Will there be packages for distros or will the self upgrade be better
supported and automated? Or is some completely different system
preferred?

Looking forward to install Nextcloud!

I have the same question as you. I have now ownCloud installation with special package setting for retrieving the last updates, see https://download.owncloud.org/download/repositories/stable/owncloud/
Thats works great for me.

Hi,

I was too with owncloud repos and “*.deb” packages and i migrated to Nextcloud manually ( tar/zip) without any problems. It’s the preferred method. Anyway, there’s no deb repos actually, and it’s very well like that… :relaxed:

Packaging distros has always been a mess with owncloud.

P.S. Follow the docs, and don’t forget to adjust your directories permissions

1 Like

What is the problem with the zip? I have a small bash which works since OC6

  • wget zip
  • backup config.php & DB & theme folder
  • rm old OC folder
  • unzip OC
  • copy config.php & theme back
  • run OCC command

Thats it.
Never any issue

1 Like

The easiest way on Linux, if you’re not interested in tuning your config too much is described here:

1 Like

We also used the https://download.owncloud.org/download/repositories/stable/owncloud/ i cannot find the correct paths for Nextcloud yet? i prefer this way cause we can update our own/nextCloud systems trough YUM…

downloading a zip, unpacking and making the correct rights on folders is fun when you have 1 server, but we have over 10+ owncloud installations, YUM is the way to go.

Can you post your script here? I am curious…

could you give me that script?

I can post this evening

thanks! i will make a dev of our live server to test :slight_smile:

Or do it like round cube. They have a little script in their archive that you can run:
installto.sh /path/to/nextcloud

wwpath=’/var/www’
ocpath=’/var/www/owncloud’
ocdata=’/var/owncloud’
htuser=‘www-data’

echo “start OC update”

cd ${ocpath}
sudo -u www-data php occ -V
read -p "Welche Zielversion? z.B. 8.0.7: " DLVERSION
sudo -u www-data php occ maintenance:mode --on
sudo -u www-data php occ app:disable contacts
sudo -u www-data php occ app:disable calendar

cd ${wwpath}
sudo rm -rf ${wwpath}/owncloud-backup
sudo mkdir ${wwpath}/owncloud-backup
sudo chmod 777 ${wwpath}/owncloud-backup/
sudo cp ${ocpath}/config/config.php ${wwpath}/owncloud-backup/
sudo cp -R ${ocpath}/themes/ ${wwpath}/owncloud-backup/
echo “files copied”

sudo mysqldump --opt --user=root --password=root --databases owncloud | gzip -c -9 > ${wwpath}/owncloud-backup/owncloud_DB.gz
echo “DB copied”

wget -O ${wwpath}/owncloud-latest.tar.bz2 http://download.owncloud.org/community/owncloud-${DLVERSION}.tar.bz2
sudo rm -rf ${wwpath}/owncloud

cd ${wwpath}
tar -xjvf owncloud-latest.tar.bz2
sudo cp ${wwpath}/owncloud-backup/config.php ${ocpath}/config/
sudo cp -R ${wwpath}/owncloud-backup/themes/ ${ocpath}/
sudo rm ${wwpath}/owncloud-latest.tar.bz2

sudo find ${ocpath}/ -type f -print0 | xargs -0 chmod 0640
sudo find ${ocpath}/ -type d -print0 | xargs -0 chmod 0750
sudo chown -R root:${htuser} ${ocpath}/
sudo chown -R ${htuser}:${htuser} ${ocpath}/apps/
sudo chown -R ${htuser}:${htuser} ${ocpath}/config/

find ${ocdata}/ -type f -print0 | xargs -0 chmod 0640
find ${ocdata}/ -type d -print0 | xargs -0 chmod 0750
sudo chown -R ${htuser}:${htuser} ${ocdata}/

cd ${ocpath}
sudo -u www-data php occ upgrade
sudo -u www-data php occ maintenance:mode --off
sudo -u www-data php occ -V

2 Likes

store this in an OC_update.sh and you can use it every time

Thanks for your script! I have manually installed nextcloud on ubuntu 16.04 and having to upgrade manually each time is a bit of a hassle.
I have modified the script to suit my environment (Ubuntu 16.04, NGINX, MySQL/MariaDB, PHP7)
Tested and working! :slight_smile:

#!/bin/bash
#Nextcoud upgrade script
set -e #stop on error
wwpath='/var/www'
ncpath='/var/www/nextcloud'
ncdata='/var/www/nextcloud/data'
datain=true #set false if you keep your data outside nextcloud
htuser='www-data'
htgroup='www-data'
rootuser='root'
echo "start NC update"
cd ${ncpath}
sudo -u www-data php occ -V
read -p "Which version to download? i.e. 10.0.2: " DLVERSION
#try download first before changing anything
echo "Downloading nextcloud ${DLVERSION}"
wget -O /tmp/nextcloud-latest.tar.bz2 https://download.nextcloud.com/server/releases/nextcloud-${DLVERSION}.tar.bz2
#Prepare nextcloud for maintenance
sudo -u www-data php occ maintenance:mode --on
sudo -u www-data php occ app:disable contacts
sudo -u www-data php occ app:disable calendar
#stop NGINX
sudo systemctl stop nginx
cd ${wwpath}
sudo mv ${ncpath} ${wwpath}/nextcloud-old
sudo chmod 777 ${wwpath}/nextcloud-old/
echo "files copied"
set +e #mkdir could throw an error if the directory already exists
sudo mkdir ${wwpath}/nextcloudDB-backup
set -e
sudo chmod 777 ${wwpath}/nextcloudDB-backup/
sudo mysqldump --lock-tables --opt --user=nextcloud --password='mypassword' --databases nextcloud | gzip -c -9 > ${wwpath}/nextcloudDB-backup/nextcloudDB.gz
echo "DB copied"
#Extract previously downloaded owncloud
echo "Extracting nextcloud ${DLVERSION}"
tar -xjvf /tmp/nextcloud-latest.tar.bz2
#Replace original config
set +e
sudo rm ${ncpath}/config/config.php
sudo rm -rf ${ncpath}/themes
sudo rm -rf ${ncpath}/data
set -e
sudo mv ${wwpath}/nextcloud-old/config/config.php ${ncpath}/config/
sudo mv ${wwpath}/nextcloud-old/themes/ ${ncpath}/
if [ "$datain" = true ] 
	then
	sudo mv ${wwpath}/nextcloud-old/data/ ${ncpath}/
fi
#Set permissions
#Script from this page
#https://docs.nextcloud.com/server/9/admin_manual/installation/installation_wizard.html
printf "Creating possible missing Directories\n"
sudo mkdir -p $ncpath/data
sudo mkdir -p $ncpath/assets
sudo mkdir -p $ncpath/updater
 
printf "chmod Files and Directories\n"
sudo find ${ncpath}/ -type f -print0 | xargs -0 chmod 0640
sudo find ${ncpath}/ -type d -print0 | xargs -0 chmod 0750
 
printf "chown Directories\n"
sudo chown -R ${rootuser}:${htgroup} ${ncpath}/
sudo chown -R ${htuser}:${htgroup} ${ncpath}/apps/
sudo chown -R ${htuser}:${htgroup} ${ncpath}/assets/
sudo chown -R ${htuser}:${htgroup} ${ncpath}/config/
sudo chown -R ${htuser}:${htgroup} ${ncpath}/themes/
sudo chown -R ${htuser}:${htgroup} ${ncpath}/updater/
sudo find ${ncdata}/ -type f -print0 | xargs -0 chmod 0640
sudo find ${ncdata}/ -type d -print0 | xargs -0 chmod 0750
sudo chown -R ${htuser}:${htgroup} ${ncdata}/
 
chmod +x ${ncpath}/occ
 
printf "chmod/chown .htaccess\n"
if [ -f ${ncpath}/.htaccess ]
 then
  chmod 0644 ${ncpath}/.htaccess
  chown ${rootuser}:${htgroup} ${ncpath}/.htaccess
fi
if [ -f ${ncdata}/.htaccess ]
 then
  chmod 0644 ${ncdata}/.htaccess
  chown ${rootuser}:${htgroup} ${ncdata}/.htaccess
fi
#Start Nginx
sudo systemctl start nginx
#Run upgrade
echo 'occ upgrade in progress...'
cd ${ncpath}
sudo -u www-data php occ upgrade
sudo -u www-data php occ maintenance:mode --off
sudo -u www-data php occ -V
#Cleanup
echo 'cleaning up...'
cd ${wwpath}
sudo rm -rf ${wwpath}/nextcloudDB-backup
sudo rm /tmp/nextcloud-latest.tar.bz2
sudo rm -rf ${wwpath}/nextcloud-old
echo 'NC Upgrade completed successfully!'

As of 10.0.1 the auto-updater script is included, just so everyone’s aware :smiley:

1 Like

Adding it to the docs would be great!
somewhere in this page How to Upgrade Your Nextcloud Server
Thanks

Here is the document:

You can clone this repo, make changes to this page and then create a pull request :slight_smile: Or at least open an issue https://github.com/nextcloud/documentation/issues and make some suggestions what and how to change it.

1 Like