HOW TO INSTALL ownCloud ON CentOS7

ownCloud is the open source project that can be used to securely exchange the files. The ownCloud 10.0.7 requires the following prerequisites:

  • PHP 7.0 or above with the following extenstion(XML, curl, ctype, JSON, iconv, intl, mcrypt, PDO, Phar, GD Graphics Library version 2.0.x+, DOM, openssl, bz2, Zlib and Zip.)
  • MySQL 5.5 or above version
  • Apache web server 2.0
  1. Update the OS Packages

    yum update -y
  2. Now install PHP 7.1 install using the following command

Install EPEL and Remi repository packages:

https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php71

Install PHP7.1 and required PHP extension which is required for owncloud using the following command

yum install php php-mysqlnd php-pecl-zip php-xml php-mbstring php-gd php-mcrypt php-pear php-pspell php-pdo php-xml php-intl php-zip php-zlib

Extension

  1. Open the PHP configuration file and increase the upload file size.

    vi /etc/php.ini

Change post_max_size to 256 MB and upload_max_filesize to 256MB and save the file.

We can set the post_max_size and upload_max_filesize as per the need

Restart the httpd service after the change

systemctl restart httpd.service
  1. Download ownCloud and extract it using the following command.

    cd /opt && wget https://download.owncloud.org/community/owncloud-10.0.7.zip

Download_owncloud

Extract the downloaded file.

unzip -d /var/www/html/ owncloud-10.0.7.zip

Now change the permissions of owncloud directory.

chown apache:apache -R /var/www/html/owncloud/
  1. Create a new MySQL database

    mysql -u root -p
    mysql> CREATE DATABASE ownclouddb;
    mysql> GRANT ALL PRIVILEGES ON ownclouddata.* TO 'ownclouduser'@'localhost' IDENTIFIED BY 'enter your password' WITH GRANT OPTION;
    mysql> FLUSH PRIVILEGES;
    mysql> exit
  2. Create a new virtual host in Apache.

    touch /etc/httpd/conf.d/owncloud.conf
    vi /etc/httpd/conf.d/owncloud.conf

And, paste the following lines and enter your server IP address and save the file:

<VirtualHost YOUR_SERVER_IP:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/html/owncloud/"
<Directory "/var/www/html/owncloud/">
DirectoryIndex index.html index.php
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
  1. Create a new ownCloud ownClouddata directory outside of the document root and change the permission of it:

    mkdir -p /opt/data
    chown apache:apache -R /opt/ownClouddata/

Restart the Apache web server for the changes to take effect:

systemctl restart httpd.service
  1. Open the port in firewall using following command:

    firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --reload

Set SELinux mode to permissive:

Run the following command:

Enforcing 0 

And change the mode in file

vi /etc/selinux/config:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
  1. Now type your IP address in the URL to complete the ownCloud installation

    http://your IP address:80

You will have to create admin account for ownCLoud Enter the username and password which you want to set. ownCloud

Now click on the Storage and database and select MySQL/MariaDB

Fill the database information and click on the Finish setup button. ownClouddb