$ sudo curl https://download.owncloud.org/download/repositories/stable/Debian_9.0/Release.key | sudo apt-key add -
# $ sudo curl https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.key | sudo apt-key add -
. . .
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1358 100 1358 0 0 2057 0 --:--:-- --:--:-- --:--:-- 2057
OK
$ echo 'deb https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /' | sudo tee /etc/apt/sources.list.d/owncloud.list
deb https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/ /
$ sudo apt-get update
W: https://download.owncloud.org/download/repositories/stable/Ubuntu_16.04/Release.gpg: Signature by key DDA2C105C4B73A6649AD2BBD47AE7F72479BC94B uses weak digest algorithm (SHA1)
$ sudo apt-get install owncloud-files
# install php5 modules
$ sudo apt-get install php7.0-zip php7.0-intl php7.0-gd
# psql
$ sudo apt-get install postgresql
$ su - postgres
$ psql
postgres=# CREATE DATABASE owncloud;
CREATE DATABASE
postgres=# CREATE USER ocuser WITH PASSWORD 'your_password';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE owncloud to ocuser;
GRANT
postgres=# \q
$ nano /etc/apache2/sites-available/owncloud.conf
</etc/apache2/sites-available/owncloud.conf>
<VirtualHost *:80>
# ServerAdmin admin@example.com
DocumentRoot /var/www/owncloud/
# ServerName example.com
# ServerAlias www.example.com
ServerName localhost
# Alias /owncloud "/var/www/owncloud/"
<Directory /var/www/owncloud/>
Options +FollowSymlinks
AllowOverride All
Require all granted
<IfModule mod_dav.c>
Dav off
</IfModule>
SetEnv HOME /var/www/owncloud
SetEnv HTTP_HOME /var/www/owncloud
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$ a2ensite owncloud.conf; a2enmod rewrite; a2enmod headers; a2enmod env; a2enmod dir; a2enmod mime
$ systemctl restart apache2.service