How to Install NextCloud on Ubuntu 22.04 with Snap

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"

Hello, friends. Welcome. We’ve talked a lot about Nextcloud because we love it, but today we offer you another method to get it. In this post, you will learn how to install Nextcloud using Snap on Ubuntu 22.04.

Nextcloud is a self-hosted file share and collaboration platform. It works much like cloud applications like Dropbox and Google Drive. It allows you to store and share your files in a secure and convenient manner across both desktop and hand-held devices such as smartphones.

Let’s go for it

Install Nextcloud using Snap

Snap is a Canonical technology for distributing applications on Linux. The main feature of it is that a single package contains all the package dependencies. So for developers it can be a great facility. By the way, today you will see some potential.

So, after connecting to the server using SSH or on the test virtual machine, proceed to update the system

sudo apt update
sudo apt upgrade

It is very likely that Ubuntu 22.04 comes with Snap installed by default, but it is true that on server versions, it may not. In this case, be sure to install it.

sudo apt install snapd

Then to get support for classic snap packages, you have to install core.

sudo snap install core

And to get full support for the files run

sudo ln -s /var/lib/snapd/snapd/snap/ /snap

Thereafter, you have to open the corresponding ports for Nextcloud

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw reload

Now yes, you can install Nextcloud with snap on Ubuntu 22.04 by running

sudo snap install nextcloud
Install Nextcloud on Ubuntu 22.04 using Snap
Install Nextcloud on Ubuntu 22.04 using Snap

It’s that easy. But is everything in that package? Yes, it is. The Nextcloud snap package includes:

So, we have everything.

When the installation process is finished, you can open a web browser and go to http://your-server/ to create the necessary admin user and install.

Nextcloud running
Nextcloud running

Configuring Nextcloud before using it properly

The next step is to go back to the terminal because you need to enable support for your domain. To achieve this, we need to edit the Nextcloud configuration. But first I want to tell you that in the Nextcloud Snap package the configuration resides in /var/snap/nextcloud/current/current and that of the files in /snap/nextcloud/current/htdocs/.

With this in mind, edit the Nextcloud configuration file:

sudo nano /var/snap/nextcloud/current/nextcloud/config/config.php

And inside the `trusted_domains' section add your own as follows

trusted_domains' =>
    array (
       0 => '',
Enable the domain
Enable the domain

Save the changes and close the editor.

The next step is to enable HTTPS to further secure the connection

sudo nextcloud.enable-https lets-encrypt

You will see a screen like this where you will see the requirements. They are easy, accept them and add your domain.

Secure the server by using HTTPS
Secure the server by using HTTPS

When finished, you will be able to access your Nextcloud instance from https://your-domain.


In this post, you learned how to install Nextcloud on Ubuntu 22.04 using Snap. The process is simple and makes it easy for everyone.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.



Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook