Nextcloud is a quality opensource alternative for commercial and “free” file-sharing and cloud platforms. It is originally based on ownCloud (initially released in 2010) and was forked to Nextcloud by the original developer Frank Karlitschek. The software is developed with security in mind, and the basic idea is to keep all the data under the users’ own control. Nextcloud is developed and managed by Nextcloud GmbH and the opensource community. The company also offers Software as a Service hosting for commercial customers.
My use cases
I personally prefer local storages and servers over commercial or “free” systems like Google Photos, Dropbox etc. Previously, I had multiple PHP galleries and simple web directories (with digest password authentication), but they are complex to maintain in the long run, and complex to use if users need to handle a ton of user accounts. Especially when used with smart devices, the user needs to have a specific URL and copy / paste the credentials (or use weak passwords, which are easy to remember and type).
I use Nextcloud primarily to share photos and other files with my family and relatives.
Nextcloud can be built to be a fully collaborative software for enterprises, but basically it offers a number of useful features, including:
- File server / sharing
- Web UI features, like:
- File manager
- Internal document viewer
- Internal text editor
- Photo gallery
- WebDAV (which integrates with file managers in Linux, Windows and OS X)
- Calendar with CalDAV (which integrates with e.g. Mozilla Thunderbird)
- Contacts with CardDAV
- Small utilities, like:
- Weather forecast
- Maps viewer
- RSS feed reader
- Hundreds of extensions
Nextcloud has built-in security features that can be enabled after installation.
- Two-Factor Authentication
- Server side file encryption
- Password policies to enforce use of strong passwords
- IP whitelists for restricting access only from certain networks or IP addresses
My server environment
I have a small and low-cost VPS instance for Nextcloud with LAMP installed. I use Debian 10 (stable version while writing this), Apache web server, MariaDB database and PHP 7.3. SSL is enabled using free Let’s Encrypt certificate, installed with CertBot software, which is provided with the Debian package.
The installation procedure was easy and straightforward.
- Register domain (if not already done) and create an appropriate DNS configuration. In my case, I used a subdomain for Nextcloud.
- Create and enable VirtualHost in the webserver configuration.
- Install Let’s Encrypt certificate for the domain. In most cases, CertBot can do this automatically for previously created VirtualHost by just executing:
sudo certbot --apache -d nextcloud.example.com
- Download and extract the latest version of NextCloud:
/var/www$ wget https://download.nextcloud.com/server/releases/nextcloud-20.0.1.tar.bz2
/var/www$ tar xf nextcloud-20.0.1.tar.bz2
/var/www$ chown -R www-data:www-data nextcloud/
- Create MySQL / MariaDB database and appropriate user (remember to create it with GRANT options, otherwise the install will fail, throwing up an error message for incorrect database credentials).
- Finish installation in web browser
Connecting to fileshares
File shares can be used with web browsers, but also with mobile apps and DAV integrations. When using WebDAV, no DAV modules are needed as Nextcloud has integrated SabreDAV software.
The file manager in a browser is very familiar and easy to use:
File sharing in Android works like within every Android app these days: Just tap ‘Share’ and choose Nextcloud and the folder into which you want to upload the file.
WebDAV works out-of-the-box within Linux file managers, like Dolphin (default in KDE desktop), Caja (MATE desktop) and Nautilus (Gnome). WebDAV works also without external software or plug-ins in Windows and OS X.
Of course, the more native way in Linux is to mount DAV share to the filesystem mount point. This can be done with davfs2 file system driver, which is easy to install from Debian / Ubuntu repositories.
- Install the driver first from the repository and add your user into davfs2 group:
sudo apt install davfs2
usermod -aG davfs2 simo
- Create mount point, eg. /mnt/webdav
- Create a secrets file using package template:
sudo cp /etc/davfs2/secrets ~/.davfs2/secrets
sudo chown simo:simo ~/.davfs2/secrets
- Ensure that the secret file has the correct 600 (rw——-) permissions
- Add your credentials to the secret file:
https://[SERVER]/share.php/remote.php/dav/files/[USER] [USER] [PASS]
- Add the mount information to /etc/fstab:
https://[SERVER]/remote.php/dav/files/[USER]/ [MOUNT POINT] davfs user,rw,noauto 0 0
- Mount the share:
I found Nextcloud very useful for my purposes. Here’s a short list of pros and cons from my point of view:
- Data is always in own control
- Easy to install
- Easy to roll out to users’ smart phones etc.
- Easy to use file shares directly from Linux desktop
- Scalable. As it is self-hosted, there are no contract-based limits, just own-resource limits (disk space, bandwidth, transfer limits)
- Consumes a lot of disk space with basic install (approximately 560MB before adding data)
- Self-hosted services need maintenance, upgrades, monitoring, etc.