NCPi installation failing because of systemd-resolved

,

I tried to install a fresh copy of Nextcloud (via NCPi) ona freshly installed Debian Linux. And to my surprise the installation failed with an error related to systemd-resolved.
I see that the issue is discussed here.
But the instructions for solving it aren’t really clear (at least not to me).
So I created a list of step-by-step instructions on how to fix/bypass it.

1. Install systemd-resolved

First, install the systemd-resolved package, which is required to handle DNS resolution in many cases:

sudo apt-get install systemd-resolved

2. Enable and start systemd-resolved

Once installed, enable and start the systemd-resolved service to ensure it is running properly:

sudo systemctl enable systemd-resolved
sudo systemctl start systemd-resolved

3. Check the status of resolvconf

If resolvconf is installed, check its status to ensure there are no conflicts:

sudo systemctl status resolvconf

If the service is inactive or disabled, that’s fine since systemd-resolved will handle DNS resolution.

4. Backup and create a new resolv.conf

Sometimes, the /etc/resolv.conf file can be incorrectly configured or missing. Back up the current file and create a new one using Google’s public DNS (or another DNS of your choice).

Backup the existing file:

sudo mv /etc/resolv.conf /etc/resolv.conf.bak

Create a new resolv.conf file with Google’s DNS:

echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf

Alternatively, you can use Cloudflare’s DNS:

echo "nameserver 1.1.1.1" | sudo tee /etc/resolv.conf

5. Restart the network service

Apply the changes by restarting the network service:

sudo systemctl restart networking

6. Test DNS resolution

After restarting the network, test DNS resolution to ensure it works properly by pinging a well-known website:

ping google.com

If the ping works, DNS is now functioning correctly.

7. Re-run the NextCloudPi installation script

Once DNS resolution is fixed, you can re-run the NextCloudPi installation script:

curl -sSL https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/install.sh | sudo bash

Hope this helps anyone facing similar issues!