ownCloud on Debian 8 (Jessie)

This how-to will cover setting up an instance of ownCloud on Debian 8 using MySQL as the database and the Apache webserver
Not covered in this how-to: opening ports in the firewall.

Set up the ownCloud Debian 8 repository:

echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_8.0/ /' >> /etc/apt/sources.list.d/owncloud.list
wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_8.0/Release.key -O- | apt-key add -

Install ownCloud and its dependencies (apache2, mysql, php-* etc…):

apt-get update
apt-get -y install owncloud

Configure MySql:


(Optional) Move valid cert and key to /etc/ssl/
You can get free SSL Certificates here: https://startssl.com/

mv owncloud.crt.pem /etc/ssl/certs/
mv owncloud.key.pem /etc/ssl/private/
chown root:ssl-cert /etc/ssl/private/owncloud.key.pem
chmod 640 /etc/ssl/private/owncloud.key.pem
chown root:root /etc/ssl/certs/owncloud.crt.pem
chmod 644 /etc/ssl/certs/owncloud.crt.pem

Create a new site config with a VirtualHost:
Note: Replace the IP address and domain name with whatever domain and IP you are using.

echo '<IfModule mod_ssl.c>
		ServerName owncloud.domain.com
		ServerAdmin webmaster@domain.com
		DocumentRoot /var/www/owncloud/
		ErrorLog ${APACHE_LOG_DIR}/owncloud.domain.com_error.log
		CustomLog ${APACHE_LOG_DIR}/owncloud.domain.com_access.log combined
		SSLEngine on
		SSLCertificateFile      /etc/ssl/certs/owncloud.crt.pem
		SSLCertificateKeyFile /etc/ssl/private/owncloud.key.pem
		<FilesMatch "\.(cgi|shtml|phtml|php)$">
			SSLOptions +StdEnvVars
		<Directory /usr/lib/cgi-bin>
			SSLOptions +StdEnvVars
		BrowserMatch "MSIE [2-6]" \
			nokeepalive ssl-unclean-shutdown \
			downgrade-1.0 force-response-1.0
		BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</IfModule>' > /etc/apache2/sites-available/owncloud.domain.com.conf

Enable the site, the ssl module and reload apache2:

a2ensite owncloud.domain.com.conf
a2enmod ssl
systemctl reload apache2.service

Note: I recommend setting up up strong SSL security on Apache.

Open ownCloud in a browser, and follow the initial setup instructions using MySQL as a database:
owncloud initial setup

ownCloud on Debian 8 (Jessie)