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.

Features

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.

Prerequisites

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 https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

### CentOS 6 / RHEL 6 ###

rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -ivh https://mirror.webtatic.com/yum/el6/latest.rpm

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 https://download.owncloud.org/download/repositories/production/CentOS_7/repodata/repomd.xml.key

### CentOS 6 ###

rpm --import https://download.owncloud.org/download/repositories/production/CentOS_6/repodata/repomd.xml.key

### RHEL 7 ###

rpm --import https://download.owncloud.org/download/repositories/production/RHEL_7/repodata/repomd.xml.key

### RHEL 6 ###

rpm --import https://download.owncloud.org/download/repositories/production/RHEL_6/repodata/repomd.xml.key

Add the ownCloud repository on your system

### CentOS 7 ###

cd /etc/yum.repos.d/
wget http://download.owncloud.org/download/repositories/production/CentOS_7/ce:stable.repo

### CentOS 6 ### 

cd /etc/yum.repos.d/ 
wget http://download.owncloud.org/download/repositories/production/CentOS_6/ce:stable.repo

### RHEL 7 ### 

cd /etc/yum.repos.d/ 
wget http://download.owncloud.org/download/repositories/production/RHEL_7/ce:stable.repo

### RHEL 6 ###

cd /etc/yum.repos.d/
wget http://download.owncloud.org/download/repositories/production/RHEL_6/ce:stable.repo

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.

FLUSH PRIVILEGES;
exit

SELinux

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

Firewall

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

FirewallD:

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

IPTables:

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.

http://your.ip.add.ress/owncloud

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

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

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

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

Extra

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 => '192.168.1.10',
    1 => 'owncloud.itzgeek.local',
    2 => 'your.fq.dn',
  ),

That’s All.

centos 6centos 7cloudowncloudstorage
Comments (9)
Add Comment
  • Rafael

    Hello Raj, first of all, thank you very much for doing this tutorial. Now, I’m fairly new to CentOS but I’m trying to install OwnCloud on a VM with CentOS on it. My concern is that it won’t let me run the yum command to try to install MariaDB, it says it had an error downloading packages and there are no more mirrors left to try. Would you happen to know the reason behind this? And/or recommend me a tutorial for trying to fix it? Thank you very much in advance.

    • ITzGeek Web

      If you are using VMware workstation, set your network card of VM in NAT so that you can get internet from the host machine

    • Andrei Popa

      This may be to late but just in case someone finds this useful, you can use either NAT or Bridged mode as long as you configured the IP correctly. Just don’t forget to setup the DNS too. I use google DNS 8.8.8.8 / 8.8.4.4 in all my network configs and I haven’t ran into any issues with yum not being able to connect to repos.

      Regards.

  • Andrei Popa

    Thank you for the guide. One of the few to include Selinux in the process.

    Regards.

  • Neale

    If I installed Owncloud in a Centos7 virtual machine (say VM internal IP 192.168.122.10) in a Centos7 host, how can the outside world access the Owncloud (http://192.168.122.10/owncloud) ?

  • fraber

    I got problems with “yum install owncloud-postgresql”, I get “Error: … Requires: owncloud=8.0.10-1.el7, Installed: owncloud-8.1.5-15.1.noarch …”. So I guess the repository you mentioned above has some faulty dependeny? Unfortunately there is no –force in yum. Any idea how to fix this?

  • Brian Cowden

    Anyone who is looking to install ownCloud on an Ubuntu server may find this article useful: