How to Install ownCloud 10 on CentOS 7/6 & RHEL 7/6

ownCloud is a web suite that provides cloud storage over the network. Data will be stored on the server and can be downloaded or accessed anytime with a browser or desktop client or smartphone app.

ownCloud is based on PHP and an SQLite, MySQL, Oracle or PostgreSQL database, so it can run on all platforms that meet these requirements. It provides almost all possibility of functions that are available in commercial suites.

ownCloud is released under an AGPLv3 license, so you can setup own cloud storage server without any additional cost. The commercial version of ownCloud is also available.


The following are the list of features available on ownCloud.

  • Mobile and Desktop Syncing
  • Share With Anybody
  • External Storage
  • Encryption and Security
  • Versioning and Undelete
  • Activity Feed
  • Calendars and Contacts
  • Collaborative Editing
  • Galleries
  • Play Music, Watch Movies, Store Passwords

More here.

Here is the small guide to setup ownCloud 10 on CentOS 7 / CentOS 6 / RHEL 7 / RHEL 6.


Enable Redhat software collection repository on RHEL 7 and RHEL 6.

### RHEL 7 ###

subscription-manager repos --enable rhel-server-rhscl-7-eus-rpms

### RHEL 6 ###

subscription-manager repos --enable rhel-server-rhscl-6-eus-rpms

ownCloud works only with PHP v5.6 and above. So, we need to configure Webtatic repository on CentOS / RHEL to get PHP 5.6 packages.

Also, we need to enable EPEL repository to get dependent packages.

### CentOS 7 / RHEL 7 ###

rpm -ivh
rpm -ivh

### CentOS 6 / RHEL 6 ###

rpm -ivh
rpm -ivh

Install the Apache server and PHP extensions using the yum command.

yum install -y httpd php56w php56w-gd php56w-json php56w-pdo php56w-curl php56w-intl php56w-mcrypt php56w-zip php56w-xml php56w-mbstring php56w-mysqlnd

As mentioned earlier, it is based on PHP and database combination. Database can be any of from SQLite, MySQL/MariaDB, Oracle or PostgreSQL database.

For this demo, we will use MariaDB/MySQL as a database for ownCloud, and we will talk about the reason behind it later.

### CentOS 7 / RHEL 7 ###

yum -y install wget mariadb-server mariadb

### CentOS 6 / RHEL 6 ###

yum -y install mysql-server mysql

Setup ownCloud Repository

ownCloud provides a variety of options (Tarball, Docker, Appliance, Linux Packages, and Web Installer) to run ownCloud in your environment.

Here, we will use Linux installer for the installation of ownCloud. Import the ownCloud sigining key using the rpm command.

### CentOS 7 ###

rpm --import

### CentOS 6 ###

rpm --import

### RHEL 7 ###

rpm --import

### RHEL 6 ###

rpm --import

Add the ownCloud repository on your system

### CentOS 7 ###

cd /etc/yum.repos.d/

### CentOS 6 ### 

cd /etc/yum.repos.d/ 

### RHEL 7 ### 

cd /etc/yum.repos.d/ 

### RHEL 6 ###

cd /etc/yum.repos.d/

Install ownCloud 10

Install the ownCloud package using the yum command.

yum -y install owncloud-files

Allow the web server to read and write the files on ownCloud directory.

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

Start the Apache and MariaDB/MySQL service using the following command.

### CentOS 7 / RHEL 7 ###

systemctl start httpd
systemctl start mariadb

### CentOS 6 / RHEL 6 ###

service httpd start
service mysqld start

Enable both Apache and MySQL/MariaDB service to start automatically at system start-up.

### CentOS 7 / RHEL 7 ###

systemctl enable httpd
systemctl enable mariadb

### CentOS 6 / RHEL 6 ###

chkconfig httpd on
chkconfig mysqld on

Create Database

If you are setting up a MariaDB for the first time, run the mysql_secure_installation to Secure MariaDB / MySQL. MariaDB server must be started before creating the database.

Log in to MySQL server.

mysql -u root -p

Create a database called “clouddb

create database clouddb;

Allow “clouddbuser” to access the “clouddb” database on localhost with the predefined password.

grant all on clouddb.* to 'clouddbuser'@'localhost' identified by 'password';

Flush the privileges and exit from the MySQL shell.



Configure SELinux to allow OwnCloud to write the data or disable SELinux permanently.

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data'
restorecon '/var/www/html/owncloud/data'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config'
restorecon '/var/www/html/owncloud/config'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'
restorecon '/var/www/html/owncloud/apps'

If you get an error for semanage command not found, then.

READ: semanage command not found on CentOS 7/6 & RHEL 7/6 – Quick Fix


Configure the firewall to allow access to the ownCloud from external machines.


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


iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
service iptables save

Setup ownCloud

Open up a web browser, point it to the below URL. The browser will take you to ownCloud setup page where it must be configured before going to live.


Enter admin user name, password, data folder location and database details.

You can choose either SQLite or MySQL/MariaDB to install ownCloud. If you decide SQLite database, you do not have to enter database details. But, using SQLite in a larger environment is not recommended.

So, we will use MariaDB here. Enter the MySQL/MariaDB database details in the below page.

Install ownCloud 10 on CentOS 7 - ownCloud Setup Page
Install ownCloud 10 on CentOS 7 – ownCloud Setup Page

Once the setup of ownCloud is complete, the web installer will take you to the ownCloud login page. Log in with your username and password you have just created in the previous step.

Install ownCloud 10 on CentOS 7 - ownCloud Login Page
Install ownCloud 10 on CentOS 7 – ownCloud Login Page

ownCloud offers official clients for Windows, Linux, Anroid, and iOS to keep documents sync across your devices.


Install ownCloud 10 on CentOS 7 - ownCloud Apps
Install ownCloud 10 on CentOS 7 – ownCloud Apps

The portal of ownCloud will look like below. You can start uploading the documents and files using + Sign button.

Install OwnCloud 10 on CentOS 7 - Upload Files
Install OwnCloud 10 on CentOS 7 – Upload Files


Yoy may get the below error message, in case you have changed an IP address of ownCloud server or the domain name you use to access the ownCloud.

You are accessing the server from an untrusted domain.
Please contact your administrator. If you are an administrator of this instance, configure the "trusted_domains" setting in config/config.php. An example configuration is provided in config/config.sample.php.

To resolve the issue, you need to modify the config/config.php file.

vi /var/www/html/owncloud/config/config.php

Add the trusted domains shown like below.

'trusted_domains' =>
  array (
    0 => '',
    1 => 'owncloud.itzgeek.local',
    2 => 'your.fq.dn',

That’s All.

Further Reading

You might also like