Build Your Own Nextcloud File Server on CentOS 8 in 30 Minutes
This guide walks you through purchasing a VPS, installing DNF, Apache, PHP, and MariaDB on CentOS 8, configuring SELinux, deploying Nextcloud from source, setting permissions, and completing the web‑based setup, enabling a fully functional self‑hosted cloud storage service.
1. Acquire a VPS
Select a cloud provider (e.g., UCloud) and purchase a CentOS 8 instance; obtain a domain name if you need public access.
2. Install required packages
2.1 Install DNF
yum install dnf
dnf update -y2.2 Install Apache
dnf install -y httpdEnable and start Apache:
systemctl enable httpd.service
systemctl start httpd.service2.3 Install PHP and extensions
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf install yum-utils
dnf module reset php
dnf module install php:remi-7.4
dnf install -y php php-gd php-mbstring php-intl php-pecl-apcu php-mysqlnd php-opcache php-json php-zip php-dom2.4 Install MariaDB
dnf install -y mariadb mariadb-serverEnable and start MariaDB:
systemctl enable mariadb.service
systemctl start mariadb.serviceSecure the installation:
mysql_secure_installation3. Deploy Nextcloud
3.1 Download and extract
wget https://download.nextcloud.com/server/releases/nextcloud-18.0.3.zip
unzip nextcloud-*.zipCopy files to Apache’s web root: cp -R nextcloud/ /var/www/html/ Create a data directory for user files:
mkdir /var/www/html/nextcloud/data3.2 Set permissions
chown -R apache:apache /var/www/html/nextcloud
systemctl restart httpd.service3.3 Adjust SELinux (if enabled)
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/apps(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.htaccess'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.user.ini'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?'
restorecon -R '/var/www/html/nextcloud/'
setsebool -P httpd_can_network_connect on4. Complete web‑based configuration
Open http://your-domain/nextcloud in a browser, create the admin account, enter the MariaDB credentials, and follow the on‑screen steps to finish installation.
After setup, files are stored under /var/www/html/nextcloud/data/admin/files.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
