Installing Nextcloud with Nextcloud-Snap

written by ushills on 2019-03-10

Following on from my previous post, this time when I upgraded my hardware, to run Nextcloud I installed Nextcloud-snap which is Nextcloud packaged as a snap.

For those who have not come across snaps and the snappy package manager before Snaps have a number of advantages.

Although introduced by Canonical (the organisation behind Ubuntu), they generally work across the majority of Linux Distributions and are OS agnostic, i.e. the snap does not have to be compiled for different OS's and as long as you can install the Snappy Package Manager you can install almost any snap.

The other significant advantage, particularly, with a Nextcloud instance is that that the snap not only installs Nextcloud but installs all the required dependencies in a single sandboxed environment that just works out of the box. Also, snaps automatically upgrade and upgrades are checked daily, therefore, the nextcloud instance will always be updated to the latest stable version.

Installation, once you have the Snappy Package Manager installed, is as simple as:

sudo snap install nextcloud

The stable Nextcloud-snap currently installs:

Install Snap

Then install snap, using the guide here for your installation, for Debian and other APT based distributions this is.

$ sudo apt update
$ sudo apt install snapd

Install Nextcloud-snap

Finally, once you have snap the command to install Nextcloud-snap is universal with.

$ sudo snap install nextcloud

Follow the configuration guide, although not a great deal of configuration is required and it will work out of the box, the essential settings I change are:

sudo snap run nextcloud.occ enable-https lets-encrypt
sudo snap set nextcloud php.memory-limit=1512M

The above enables HTTPS and provisions a Lets-Encrypt certificate for your Nextcloud webserver and increases the memory available from the default 512Mb to 1.5Gb of the 2GB available on the Odroid HC1.

Snap advantages

advantage, and one I only recently realised, is that all of the snap configuration and data is contained in one folder, my my case /var/snap/nextcloud, which means that you can back up the folder in its entirety and restore it by copying it to a /var/snap folder on another machine with Nexcloud-snap installed or restore a backup in place without having MySQL database issues or other issues with interdependancies.

This self-contained approach with snaps has a major implication with backing up and restoring, especially when considered in the context of running your OS using the BTRFS filesystem, which is the subject of my next post.