Best methods to to Install Nextcloud in Linux Ubuntu

4 Easy Steps to Install Nextcloud in Linux Ubuntu

As a developer, administrator, or a tech lover, you have certainly worked with or heard about cloud-based data storage. Nextcloud is finding an acceptable place for Linux users among the different platforms that offer data storage services. This is a comprehensive guide for demonstrating how to install Nextcloud in Linux Ubuntu. The most well-known platforms that provide these services are Dropbox, Google Drive, Amazon’s AWS, and Apple’s iCloud. Depending on the kind of data you save and the devices you use, there are benefits to using any of these cloud-based file storage services.

Though it is still in its infancy, Nextcloud has the potential to develop into a significant cloud-based file-hosting platform in the years to come. It’s reasonable to conclude that Nextcloud is among the greatest options available to Linux users. Regardless of which Linux distribution, you can install and use Nextcloud on Ubuntu and Debian.

Using this tutorial, you will learn how to Install Nextcloud on Ubuntu 20.04 and Ubuntu 22.04. In the end, you do not need to rely on third parties for hosting, and you can host documents on your server. Before reviewing the required steps to install Nextcloud in Linux Ubuntu and having your personal cloud storage service, let’s learn more about it.

What is Nextcloud and Why Use it?

Nextcloud is the most popular free, open-source, powerful, and secure content collaboration platform based on PHP that is designed for file sharing and synchronization. Users can synchronize one or more files and directories (or folders) on their computer with a Nextcloud server and share them with others using this safe, secure, and adaptable solution. As a file-sharing server, the Nextcloud server software operates on a Linux platform, client apps for Linux, Windows, and macOS, and mobile clients for Android and Apple iOS are all part of the solution.

Approved users can view files and images online from one central location. Nextcloud is regarded as a potent substitute for Google Drive and Dropbox. Since Nextcloud is a fork of the OwnCloud project, these two projects have many features in common except interface and licensing agreements, particularly for Enterprise editions.

Nextcloud’s amazing tool and program integration make it very popular. Nextcloud is a collection of highly configurable cloud storage applications. It has numerous configuration options and is compatible with more than one hundred third-party apps. When you take into account Nextcloud’s general emphasis on cloud storage security, it gets even better. In addition, Nextcloud offers optional connectivity with third-party apps, integrated personal information management, and 2FA. Nextcloud provides its Nextcloud Hub solution to those who want to manage internal cooperation. There are two versions available: Regular and Enterprise.

Nextcloud Features

  • Security.
  • Large Community.
  • Real-time notifications, comments, and multi-user editing.
  • Full-text search engine.
  • Ease of Use.
  • Advanced Account Management.
  • Self-Hosting.
  • Ability to monitor and record all data exchanges and communications.

Prerequisites to Install Nextcloud on Ubuntu 20.04 & 22.04

To Install Nextcloud in Linux Ubuntu, your machine needs to meet all the below specifications:

Tutorial to Nextcloud Installation in Linux Ubuntu

Let’s go through the steps of this guide to install, configure, and use Nextcloud in Ubuntu. As we mentioned, you need to provide some required options to get ready for the Nextcloud installation process on Ubuntu. Anyway, if you are not prepared, follow the below steps from the first. If you have installed Lamp, you can skip the first step.

Step 1. Install LAMP on Ubuntu

To get started, you need to install the LAMP stack.

$ sudo apt-get update
$ sudo apt-get install apache2 mariadb-server libapache2-mod-php7.2 php7.2-gd php7.2-json php7.2-mysql php7.2-curl php7.2-mbstring php7.2-intl php-imagick php7.2-xml php7.2-zip

The above command will install Apache, MariaDB server, and PHP packages. Also, you will have all the required PHP modules. The installer will configure the Apache2 and MariaDB services to start for the time being and allow them to start automatically at the system boot after the package installation is finished.

  • Try running the following systemctl commands to see if the two services are enabled and running.
$ systemctl status apache2
$ systemctl status mariadb
$ systemctl is-enabled apache2
$ systemctl is-enabled mariadb
  • To secure the MariaDB server installation, run the command below with a password for your user:
$ sudo mysql_secure_installation
  • To change your server’s root password, hit the enter key at the following window and then Y. Make sure your password is strong because there will be serious repercussions if your database server is compromised. Also, press Y for all the next questions.

