Cloud Computing 6 min read

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.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Build Your Own Nextcloud File Server on CentOS 8 in 30 Minutes

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 -y

2.2 Install Apache

dnf install -y httpd

Enable and start Apache:

systemctl enable httpd.service
systemctl start httpd.service

2.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-dom

2.4 Install MariaDB

dnf install -y mariadb mariadb-server

Enable and start MariaDB:

systemctl enable mariadb.service
systemctl start mariadb.service

Secure the installation:

mysql_secure_installation

3. Deploy Nextcloud

3.1 Download and extract

wget https://download.nextcloud.com/server/releases/nextcloud-18.0.3.zip
unzip nextcloud-*.zip

Copy files to Apache’s web root: cp -R nextcloud/ /var/www/html/ Create a data directory for user files:

mkdir /var/www/html/nextcloud/data

3.2 Set permissions

chown -R apache:apache /var/www/html/nextcloud
systemctl restart httpd.service

3.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 on

4. 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.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxcloud storagenextcloudSelf-hosted
Liangxu Linux
Written by

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.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.