How to Install ownCloud on CentOS 7

Channel: Linux
Abstract: [[email protected] ~]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'2 Install and Configure Database for ownCloud. In C

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 :

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,

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

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

[[email protected] ~]# 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

[[email protected] ~]# systemctl start httpd
[[email protected] ~]# systemctl enable httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'
[[email protected] ~]#
Step:2 Install and Configure Database for ownCloud.

In CentOS 7 MariaDB is the default database server.

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

Start the Database Service

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

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

[[email protected] ~]# mysql_secure_installation

Create the database (owncloud_db).

[[email protected] ~]# 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 '[email protected]#';
Query OK, 0 rows affected (0.00 sec)

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

MariaDB [(none)]> exit
Bye
[[email protected] ~]#
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.

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

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

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

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

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

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

[[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'
[[email protected] ~]#
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.

Click on ‘Finish setup’

Get ownCloud Clients and aaps to sync your data.

Home Page of Our ownCloud will look like below.

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.

Ref From: linuxtechi
Channels: cloud storage

Related articles