Installing Owncloud 10.0.3 on Debian 9

11/18/2017


Install apache2

apt-get install apache2

Install php and addons needed for owncloud 10.0.3

apt-get install php php-mysql php-zip php-xml php-mbstring php-gd php-curl

Install MYsql server

apt-get install mysql-server

Change ocuser and ocpass to a username and password that you want for your owncloud database

mysql -e "CREATE DATABASE owncloud;"
mysql -e "GRANT ALL PRIVILEGES ON owncloud.* TO 'ocuser'@'localhost' IDENTIFIED BY 'ocpass';"
mysql -e "FLUSH PRIVILEGES;"
mysql_secure_installation

Install Owncloud Files

wget -nv https://download.owncloud.org/download/repositories/production/Debian_9.0/Release.key -O Release.key
apt-key add - < Release.key
echo 'deb http://download.owncloud.org/download/repositories/production/Debian_9.0/ /' > /etc/apt/sources.list.d/owncloud.list
apt-get update
apt-get install owncloud-files

Securing Owncloud

Set proper permissions for 'data' folder

chown -R www-data:www-data /var/www/owncloud/
Fix .htaccess file

/var/www/owncloud/data

chmod 664 .htaccess
Add the following to your apache website config file.

<Directory "/var/www/owncloud">
AllowOverride All
# Allow open access:
Require all granted
</Directory>
      

Syncing owncloud files using rsync


Setup Rsync

I have 2 server that I want to sync data. I want to sync server 1 to server 2.

Server 1: 123.123.123.123 - VPS
Server 2: 321.321.321.321 - Home Server

Setup keygen and move the key to (Server 1)

Server 2

ssh-keygen
ssh-copy-id [email protected]

Install rsync on both servers.

apt-get install rsync

Start Rsync on Server 2 / To copy data form Server 1

rsync -avrt --rsh='ssh -p 22' [email protected]:/var/www/owncloud/data/sesipod/files/ /var/www/owncloud/data/sesipod/files

Re-scan all user folders

cd /var/www/owncloud
sudo -u www-data php occ files:scan --all