DropVPS Team
Writer: Cooper Reagan
How to Install Nextcloud on CentOS 9

Table of Contents
Nextcloud transforms your server into a private cloud for syncing files, sharing data, storing backups, and running collaborative apps. CentOS Stream 9 provides a stable base for hosting it with Apache, PHP, and MariaDB.
Step 1: Update System Packages
Start with a clean and updated system.
sudo dnf update -y
Step 2: Install Apache Web Server
Nextcloud runs perfectly on Apache:
sudo dnf install httpd -y
sudo systemctl enable --now httpd
Verify:
systemctl status httpd
Step 3: Install PHP and Required Extensions
CentOS 9 uses AppStream modules, but for newer PHP versions it’s better to use Remi Repo.
Enable Remi:
sudo dnf install epel-release -y
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm -y
sudo dnf module reset php -y
sudo dnf module enable php:remi-8.2 -y
sudo dnf install -y php php-cli php-fpm php-mysqlnd php-xml php-zip php-gd php-curl php-mbstring php-intl php-bcmath php-gmp php-imagick php-redis
Restart Apache:
sudo systemctl restart httpd
Check PHP version:
php -v
Step 4: Install MariaDB Server
Nextcloud uses MariaDB/MySQL as its main database.
sudo dnf install mariadb-server -y
sudo systemctl enable --now mariadb
Secure it:
sudo mysql_secure_installation
Step 5: Create Database and User for Nextcloud
Log in:
sudo mysql -u root
Run:
CREATE DATABASE nextcloud;
CREATE USER 'ncuser'@'localhost' IDENTIFIED BY 'StrongPasswordHere';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 6: Download and Configure Nextcloud
Move to web root, download, extract:
cd /var/www/
sudo wget https://download.nextcloud.com/server/releases/latest.zip
sudo dnf install unzip -y
sudo unzip latest.zip
sudo chown -R apache:apache nextcloud
sudo chmod -R 755 nextcloud
Step 7: Configure Apache Virtual Host
Create config file:
sudo nano /etc/httpd/conf.d/nextcloud.conf
Add:
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /var/www/nextcloud
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
ErrorLog /var/log/httpd/nextcloud-error.log
CustomLog /var/log/httpd/nextcloud-access.log combined
</VirtualHost>
Enable required modules:
sudo dnf install mod_ssl -y
sudo systemctl restart httpd
Step 8: Start the Web Installer
Open:
http://your-server-ip/
Or domain:
http://your-domain.com/
Fill in:
-
Admin username / password
-
Database: nextcloud
-
User: ncuser
-
Password: (your DB password)
-
Host: localhost
Click Finish Setup.