201-340-9101 [email protected]

Setting up ownCloud can be very tricky. Below are the steps involved in setting up ownCloud on Centos7.

Credits given to https://www.marksei.com/install-owncloud-10-server-centos/

This guide assumes you already have centos 7 installed.

 

1.  Add the repositories & Install packages

We first need to be able to install ownCloud and update php to version 7.0 by opening a terminal and typing the following:

yum install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install httpd php70w php70w-dom php70w-mbstring php70w-gd php70w-pdo php70w-json php70w-xml php70w-zip php70w-curl php70w-mcrypt php70w-pear setroubleshoot-server
rpm --import https://download.owncloud.org/download/repositories/10.0/CentOS_7/repodata/repomd.xml.key
curl https://download.owncloud.org/download/repositories/10.0/CentOS_7/ce:10.0.repo | tee /etc/yum.repos.d/owncloud_CE:10.0.repo
yum install php70w-intl.x86_64
yum install owncloud

2.  Setup MySQL & Create the database

Now we can install and setup MySQL which is the backend database used for ownCloud. There are many other options but MySQL is very easy to get started with:

yum install mariadb-server php70w-mysql
systemctl start mariadb
mysql_secure_installation

Now setup your sql user’s password and follow the prompts.

This next part will set the service to start and be enabled at boot:

systemctl start mariadb
systemctl enable mariadb

Now we need to open the SQL cli. Use your password that you just created to connect and we will create the database, create the user, and give rights to the user for the database;

mysql -u root -p
CREATE DATABASE owncloud;
CREATE USER 'oc_user'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD_HERE';
RANT ALL PRIVILEGES ON owncloud.* TO 'oc_user'@'localhost';
FLUSH PRIVILEGES;

3.  Setup Apache & SELinux

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.htaccess'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/.user.ini'
restorecon -Rv '/var/www/html/owncloud/'
setsebool -P httpd_can_network_connect_db 1

4.  Configure FirewallD

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