Download the Nextcloud snap package and install it
sudo snap install nextcloud
The snap info
command can show you the description, the Nextcloud management commands available, as well as the installed version and the snap channel being tracked:
snap info nextcloud
To see what snap connections this snap defines, type:
snap connections nextcloud
To learn about all of the specific services and apps that this snap provides, you can take a look at the snap definition file by typing:
cat /snap/nextcloud/current/meta/snap.yaml
To configure Nextcloud with a new administrator account, use the nextcloud.manual-install command. You must pass in a username and a password as arguments:
sudo nextcloud.manual-install username password
You can view the current settings by querying the value of the trusted_domains array:
sudo nextcloud.occ config:system:get trusted_domains
We can add an entry for our server’s domain name or IP address by typing:
sudo nextcloud.occ config:system:set trusted_domains 1 --value=example.com
If you have a domain name associated with your Nextcloud server, the Nextcloud snap can help you obtain and configure a trusted SSL certificate from Let’s Encrypt. If your Nextcloud server does not have a domain name, Nextcloud can configure a self-signed certificate which will encrypt your web traffic but won’t be automatically trusted by your web browser.
Start by opening the ports in the firewall that Let’s Encrypt uses to validate domain ownership.
sudo ufw allow 80,443/tcp
Next, request a Let’s Encrypt certificate by typing:
sudo nextcloud.enable-https lets-encrypt
You will first be asked whether your server meets the conditions necessary to request a certificate from the Let’s Encrypt service:
In order for Let's Encrypt to verify that you actually own the
domain(s) for which you're requesting a certificate, there are a
number of requirements of which you need to be aware:
1. In order to register with the Let's Encrypt ACME server, you must
agree to the currently-in-effect Subscriber Agreement located
here:
https://letsencrypt.org/repository/
By continuing to use this tool you agree to these terms. Please
cancel now if otherwise.
2. You must have the domain name(s) for which you want certificates
pointing at the external IP address of this machine.
3. Both ports 80 and 443 on the external IP address of this machine
must point to this machine (e.g. port forwarding might need to be
setup on your router).
Have you met these requirements? (y/n)
Type y
to continue.
Next, you will be asked to provide an email address to use for recovery operations:
Please enter an email address (for urgent notices or key recovery):
Enter your email and press Enter
to continue.
Finally, enter the domain name associated with your Nextcloud server:
Please enter your domain name(s) (space-separated): example.com
To generate a self-signed certificate and configure Nextcloud to use it, type:
sudo nextcloud.enable-https self-signed
Now that the interface is secure, open the web ports in the firewall to allow access to the web interface:
sudo ufw allow 80,443/tcp
Now that Nextcloud is configured, visit your server’s domain name or IP address in your web browser:
https://example.com
Enter the credentials you created for the administrative user.