How to Install and Configure OwnCloud on CentOS 8

OwnCloud is an open source project that can be installed on your server to securely store and access files.

OwnCloud 10.3.2 requires the following installed and running.

How to Install PHP on CentOS 8 Update the OS Packages

yum update -y

Now install PHP 7.2 using the following commands.

First, we Install the EPEL and Remi repository packages.

yum install epel-release yum-utils -y

sudo dnf install dnf-utils

Install PHP

The following command will install PHP and some of the most common PHP modules.

sudo dnf install php php-opcache php-gd php-curl php-mysqlnd

Once the installation is complete, start the PHP service and enable it to automatically start on boot by typing

systemctl enable --now php-fpm  

Install MariaDB

Run the following command as root or user with sudo privileges to install MariaDB 10.3 on CentOS 8.

sudo dnf install @mariadb

Once the installation is complete, start the MariaDB service and enable it to automatically start on boot by typing.

systemctl enable --now mariadb

Install Apache

To install the Apache run the following command.

yum install httpd

Once the installation is complete, start and enable the Apache service.

systemctl start httpd

systemctl enable httpd

Downloading ownCloud

Download ownCloud and extract it using the following command.

wget -P /tmp

unzip -d /var/www/html/

Now change the permissions of owncloud directory.

chown apache:apache -R /var/www/html/owncloud/

chmod +R 755 /var/www/html/owncloud

Create a new MySQL database.

mysql -u root -p

mysql> CREATE DATABASE ownclouddb;

mysql> GRANT ALL PRIVILEGES ON ownclouddata.* TO 'ownclouduser'@'localhost' IDENTIFIED BY 'enter your password' WITH GRANT   


mysql> exit;

Configuring Apache

Open your text editor and create the following Apache configuration file.

vi /etc/httpd/conf.d/owncloud.conf

  Alias /owncloud "/var/www/owncloud/"
  <Directory /var/www/owncloud/>
  Options +FollowSymlinks
  AllowOverride All

  <IfModule mod_dav.c>
     Dav off

    SetEnv HOME /var/www/owncloud
    SetEnv HTTP_HOME /var/www/owncloud


Restart the Apache service to activate the changes.

systemctl restart httpd

Open the port in firewall using following command.

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload

Set SELinux mode to permissive.

Run the following command.

setenforce 0

And change the mode in file.

vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.

Now type your IP address in the URL to complete the ownCloud installation.


You will have to create admin account for ownCloud

Enter the username and password which you want to set.


Now click on the Storage and database and select MySQL/MariaDB

Fill the database information and click on the Finish setup button.