Install and Configure Nextcloud on Ubuntu 20.04

In this article, we want to teach you How To Install and Configure Nextcloud on Ubuntu 20.04.

Nextcloud is open-source software that allows you to run a personal cloud storage service. It has features that are comparable to other services such as Dropbox.

The Nextcloud server software can be installed free of charge on Linux, and the client software can be installed on computers running Windows, OS X, or Linux. Mobile apps are also available for Android and iOS.

Nextcloud is a fork of the OwnCloud project, developed by many of the original members of the OwnCloud team.

How To Install and Configure Nextcloud on Ubuntu 20.04

To install Nextclould on your server, you need some requirements first.

Requirements

You need to log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our article The Initial Server Setup with Ubuntu 20.04.

Also, you need a domain name that pointed to your server’s IP address to secure connections with TLS/SSL.

Now follow the steps below to install Nextcloud on Ubuntu 20.04.

Set up Nextcloud on Ubuntu 20.04

Here we will install Nextcloud using the Snap packaging system. This package is available by default in Ubuntu 20.04.

First, update your local package index with the following command:

sudo apt update

Then, download the Nextcloud snap package and install it on Ubuntu 20.04 with the command below:

sudo snap install nextcloud

You can verify your Nextcloud installation on Ubuntu 20.04 with the following command:

snap changes nextcloud
Output
ID Status Spawn Ready Summary
2 Done today at 07:12 CET today at 07:13 CET Install "nextcloud" snap

Also, you can use the following command to get more information about Nextcloud snap:

snap info nextcloud

To see what snap connections this snap defines, you can run the following command:

snap connections nextcloud
Output
Interface        Plug                       Slot           Notes
network          nextcloud:network          :network       -
network-bind     nextcloud:network-bind     :network-bind  -
removable-media  nextcloud:removable-media  -              -

Configure Nextcloud on Ubuntu 20.04

At this point, you need to create a new administrator account for Nextcloud with the following command:

sudo nextcloud.manual-install username password

You should get the following output:

Output
Nextcloud was successfully installed

By default, Nextcloud only responds to requests made to the “localhost” hostname.

You can view the current settings with the following command:

sudo nextcloud.occ config:system:get trusted_domains
Output
localhost

You need to adjust the settings to access Nextcloud through the server’s domain name or IP address.

To do this, you can add an entry for your server’s domain name or IP address with the following command:

sudo nextcloud.occ config:system:set trusted_domains 1 --value=your-domain
Output
System config value trusted_domains => 1 set to string your-domain

Now if you query for the trusted domains again, you will see that you now have two entries.

sudo nextcloud.occ config:system:get trusted_domains
Output
localhost
your-domain

Secure Nextcloud with SSL

At this point, you need to secure your Nextcloud web interface on Ubuntu 20.04. You can set up an SSL with Let’s encrypt or with a self-signed certificate.

Set up SSL with let’s encrypt:

If you have a domain name associated with your Nextcloud server, the best option for securing your web interface is to get a Let’s Encrypt SSL certificate.

First, allow traffic on ports 80 and 443 through the firewall:

sudo ufw allow 80,443/tcp

Then, request a Let’s Encrypt certificate with the following command:

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, type y to continue.

Next, you will be asked to provide an email address. Finally, enter the domain name associated with your Nextcloud server.

When you are done, in your output you will see:

Output
Attempting to obtain certificates... done
Restarting apache... done

Set up an SSL with a self-signed certificate:

If your Nextcloud server does not have a domain name that pointed to your Ubuntu 20.04 IP address, you can still secure the web interface by generating a self-signed SSL certificate.

To generate a self-signed certificate and configure Nextcloud to use it, run the following command:

sudo nextcloud.enable-https self-signed
Output
Generating key and self-signed certificate... done
Restarting apache... done

Now you need to open the ports through the firewall:

sudo ufw allow 80,443/tcp

Access Nextcloud Web Interface

At this point, you can access your Nextcloud web interface by typing your domain name or IP address in your web browser:

https://domain-or-IP-address

You will see the Nextcloud login screen.

Nextcloud login screen

Enter the administrator account credentials that you have provided before and press the Log in button to see your Nextcloud dashboard.

Nextcloud dashboard

Conclusion

At this point, you learn to install and configure Nextcloud on Ubuntu 20.04. Also, you learn to secure your website by setting up an SSL with let’s encrypt and a self-signed certificate.

Hope you enjoy it.

May you will be interested in these articles:

Install and Use SQLite on Ubuntu 20.04.

Install and Configure Squid Proxy on Ubuntu 20.04.

How To Set up GlassFish on Ubuntu 20.04.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!