How to install OwnCloud 10 on CentOS 7 and RHEL 7

OwnCloud is like having a personal cloud only for your storage requirements. It is much more like Dropbox like system that allows you to store and sync all your files over the network. You can use either a standalone client or a simple web interface to access your files on your cloud. You can access your files anytime you need and from anywhere you want. OwnCloud is available for free but includes all the features that you may find on commercial cloud storage systems. And there is even a commercial version available. In this article, we’ll take a look about how to install OwnCloud 10 on Cent OS 7 and RHEL 7.

Important Features

  • Great alternative to Dropbox in terms of file storage
  • Access files using web interface or standalone interface
  • Versioning of files is maintained, so you can even get the first version of the file uploaded
  • Easily synchronize your local folders with OwnCloud
  • Download the Owncloud standalone client freely for Windows, Linux and Mac OSX
  • Apps for Android and iOS also available to access OwnCloud from your mobile phone
  • Supports multiple users
  • Share files with other users on the same server
  • Encryption and Security
  • Activity Feed
  • Calendars and Contacts
  • Collaborative Editing

Prerequisites to Install OwnCloud

To install OwnCloud 10 on CentsOS 7 and RHEL 7, you need to have the following prerequisites:

  • Redhat software collection repository enabled (only for RHEL 7)
  • EPEL repository enabled
  • Apache server and PHP extensions installed
  • MariaDB installed

Note: in this tutorial, IP address of my machine is 192.168.0.107 and Hostname is set as “ownlcoud10.linuxbuzz.com”  and for local dns entry I have update the below entry in /etc/hosts file,

192.168.0.107   owncloud10.linuxbuzz.com       owncloud10

Now let’s see how to enable / install these,

To enable Redhat software collection repository in RHEL7, use the following command:

[[email protected] ~]# subscription-manager repos --enable rhel-server-rhscl-7-eus-rpms

Note : If you have Centos 7 server then no need to run above subscription-manager command,

Use below command to enable EPEL repository and yum utils ,

[[email protected] ~]# yum install epel-release yum-utils -y

Owncloud is only compatible with PHP 5.6 and above so we will be using latest version of PHP 7.2, refer below commands to install it along with its core-components

[[email protected] ~]# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
[[email protected] ~]# yum-config-manager --enable remi-php72

Now Install Apache Web Server along with PHP 7.2 using following yum command

[[email protected] ~]# yum install httpd php php-mysql php-dom php-mbstring php-gd php-pdo php-json php-xml php-zip php-curl php-mcrypt php-pear php-intl setroubleshoot-server -y

Let’s install the database server as “MariaDB”, use the following command:

[[email protected] ~]# yum install wget mariadb-server mariadb -y

Setup ownCloud 10 Repository

Import the Owncloud Signing Key

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

Use the following command to download the signing key on CentOS 7

[[email protected] ~]# rpm --import https://download.owncloud.org/download/repositories/production/CentOS_7/repodata/repomd.xml.key

Use the following code to download the signing key on RHEL 7

[[email protected] ~]# rpm --import https://download.owncloud.org/download/repositories/production/RHEL_7/repodata/repomd.xml.key

Add the Owncloud 10 Repository in your system

Use the following commands to add it on CentOS 7

[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# wget http://download.owncloud.org/download/repositories/production/CentOS_7/ce:stable.repo

Use the following code to add it on RHEL 7

[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] ~]# wget http://download.owncloud.org/download/repositories/production/RHEL_7/ce:stable.repo

Install Owncloud 10 in your system

Now we’ll be using the yum command to install the OwnCloud Package

[[email protected] ~]# yum install owncloud -y

Set the required permissions on  ownCloud directory

[[email protected] ~]# chown -R apache.apache /var/www/html/owncloud/

Use the following commands to start and enable Apache and database service,

[[email protected] ~]# systemctl start httpd
[[email protected] ~]# systemctl start mariadb
[[email protected] ~]# systemctl enable httpd
[[email protected] ~]# systemctl enable mariadb

Create Database for ownCloud

As of now we have freshly installed mariadb server and did not set its root password, run beneath command to set root password, remove test database, Remove anonymous users and disable remote root login,

[[email protected] ~]# mysql_secure_installation

Now you need to create a database, so login to your MYSQL server and run the following command first:

[[email protected] ~]# mysql -u root -p

Now use the following command to create a database called as “owncloud10db

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

Now grant the “clouddbuser” permission to access the “owncloud10db” database with a password you specify on localhost

MariaDB [(none)]> grant all on owncloud10db.* to 'clouddbuser'@'localhost' identified by '{Passwd-here}';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>

Now flush all privileges and time to exit from the MYSQL

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
[[email protected] ~]#

SELinux and Firewall Rules for OwnCloud

Security Enhanced Linux or SELinux is a kernel security module that supports access control mechanism. If SELinux is enabled on you server then write the following selinux rules for owncloud, else you can skip this step

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

In Case OS Firewall is enabled and configured on your server then allow http and https ports using following firewall-cmd command,

[[email protected] ~]# firewall-cmd --permanent --add-service=http
success
[[email protected] ~]# firewall-cmd --permanent --add-service=https
success
[[email protected] ~]# firewall-cmd --reload
success
[[email protected] ~]#

Now Setup ownCloud using Installation wizard

Now it is time to configure your Owncloud. To do that go to the following URL

http://<Your-Server-Ip-address>/owncloud

Owncloud10-Datadirectory-CentOS7

Owncloud10-DB-Details-CentOS7

Provide your user name, password, database information and the Owncloud folder details. Once you provide all the details required, Click on “Finish Setup” and then installer will automatically redirects you to OwnCloud Login Page

ownCloud-Login-Page-CentOS7

Once you are authenticated successfully you will get owncloud dashboard something like below

ownCloud-Dashboard-CentOS7

This confirms that our owncloud has been installed successfully and now start sharing files whenever you need. Please share your feedback and comments in the comments section below.

Leave a Reply

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

five × five =