Thursday, 26 August 2021

Install ownCloud Storage Server on CentOS/RHEL 8


ownCloud is a free and open source software for creating and using file hosting services. In this article, you will learn to install ownCloud storage server on CentOS / RHEL 8.


Table of Contents:


What is ownCloud? :

OwnCloud is an open-source file sync, share and content collaboration software that lets teams work on data easily from anywhere, on any device.

The Server Edition of ownCloud is free and open-source, thereby allowing anyone to install and operate it without charge on their own private server. You can build your own cloud storage by using this software.

ownCloud functionally has similarities to the widely used Dropbox. The primary functional difference between ownCloud and Dropbox is that ownCloud is primarily server software.

ownCloud supports extensions that allow it to work like Google Drive, with online office suite document editing, calendar and contact synchronization, and more.

Its openness avoids enforced quotas on storage space or the number of connected clients, instead of having hard limits (for example on storage space or number of users) limits are determined by the physical capabilities of the server. (Source: Wikipedia)

Recommended Book: Getting Started with ownCloud Kindle Edition by Aditya Patawari


Environment Specification:

We are using a minimal RHEL 8 virtual machine with following specification.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 100 GB
  • Operating System - Red Hat Enterprise Linux 8.4
  • Hostname –
  • IP Address - /24


Update Your Linux Operating System:

Connect with as root user by using a ssh client.

Before installing a new software, it is a best practice to update existing packages in your Linux operating system.

# dnf update -y

If the above command installs a new Linux Kernel, then you should reboot your Linux operating system with the new Kernel.

# reboot

Verify the Linux operating system and Kernel versions in use.

# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.4 (Ootpa)

# uname -r


Install ownCloud Prerequisites:

ownCloud is written in PHP programming language, therefore, you are required a LAMP or LEMP server to deploy this application. Here, we are installing a LAMP server.

All of the ownCloud prerequisite packages are available in standard yum repositories. Therefore, you can install all these software packages by using a single dnf command.

# dnf install -y httpd mariadb-server mariadb php php-curl php-gd php-intl php-json php-ldap php-mbstring php-mysqlnd php-xml php-zip php-opcache wget bzip2

Enable and start LAMP services.

# systemctl enable --now httpd php-fpm mariadb
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/php-fpm.service.
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/mariadb.service.

Configure initial settings and security of MySQL database server.

# mysql_secure_installation


In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Connect with MySQL database server as root user.

# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.28-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Create a database, that serves as the back end repository for ownCloud server.

MariaDB [(none)]> CREATE DATABASE oc_db;
Query OK, 1 row affected (0.001 sec)

Create a database user for accessing the ownCloud database.

MariaDB [(none)]> CREATE USER 'oc_user'@'localhost' IDENTIFIED BY 'P@ssw0rd';
Query OK, 0 rows affected (0.001 sec)

Grant complete privileges on oc_db database to oc_user.

MariaDB [(none)]> GRANT ALL ON oc_db.* TO 'oc_user'@'localhost';
Query OK, 0 rows affected (0.001 sec)

Reload privileges tables and exit from MySQL shell.

Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> EXIT


Install ownCloud Server on CentOS / RHEL 8:

ownCloud file hosting server is available for free download at their official website. You can get the download link of the latest version from there and use the wget command to download it on your Linux server machine.

# wget
--2021-08-24 12:49:19--
Resolving (, 2a01:4f8:1c1d:3d1::1
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 37541418 (36M) [application/x-bzip2]
Saving to: ‘owncloud-complete-20210721.tar.bz2’

owncloud-complete-2 100%[===================>]  35.80M  29.8KB/s    in 14m 30s

2021-08-24 13:03:51 (42.1 KB/s) - ‘owncloud-complete-20210721.tar.bz2’ saved [37541418/37541418]

We have downloaded the BZIP compressed Tar file. ALternatively, you can choose to download other formats.

Execute the following tar command to extract downloaded file in /var/www directory.

# tar xjf owncloud-complete-20210721.tar.bz2 -C /var/www/

Give the ownership of extracted files to Apache user.

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

Create a Apache configuration file to deploy ownCloud application. You can use vim text editor for this purpose.

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

Add following Apache directives in this file.

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


Save and exit from vim text editor.

Execute following command to test your Apache configurations.

# httpd -t
Syntax OK

Restart Apache service to load changes.

# systemctl restart httpd

Apache process requires explicit read/write access to ownCloud software directory. You can either configure this by defining a SELinux fcontext by using semanage command. or by enabling the httpd_unified SELinux boolean.

Here, we are enabling SELinux boolean by using setsebool command.

# setsebool -P httpd_unified 1

To make your storage cloud accessible across the network, you need to allow the Apache default service port in Linux firewall.

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

Open URL in a web browser.


Create an admin user and set the data directory for ownCloud application.


Provide database credentials for connectivity between ownCloud and MySQL server.

Click on ‘Finish Setup’.


Login as admin user.


You have reached at the dashboard of ownCloud application.



In this article, you have learned how to install owncloud storage server on CentOS / RHEL 8. The same steps are also good for installation on Rocky Linux, Alma Linux or Oracle Linux. You can now build your own cloud storage.

If you find this article useful? Don't you mind support us by Buy Me A Coffee

No comments:

Post a Comment

© 2022 CentLinux. All Rights Reserved.