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.
In this tutorial, we are going to Install NextCloud On Ubuntu 22.04 LTS, This will be a detail step-by-step high-performance Setup.
1. Install PHP and MySQL packages
2. Configure MySQL Server
3. Run the Nextcloud Setup on the Browser.
1. Install 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
2. Configure MySQL Server
1. Login to MySQL Prompt, Just type
# mysql
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';
FLUSH PRIVILEGES;
quit;
3. 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: https://download.nextcloud.com/server/releases/latest.zip
1. Download and unzip at the web root (/var/www/html) folder
# cd /var/www/html
# wget https://download.nextcloud.com/server/releases/latest.zip
# unzip latest.zip
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
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)
![](https://mailserverguru.com/wp-content/uploads/2023/06/nextcloud-installation-page.png)
– 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.
![](https://mailserverguru.com/wp-content/uploads/2023/06/nextcloud-apps-install.png)
Our installation and Initial Setup are complete so Next, the Nextcloud Dashboard will appear.
![](https://mailserverguru.com/wp-content/uploads/2023/06/nextcloud-dashboard.png)
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.