Short and clear: which type of Nextcloud installation should I choose - LXC, VM or Docker?

Nextcloud is a popular solution for creating your own cloud data storage. In this article, we will look at various ways to install Nextcloud, their pros and cons. To begin with, there are several ways to install Nextcloud: directly on the server, in a virtual machine, in Docker manually or in Docker via the automatic AIO stack. You can also install Nextcloud in an LXC container.

Docker

Manual installation in Docker is the most common option that requires the administrator to have basic knowledge of working with containers. Allows you to work with persistent configuration files by dropping them into a container. The main advantage of installing Nextcloud in a Docker container is the ease of installation and management (link to the official repository, there is also a Docker Compose file there: https://github.com/nextcloud/docker). You don't need to install a large number of packages manually, as is the case with LXC containers.

However, this method has its drawbacks: the complexity of setting up a reverse proxy, the complexity of limiting resources per container, removing logs and not a convenient update process, which can be difficult for untrained users. In addition, installing and replacing basic packages, such as PHP or PHP-FPM, separately from the entire container is a difficult task even for an experienced administrator. However, this option may be less productive than LXC due to additional virtualization layers.

Installation in a Docker AIO container is the manufacturer's recommended method

The AIO stack has this name, because during the installation process, one (main) container is created in Docker, which has access to the Docker daemon itself via a socket and independently creates and installs other containers for the operation of the software stack. This is the easiest way to install: all parameters are set via the YAML Docker-compose file (download link: https://github.com/nextcloud/all-in-one/blob/main/compose.yaml), and minimal integration efforts are required from the administrator.

At the same time, from the point of view of security and configuration, this is the most unfortunate option, because firstly, you give access to the Docker itself to a third–party application, and secondly, what is not set in the ENV parameters, you can not fix. Well, or at least, your labors in this regard will be reset after the next update of the platform.

Installation on bare hardware in the Ubuntu operating system

In the case of using weak computers, such as Raspberry Pi, installing Nextcloud based on the operating system may be the most appropriate option, since it allows you to use all the free space on the server disks to store files and does not require virtualization support.

This method of installing Nextcloud does not give obvious advantages, except for access to all free space on the server disks for storing files. To install Nextcloud on the operating system from the official website, you can download the script and run it on the command line.

Installation in an LXC container

Installing in an LXC container is the most unnecessarily difficult option, since container images are delivered in a stripped-down form and you will have to install many packages manually, including language support. The only more or less working LXC image I could find on the Turnkey Linux website (https://www.turnkeylinux.org/nextcloud), but there were difficulties with it during installation. So if you are not a fan of LXC, then it is better to pass by this solution.

Virtual machine

In a virtual machine, you can very precisely configure all the packages that Nextcloud uses, such as PHP, Redis and PHP-FPM, by choosing their versions. This allows you to achieve the best performance and resource optimization. You can download as a ready-made virtual machine image for VMware, Hyper-V and Proxmox at the link https://www.hanssonit.se/nextcloud-vm, and use the installation .sh script for Ubuntu 22.04, available here: https://github.com/nextcloud/vm.

  • Configuration Management: You can manage all configuration files in one window, which simplifies the process of configuring and updating Nextcloud.
  • Backup and recovery: Virtual machines are easier to backup and restore, which allows you to quickly repair the system in case of a failure or an unsuccessful update.
  • Snapshots: With the help of snapshots, you can easily roll back the configuration if the update has led to problems.
  • Data protection: The virtual machine disk can be easily encrypted, which provides additional protection for your data.
The disadvantage of using a virtual machine is the complexity of working with large amounts of data: you either need to throw a disk with the volume of your file storage into the VM, which is difficult for tens of terabytes, or connect the volume directly from the hypervisor via SMB/NFS storage, which is not always possible. The use of external storage by means of Nextcloud itself, although possible, has limited functionality. For example, you cannot share a link over the Internet to a file connected by the External Storage module in Nextcloud itself. However, taking into account all other advantages, this can be adequately compensated.

Finally

Since the Nextcloud stack is designed to work over the Internet, it is mandatory to set up an HTTPs connection with automatic certificate renewal, delete or rename the account ncadmin/admin and configure other types of locks, for example by GeoIP, IP address range, etc.

Ron Amadeo
27/09.2023


Read also:

Setting up a free micro-cloud using the Terramaster F2-423

The free and open source software market has made a tremendous leap forward in recent years, so today thousands of companies are using FOSS instead of public clouds. You don't have to buy a huge server to run your micro-cloud, y...

5 free services for your docker server

In this article, we will look at 5 software services that you can install through Docker to facilitate the maintenance of your servers. This software stack is a Must Have for a small infrastructure using Docker (Swarm).