How to Install ownCloud on CentOS 7

ownCloud is an open source software which allows us to set up our private ‘file-hosting’ cloud or we can say ‘cloud storage’ over the network. Data hosted in ownCloud can be access at any time either via web browsers or desktop client or may be via smart phone aaps.

Some of the important features of ownCloud are listed below :

owncloud-features

In this article we will install latest version of ownCloud 10.3 on CentOS 7. Hostname and ip address of my CentOS 7 machine is “owncloud.linuxtechi.com” & “192.168.1.101″

Following are the prerequisites for ownCloud.

  • PHP 7 ( or higher version)
  • Apache Web Server ( Apache )
  • Database Server ( MariaDB or SQLite or Oracle or PostgreSQL )

Step:1 Install PHP and Web Server (HTTPD)

Enable the epel and remi repository first using following commands,

[root@owncloud ~]# yum install epel-release yum-utils -y
[root@owncloud ~]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
[root@owncloud ~]# yum-config-manager --enable remi-php72

Use below yum command to install php and apache web server (httpd) and other PHP dependencies.

[root@owncloud ~]# yum install httpd php php-mysql php-intl sqlite php-dom php-mbstring php-gd php-pdo php-json php-xml php-zip php-gd curl php-curl php-mcrypt php-pear -y

Start the Web Server service

[root@owncloud ~]# systemctl start httpd
[root@owncloud ~]# systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
[root@owncloud ~]#

Step:2 Install and Configure Database for ownCloud.

In CentOS 7 MariaDB is the default database server.

[root@owncloud ~]# yum install mariadb-server mariadb -y

Start the Database Service

[root@owncloud ~]# systemctl start mariadb.service
[root@owncloud ~]#
[root@owncloud ~]# systemctl enable mariadb.service
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
[root@owncloud ~]#

Set the Root password and other database parameters using below command :

[root@owncloud ~]# mysql_secure_installation

Create the database (owncloud_db).

[root@owncloud ~]# mysql -u root -p
Enter password:

MariaDB [(none)]> create database owncloud_db;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>

Create a database user(dbuser) and grant all the privileges on the database (owncloud_db)

MariaDB [(none)]> grant all on owncloud_db.* to 'dbuser'@'localhost' identified by 'Owncloud@123#';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye
[root@owncloud ~]#

Step:3 Install ownCloud package using yum command.

ownCloud Package is not available in the default yum repositories so we will set below EPEL and ownlcoud repositories.

[root@owncloud ~]# rpm --import https://download.owncloud.org/download/repositories/stable/CentOS_7/repodata/repomd.xml.key
[root@owncloud ~]# curl -L https://download.owncloud.org/download/repositories/stable/CentOS_7/ce:stable.repo -o /etc/yum.repos.d/ownCloud.repo
[root@owncloud ~]# yum clean expire-cache
[root@owncloud ~]# yum install owncloud-files -y

Allow Web Server’s port in the OS(Operating System) firewall.

[root@owncloud ~]# firewall-cmd --permanent --zone=public --add-service=http
success
[root@owncloud ~]# firewall-cmd --permanent --zone=public --add-service=https
success
[root@owncloud ~]# firewall-cmd --reload
success
[root@owncloud ~]#

Set the required permissions on ownlcoud folder “/var/www/html/owncloud

[root@owncloud ~]# chown -R apache.apache /var/www/html/owncloud/
[root@owncloud ~]#

Set the below SELinux Rules if SELinux is enabled on your system

[root@owncloud ~]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data'
[root@owncloud ~]# restorecon '/var/www/html/owncloud/data'
[root@owncloud ~]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config'
[root@owncloud ~]# restorecon '/var/www/html/owncloud/config'
[root@owncloud ~]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'
[root@owncloud ~]# restorecon '/var/www/html/owncloud/apps'
[root@owncloud ~]#

Step:4 Start ownCloud Installation from the Browser.

To start the ownCloud installation open the web browser and type :

http://192.168.1.101/owncloud/

Replace the ip address as per your setup.

Specify the User name as ‘admin’ and give password that you want set for admin user. Data Folder as ‘/var/www/html/owncloud/data’ and Database name (owncloud_db) and database user (dbuser) credentials that we created in above steps.

ownCloud-installation-scree

Click on ‘Finish setup’

Files-ownCloud-CentOS7

Get ownCloud Clients and aaps to sync your data.

Home Page of Our ownCloud will look like below.

Home-Page-ownCloud

Installation and Configuration of ownCloud is completed. Now upload data and share it among users.

By Default only 513MB data file can be uploaded in case you want to change this limit , edit the file ‘/var/www/html/owncloud/.htaccess‘ and set the limit as per requirement.

maximum-upload-limit-owncloud

1 thought on “How to Install ownCloud on CentOS 7”

  1. Hi thanks for that, but is there any update to that one ? As all need to be https now . so a owncloud install with nginx with letsencrypt can be very great.
    Thanks in advance

Leave a Comment

Your email address will not be published. Required fields are marked *