Step 2. Install Nextcloud on Ubuntu

By finishing the previous step, you are ready to Install Nextcloud Ubuntu. So far, you secured the database installation. Now, Nextcloud needs a database and database user:

  • To create them, log into your MariaDB server to access the MySQL shell and run sql commands:
$ sudo mysql -u root -p
MariaDB [(none)]> CREATE DATABASE nextcloud; 
MariaDB [(none)]> CREATE USER ncadmin@localhost IDENTIFIED BY 'Your Password; 
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nextcloud.*  TO ncadmin@localhost IDENTIFIED BY ' Your Password; 
MariaDB [(none)]> FLUSH PRIVILEGES; 
MariaDB [(none)]> EXIT;

Replace Your Password with your secure password.

  • Now, click on Download Nextcloud Server ⇒ on the Nextcloud Download Page to download it and obtain a .zip archive.
  • Also, you can use the Linux wget command to run the commands below and download Nextcloud from the command line.
$ sudo wget -c
  • After that, extract the contents of the archive and move the nextcloud directory or folder into the document root of your web server. Additionally, make the following changes to the nextcloud directory’s ownership.
$ sudo unzip
$ sudo cp -r nextcloud /var/www/html/
$ sudo chown -R www-data:www-data /var/www/html/nextcloud

Step 3. Configure the Database & User to Serve Nextcloud on Ubuntu

To achieve the purpose of this step, you need to:

  • Create an Apache configuration file for Nextcloudunder the /etc/apache2/sites-available directory.
$ sudo vim /etc/apache2/sites-available/nextcloud.conf
  • Now, the lines below should be copied and pasted into the file. If your installation directory is different, substitute /var/www/html/nextcloud/.
Alias /nextcloud "/var/www/html/nextcloud/"

<Directory /var/www/html/nextcloud/>
  Require all granted
  Options FollowSymlinks MultiViews
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off

 SetEnv HOME /var/www//html/nextcloud
 SetEnv HTTP_HOME /var/www/html/nextcloud
  • When you are finished, save and close the file.
  • Then, run the command below to enable the site you have created and other modules in the Apache configuration structure:
$ sudo a2ensite nextcloud.conf
$ sudo a2enmod rewrite
$ sudo a2enmod headers
$ sudo a2enmod env
$ sudo a2enmod dir
$ sudo a2enmod mime
  • Lastly, to let the changes take effect, use the command below to restart the Apache2 service:
$ sudo systemctl restart apache2

Step 4. Use Nextcloud on Linux Ubuntu

Now that you have successfully installed and configured Nextcloud in Ubuntu, you are ready to complete it via the graphical wizard from a web browser. To do this, you just need to:

  • Log into the Nextcloud Web Interface. So, open your preferred browser and navigate to the following URL:
  • Make an admin or superuser account for nextcloud when the installation wizard loads. Put the password and username in here.
  • To access additional installation configuration choices for your Nextcloud data directory and database, click on the Storage and Database page.
  • Next, click Complete Setup after entering the database connection information as displayed in the screenshot that follows.

Nextcloud Setup

  • Following installation completion, the window below will appear. To continue and adhere to the instructions, click the advance arrow that will show up on the right side of the blue window.

Nextcloud Installation Wizard

  • To begin utilizing your new Nextcloud server, click Finish Setup in the below window.

start using nextcloud

  • If all the above steps are done correctly, you must view the Nextcloud web browser client’s main dashboard.

nextcloud default dashboard

That’s it! Using this guide, you learned how to install Nextcloud in Linux Ubuntu.

To investigate the user interface to become more acquainted with the capabilities and features of your new machine. Check out Nextcloud’s app store for more features. You may add plugins to the service to increase its functionality.


In this article, you learned How to Install Nextcloud in Linux Ubuntu using the Apache web server and MariaDB database. You also reviewed how to setup and use Nextcloud server software in your Ubuntu server.

Among cloud-based file hosting providers, Nextcloud is undoubtedly not the most well-known or powerful. However, it has managed to amass a sizable community and user base for itself because it caters to a very niche target within the Linux community.

If you follow the above steps properly, you can smoothly install Nextcloud Ubuntu without any errors but do not hesitate to contact us if you encounter any problems. Our technical support team will try their best to solve your problems.

Leave a Reply

Your email address will not be published. Required fields are marked.