Install NextCloud On Ubuntu 22.04 LTS

Install NextCloud On Ubuntu 22.04 LTS

In this tutorial, we are going to explain in details how to install nextcloud on Ubuntu 22.04.

Nextcloud is a file hosting system that allows us to store our content like documents, pictures, videos, etc, and share them with others.

Instead of relying on external service providers for our personal and business documents, Nextcloud gives us the freedom to store them on our servers or in trusted data centers.

it’s a self-managed centralized document and file management system. It is Open-Source hence enabling us to use and adapt the application as we need. We have full control over the application. So we can provide our security measures to secure our contents.

Nextcloud installation is easy and straightforward, there are many steps to enhance the functionalities of nextcloud, below, we provided the very basic steps to quickly install Nextcloud on Ubuntu 22.04 LTS.

Table of Contents

    Step1: Install PHP and MySQL packages

    1. Update and Upgrade the Ubuntu Packages

    apt update && apt upgrade

    2. install Apache and MySQL Server

    apt install apache2 mariadb-server

    3. Install PHP and other Dependencies and Restart Apache

    apt install libapache2-mod-php php-bz2 php-gd php-mysql php-curl \
    php-mbstring php-imagick php-zip php-ctype php-curl php-dom \
    php-json php-posix php-bcmath php-xml php-intl php-gmp zip unzip wget

    4. Enable required Apache modules and restart Apache:

    a2enmod rewrite dir mime env headers
    systemctl restart apache2

    Step2: Configure MySQL Server

    1. Login to MySQL Prompt, Just type


    2. Create MySQL Database and User for Nextcloud and Provide Permissions.

    CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'passw@rd';
    CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
    GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';

    Step3: Download and Install Nextcloud

    Now download the latest Nextcloud archive file, Go to the Nextcloud Download Page. Or you can download from this direct link.

    1. Download and unzip at the web root (/var/www/html) folder

    cd /var/www/html
    rm index.html

    2. Move all nextcloud content to the web root (/var/www/html) folder

    cd /var/www/html/nextcloud
    mv * .* ../

    3. Remove the empty nextcloud directory

    rmdir /var/www/html/nextcloud

    4. Change the ownership of the Nextcloud content directory to the HTTP user.

    chown -R www-data:www-data /var/www/html

    Step4: Finalize Setup from the Browser

    Now, Go to the Browser and type http:// [ ip or fqdn ] of the server, The below Nextcloud install page will appear. On the page, we need to provide information for

    1. Nextcloud admin username & password
    2. Database Credentials (db name, db user and db Password)

    After Providing all the information click the Install button. it will install Nextcloud in a minute and provide the recommended app installation page, we can safely cancel the prompt for now.

    Our installation and Initial Setup are complete so Next, the Nextcloud Dashboard will appear.

    OK, this is it.

    This is the fastest way to install Nextcloud on Ubuntu 22.04, after installation we should take care of the Nextcloud performance and security issues.

    Thanks !!


    Get Special Free Tips, Tricks, Tutorials, and Case Studies, that I Only Share with Email Subscribers.


    We respect your privacy. Unsubscribe at any time.

    Related Articles


    Leave a Reply

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