How to Install NextCloud with LAMP Stack on CentOS Stream 10

NextCloud is a self-hosted cloud storage platform that allows users to store, sync, and share data securely. This guide will walk you through installing NextCloud with the LEMP (Linux, Nginx, MariaDB, PHP) stack on CentOS Stream 10.

Update System

sudo dnf update -y

Install Apache (HTTPD)

sudo dnf install -y httpd httpd-tools

Start and Enable Apache

sudo systemctl enable --now httpd
sudo systemctl status httpd

Install MariaDB (Database Server)

sudo dnf install -y mariadb mariadb-server

Start and Secure MariaDB

sudo systemctl enable --now mariadb
sudo mysql_secure_installation

Create NextCloud Database

mysql -u root -p

Inside MySQL:

CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Install PHP and Required Extensions

sudo dnf install -y php php-cli php-fpm php-mysqlnd php-gd php-json php-mbstring php-xml php-zip php-bz2 php-curl php-intl php-gmp

Check PHP Version

php -v

Configure PHP

sudo nano /etc/php.ini

Modify these settings:

memory_limit = 512M
upload_max_filesize = 512M
post_max_size = 512M
max_execution_time = 300
date.timezone = Asia/Kolkata

Restart PHP

sudo systemctl restart php-fpm
sudo systemctl enable php-fpm

Download and Install NextCloud

Go to the Web Root Directory

cd /var/www/html

Download the NextCloud ZIP File

sudo dnf install -y unzip wget
sudo wget https://download.nextcloud.com/server/releases/latest.zip

Extract the ZIP File

sudo unzip latest.zip

Set Proper Permissions

sudo chown -R apache:apache /var/www/html/nextcloud
sudo chmod -R 775 /var/www/html/nextcloud

Configure Apache for NextCloud

sudo nano /etc/httpd/conf.d/nextcloud.conf

Paste the following configuration:

<VirtualHost *:80>
    ServerName Your-server-IP
    DocumentRoot /var/www/html/nextcloud

    <Directory /var/www/html/nextcloud/>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews
        <IfModule mod_dav.c>
            Dav off
        </IfModule>
    </Directory>

    ErrorLog /var/log/httpd/nextcloud_error.log
    CustomLog /var/log/httpd/nextcloud_access.log combined
</VirtualHost>

Restart Apache

sudo systemctl restart httpd

Allow Firewall and SELinux Rules

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

sudo setsebool -P httpd_unified 1
sudo chcon -R -t httpd_sys_rw_content_t /var/www/html/nextcloud/

Access NextCloud Web Interface

Open your browser and go to:

http://Your-server-IP

Create an admin account and provide the database details:

  • Database user: nextclouduser
  • Database password: StrongPassword
  • Database name: nextcloud
  • Database host: localhost

✅ Done! 🎉

Your NextCloud instance is now accessible at ``. 🚀


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS