
Nextcloud, a clone of ownCloud, is a file-sharing service that, like Dropbox, allows you to save your own stuff, such as documents and photos, in a centralized area. Furthermore, Nextcloud differs in that all of its features are open source. It also gives you back control and protection over your sensitive data, eliminating the need for a third-party cloud hosting service. In this article, we shall be walking you through how to install Nextcloud on a Linux system.
You can find other articles that are useful and relevant here: How to upgrade from Ubuntu 20.04 LTS to 22.04 LTS and How to fix unable to access microphone on Zoom and How to Change User Account Type in Windows 10 and How to modify Windows 11 Taskbar via Intune and GPO and How to install Rust in a Linux System
Requirements for Installing Nextcloud on Linux
Below are the requirements to install NextCloud on a Linux system
- A Linux machine preferably Ubuntu 22.04
- A user account with sudo privileges
Step 1: Install NextCloud on Linux Using Snap
Installing Nextcloud on Linux is a straightforward process that enables you to have full control over your data and privacy. In this case. the Snap packaging system will be used to install Nextcloud.
This packaging system, which is included by default in Ubuntu 22.04, enables organizations to ship software in a self-contained unit with automatic updates, along with all associated dependencies and configuration.
This means that rather than installing and configuring a web and database server and then configuring the Nextcloud app to run on it, we can install the snap package that handles the underlying systems automatically.
Note: If your Ubuntu server is already hosting other sites in Apache2, snap's instance of Apache2 will conflict. So remove the apache2 that you already have installed before you run the next command.
You can do this with the command :
sudo snap install nextcloud

To this end, your server will be downloaded and installed with the Nextcloud package. You can confirm that the snap installation was successful by listing the following changes:
snap changes nextcloud

The status and summary indicate that the installation had errors. This also shows the one that was successfully installed without a hitch.
Step 2: Configure Nextcloud with an Administrative Account
The nextcloud.manual-install
command is used to configure Nextcloud with a new administrator account. Moreover, as arguments, you must supply a username
and password
. In the case of our example, the password is password
and the username is raphael
sudo nextcloud.manual-install raphael password

Now that Nextcloud has been installed, we must modify the trusted domains so that Nextcloud responds to requests with the server’s domain name or IP address.
Step 3: Adjust the Trusted Domains
Nextcloud limits the host names to which the instance will respond when installed from the command line. By default, the service only responds to requests addressed to the hostname “localhost.” Because we will be accessing Nextcloud via the server’s domain name or IP address, we will need to change this setting to accept these types of requests.
View the current configuration by querying the trusted domains array:
sudo nextcloud.occ config:system:get trusted_domains

At the moment, the array’s first value is only localhost. Besides, by typing: we can add an entry for our server’s domain name or IP address (This is my IP address, you have to enter yours -:) )
sudo nextcloud.occ config:system:set trusted_domains 1 --value=92.168.125.136

If we query the trusted domains again, we will see that we now have two entries:
sudo nextcloud.occ config:system:get trusted_domains

Step 4 : Secure Nextcloud Web Interface with SSL
Next step in installing Nextcloud on Ubuntu is securing the web interface. But, first, let’s protect the web interface by creating a self-signed SSL certificate. This certificate will allow access to the web interface over an encrypted connection, but it will be unable to verify your server’s identity, so your browser will most likely display a warning.
To generate a self-signed certificate and configure Nextcloud to use it, enter:
sudo nextcloud.enable-https self-signed

Open the web ports in the firewall now that the interface is secure to allow access to the web interface:
sudo ufw allow 80,443/tcp

Now that you’ve installed Nextcloud on Linux, navigate to your server’s domain name or IP address in your web browser:
https://192.168.125.136
This will redirect you to the Nextcloud login page because you have already configured an administrator account from the command line. Enter the administrative user credentials you created:

Summary
In conclusion, Nextcloud can mimic the capabilities of popular third-party cloud storage services. Users can share content among themselves or externally via public URLs. In addition, the benefit of Nextcloud is that it securely stores information in a location under your control. By now, you should have adequate knowledge of how to install Nextcloud on a Linux system.