in Development

Setting Up ownCloud on Speed

Use this quick copy-and-paste guide to setup owncloud with SSL on Ubuntu 14.04.

The following setup was tested with digital ocean. Only use digital ocean as development environment as several US laws contradict european law. I suggest not to use IaaS-environments altogether. There is no server trustworthy but your own.

#======================#
#   Install ownCloud   #
#======================#

echo "This is not a script. There are steps you have to do manually."
exit

# sudo -i
# apt-get install lynx
# lynx https://www.digitalocean.com/community/tutorials/how-to-install-owncloud-and-configure-owncloud-apps-on-an-ubuntu-12-04-vps

cd
sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud.list"
curl -O http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_14.04/Release.key
apt-key add - < Release.key  
apt-get update
apt-get -y install owncloud mysql-server php5-intl php5-curl
# sudo mysql_install_db
mysql_secure_installation
mysql -u root -p
CREATE DATABASE owncloud;
GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'THIS IS MY PASSPHRASE';
FLUSH PRIVILEGES;
exit

# Test if owncloud is working. Open browser and go to /owncloud

hostname <YOUR FQD>
# owncloud disallows access from non-hostname domains. To enable additional domains, edit line config.php as follows
# 'trusted_domains' => array('domain1.mydomain.tld', 'domain2.mydomain.tld'),


#==========================#
#   Add SSL Key and Cert   #
#==========================#

man genrsa
man req
man x509

cd /etc/ssl/private
openssl genrsa -out my.key 4096
# For self signed keys, outcomment the next line
# openssl req -new -x509 -days 365 -key my.key -out myca.crt
openssl req -new -key my.key -out myrequest.csr
# For self signed keys, outcomment the next line
# openssl x509 -req -days 365 -in myrequest.csr -CA /usr/local/share/ca-certificates/myca.crt -CAkey /etc/ssl/private/my.key -out mysigned.crt
mv mysigned.crt /usr/local/share/ca-certificates/
# download the intermediate and root certificate of your cert-authority and copy them to /usr/local/share/ca-certificates/mychain.crt
vim /etc/apache2/sites-available/default-ssl.conf
# edit: SSLCertificateFile /usr/local/share/ca-certificates/mysigned.crt
# edit: SSLCertificateKeyFile /etc/ssl/private/my.key
# edit: SSLCertificateChainFile /usr/local/share/ca-certificates/mychain.crt
a2ensite default-ssl
a2enmod ssl
service apache2 restart

Last but not least, visit your owncloud-installation. Go to admin and force https.