# What is the recommended installation method?

**URL:** <https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585>\
**Category:** ℹ️ Support\
**Created:** [June 14, 2016, 7:47pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585 "2016-06-14T19:47:16Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![pan](https://help.nextcloud.com/letter_avatar/pan/32/5_5575768a8748004e209b776fc1b2916d.png) [@pan](https://help.nextcloud.com/u/pan)\
**Post date:** [June 14, 2016, 7:47pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/1 "2016-06-14T19:47:16Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![kevinvs](https://help.nextcloud.com/letter_avatar/kevinvs/32/5_5575768a8748004e209b776fc1b2916d.png) [@kevinvs](https://help.nextcloud.com/u/kevinvs)\
**Post date:** [June 14, 2016, 8:02pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/2 "2016-06-14T20:02:04Z")

</div>

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/](https://download.owncloud.org/download/repositories/stable/owncloud/)  
Thats works great for me.

---

<div class="post-metadata">

**Author:** ![Akhenaton](https://help.nextcloud.com/user_avatar/help.nextcloud.com/akhenaton/32/158_2.png) [@Akhenaton](https://help.nextcloud.com/u/Akhenaton)\
**Post date:** [June 14, 2016, 8:13pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/3 "2016-06-14T20:13:23Z")

</div>

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… 😌

Packaging distros has always been a mess with owncloud.

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

---

<div class="post-metadata">

**Author:** ![Rello](https://help.nextcloud.com/user_avatar/help.nextcloud.com/rello/32/166_2.png) [@Rello](https://help.nextcloud.com/u/Rello)\
**Post date:** [June 14, 2016, 9:20pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/4 "2016-06-14T21:20:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![oparoz](https://help.nextcloud.com/user_avatar/help.nextcloud.com/oparoz/32/135_2.png) [@oparoz](https://help.nextcloud.com/u/oparoz)\
**Post date:** [June 15, 2016, 12:25am UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/5 "2016-06-15T00:25:34Z")

</div>

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

> [@How to install an always up to date version of Nextcloud on Linux](https://help.nextcloud.com/t/how-to-install-an-always-up-to-date-version-of-nextcloud-on-linux/596/1):
>
> What you get An [officially](https://github.com/nextcloud/nextcloud-snap) supported installation of Nextcloud delivered via a Snap, a clever technology allowing users to always have the latest version of an “app”. It works on a large range of hardware, from powerful enterprise POWER8 servers down to the Raspberry Pi 2. The current version is considered beta and is quite restrictive. It is not yet aimed at developers or advanced users who would want to tune their configuration by installing extra features. It is aimed at end-users who want a…

---

<div class="post-metadata">

**Author:** ![directict](https://help.nextcloud.com/letter_avatar/directict/32/5_5575768a8748004e209b776fc1b2916d.png) [@directict](https://help.nextcloud.com/u/directict)\
**Post date:** [June 15, 2016, 11:59am UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/6 "2016-06-15T11:59:47Z")

</div>

We also used the [https://download.owncloud.org/download/repositories/stable/owncloud/](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.

---

<div class="post-metadata">

**Author:** ![MegaV0lt](https://help.nextcloud.com/user_avatar/help.nextcloud.com/megav0lt/32/296_2.png) [@MegaV0lt](https://help.nextcloud.com/u/MegaV0lt)\
**Post date:** [June 15, 2016, 12:56pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/7 "2016-06-15T12:56:55Z")

</div>

Can you post your script here? I am curious…

---

<div class="post-metadata">

**Author:** ![directict](https://help.nextcloud.com/letter_avatar/directict/32/5_5575768a8748004e209b776fc1b2916d.png) [@directict](https://help.nextcloud.com/u/directict)\
**Post date:** [June 16, 2016, 7:11am UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/8 "2016-06-16T07:11:05Z")

</div>

could you give me that script?

---

<div class="post-metadata">

**Author:** ![Rello](https://help.nextcloud.com/user_avatar/help.nextcloud.com/rello/32/166_2.png) [@Rello](https://help.nextcloud.com/u/Rello)\
**Post date:** [June 16, 2016, 7:18am UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/9 "2016-06-16T07:18:15Z")

</div>

I can post this evening

---

<div class="post-metadata">

**Author:** ![directict](https://help.nextcloud.com/letter_avatar/directict/32/5_5575768a8748004e209b776fc1b2916d.png) [@directict](https://help.nextcloud.com/u/directict)\
**Post date:** [June 16, 2016, 7:31am UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/10 "2016-06-16T07:31:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/5_5575768a8748004e209b776fc1b2916d.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [June 16, 2016, 8:59am UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/11 "2016-06-16T08:59:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rello](https://help.nextcloud.com/user_avatar/help.nextcloud.com/rello/32/166_2.png) [@Rello](https://help.nextcloud.com/u/Rello)\
**Post date:** [June 16, 2016, 11:37am UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/12 "2016-06-16T11:37:40Z")

</div>

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](http://download.owncloud.org/community/owncloud-%24%7BDLVERSION%7D.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

---

<div class="post-metadata">

**Author:** ![Rello](https://help.nextcloud.com/user_avatar/help.nextcloud.com/rello/32/166_2.png) [@Rello](https://help.nextcloud.com/u/Rello)\
**Post date:** [June 16, 2016, 11:38am UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/13 "2016-06-16T11:38:07Z")

</div>

store this in an OC\_update.sh and you can use it every time

---

<div class="post-metadata">

**Author:** ![rbcouture](https://help.nextcloud.com/letter_avatar/rbcouture/32/5_5575768a8748004e209b776fc1b2916d.png) [@rbcouture](https://help.nextcloud.com/u/rbcouture)\
**Post date:** [October 11, 2016, 2:20pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/14 "2016-10-11T14:20:35Z")

</div>

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! 🙂

> ```
> #!/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!'
> 
> ```

---

<div class="post-metadata">

**Author:** ![JasonBayton](https://help.nextcloud.com/user_avatar/help.nextcloud.com/jasonbayton/32/297_2.png) [@JasonBayton](https://help.nextcloud.com/u/JasonBayton)\
**Post date:** [October 14, 2016, 9:09pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/15 "2016-10-14T21:09:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rbcouture](https://help.nextcloud.com/letter_avatar/rbcouture/32/5_5575768a8748004e209b776fc1b2916d.png) [@rbcouture](https://help.nextcloud.com/u/rbcouture)\
**Post date:** [October 17, 2016, 2:42pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/16 "2016-10-17T14:42:36Z")

</div>

Adding it to the docs would be great!  
somewhere in this page [How to Upgrade Your Nextcloud Server](https://docs.nextcloud.com/server/9/admin_manual/maintenance/upgrade.html)  
Thanks

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/5_5575768a8748004e209b776fc1b2916d.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [October 18, 2016, 11:04am UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/17 "2016-10-18T11:04:40Z")

</div>

Here is the document:

> <https://github.com/nextcloud/documentation/blob/master/admin_manual/maintenance/upgrade.rst>

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

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [September 23, 2024, 6:24pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/18 "2024-09-23T18:24:53Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 3:20pm UTC](https://help.nextcloud.com/t/what-is-the-recommended-installation-method/585/19 "2024-12-04T15:20:44Z")

</div>


