
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. 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 through how to create nextcloud on a Linux server. Other articles that are useful and relevant can be found 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
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 with snap
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
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 and the one that was successfully installed without a hitch.
Step 2: Configure an Administrative Account
The nextcloud.manual-install
command is used to configure Nextcloud with a new administrator account. 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. By typing: we can add an entry for our server’s domain name or IP address:
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
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 Nextcloud is set up, navigate to your server’s domain name or IP address in your web browser:
https://192.168.125.136
You will be directed 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
Nextcloud can mimic the capabilities of popular third-party cloud storage services. Content can be shared between users or externally via public URLs. The benefit of Nextcloud is that the information is securely stored in a location under your control.