configure nextcloud ubuntu

Jump toUpdate content

Install and Configure Nextcloud

Reviewed on 09 February 2022Published on 26 October 2018
  • compute
  • storage
  • Instances
  • Nextcloud
  • Ubuntu-Bionic-Beaver

Nextcloud Overview

Nextcloud is an open source, self-hosted file share and communication platform.

It provides a large portfolio of different applications to access your cloud storage from your PC, Mac or mobile device.


Installing Nextcloud

  1. Log in to your server:

    ssh root@SERVER_IP_ADDRESS
  2. Update the apt package manager and upgrade the software already installed on your Instance to the latest version.

    apt update && apt upgrade -y
  3. Install Nextcloud via Snap:

    snap install nextcloud
  4. Finish the installation by running the following command. Note that a username and password must be provided when you run the script.

    nextcloud.manual-install user password

    Replace user with the identifier of your user and password with the password of your user in the command above.

    You will see the following message:

    Nextcloud is not installed - only a limited number of commands are available

    Some minutes later the following message appears: Nextcloud was successfully installed. Your Nextcloud installation has been successfully.

Configuring Trusted Domains

By the default the access to your Nextcloud instance is limited to localhost. To access it via your domain name, you have to add it to the list of trusted domains.

  1. Run the following command to allow the connection via the domain your.domain.com to your Nextcloud.

    nextcloud.occ config:system:set trusted_domains 1 --value=your.domain.com
  2. The following message appears when the domain was successfully added: System config value trusted_domains => 1 set to string your.domain.com

Securing the Web Interface with a Let’s Encrypt SSL Certificate

By default the Nextcloud installation via Snap provides a plain HTTP connection which is not encrypted. This may be a potential security risk when transferring your data over the Internet.

Let’s Encrypt provides free SSL certificates to encrypt the connection to your Nextcloud instance.

  1. The snap package relies on the resolvconf package to resolve DNS requests, which is not installed on Ubuntu by default. Install it using the apt package manager:

    apt install resolvconf
  2. Enable SSL and request a Let’s Encrypt SSL certificate:

    nextcloud.enable-https lets-encrypt
  3. The following message will appear, confirm it by pressing y on your keyboard:

    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:

  4. In order to register with the Let’s Encrypt ACME server, you must agree to the currently-in-effect Subscriber Agreement located here:


    By continuing to use this tool you agree to these terms. Please cancel now if otherwise.

  5. You must have the domain name(s) for which you want certificates pointing at the external IP address of this machine.

  6. 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)

  7. Enter your email address when asked to do so and confirm by pressing Enter:

    Please enter an email address (for urgent notices or key recovery): you@your.domain.com
  8. Enter the domain name that you have configured in a previous step for your instance (your.domain.com in our case), then confirm by pressing Enter:

    Please enter your domain name(s) (space-separated): your.domain.com
  9. Your certificate is being requested and apache will be restarted. The following messages will appear, once the certificate has been obtained:

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

Accessing Nextcloud

You will now be able to access your Nextcloud instance for the first time.

  1. Open your brower and type the address of your instance (For example: https://your.domain.com). You will see a login screen where you have to enter the user and password that you have created previously.

  2. Once connected you will see your personal cloud storage space. You can upload, share or download files from the interface:

  3. Optionally, you can download one of the several Nextcloud clients to manage your cloud storage space directly from your computer.