Nextcloud is a free/libre self-hosted cloud software that runs on a LEMP Stack. A lot like how Matrix is a self-hosted, much more private version of Discord, Nextcloud is a self-hosted alternative to services such as Google Drive and MEGA.
Initial Server Setup
This section covers the basic installation and setup of a Nextcloud server; It is highly recommended to also follow the further configuration section to get a feature-full Nextcloud experience.
Prerequisites
-
Debian 10 or newer
-
LEMP Stack Setup
-
Ports 80 and 443 port-forwarded on your router/modem if you wish to use Nextcloud outside of your local network
-
Your own domain with an A DNS entry set to the public IPv4 address of your server
-
Basic UNIX knowledge
Install dependencies:
sudo apt install unzip php-fpm php-bz2 php-cgi php-cli php-common php-curl php-fpm php-gd php-curl php-gd php-json php-xml php-mbstring php-zip php-xml php-gd php-imagick php-intl php-bcmath php-gmp php-apcu libmagickcore-6.q16-6-extra
Download the latest Nextcloud
wget https://download.nextcloud.com/server/releases/latest.zip
It is recommended to download the file to /var/www
so it can be unzipped to the default location, /var/www/nextcloud
.
Unzip the file:
unzip latest.zip
First setup
Before configuring Nextcloud, it is important to ensure the nextcloud directory is fully read-writable by the user executing php-fpm
. In this case, this would be www-data
.
sudo chown -Rv www-data:www-data /var/www/nextcloud
Skipping this step is normally what causes people to get errors on initial setup.