Google Cloud Compute Engine

Install ownCloud on Ubuntu 18.04 with Let’s Encrypt- Google Cloud

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

Install ownCloud on Ubuntu 18.04 – Google Cloud. ownCoud is an open-source, self-hosted file syncing and file sharing collaboration platform, similar to OneDrive, Google Drive and others.

OwnCloud has free desktop client and the free ownCloud app, you can access your photos, documents and films at any time from any where. It keeps your files synced and always up-to-date.

This tutorial is tested on Google Cloud Platform with the following infrastructure setup.

  • Compute Engine VM Instance: (1.75 GB RAM with SSD 10 GB).
  • Cloud SQL 2nd Generation Instance: 614 MB RAM with MySQL 5.7

So this setup runs fine on other cloud platforms like AWS, Azure or any VPS or any Dedicated servers running Ubuntu 18.04.


Step 1: Install Apache

Apache2 is available by default in the Ubuntu repository, so you can install it directly using the apt command.

sudo apt install apache2

This will install apache2 and all required dependencies.

Step 2: Setup Firewall

Now you can set up Uncomplicated Firewall (UFW) with Apache to allow public access on default web ports for HTTP and HTTPS

sudo ufw app list

You will see all listed applications.

Available applications:
Apache Full
Apache Secure
sudo ufw allow 'Apache Full'

With this command you can view the status of UFW.

sudo ufw status

You will see the output as follows.

Status: active
To Action From
-- ------ ----
Apache Full ALLOW Anywhere
OpenSSH ALLOW Anywhere
Apache Full (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)

Step 3: Configure Apache

Once Apache is installed is is started automatically and already be up and running.

Every process in Apache is managed with the systemctl command. Check the status of Apache with the following command.

sudo systemctl status apache2

Step 4: Install PHP 7.3

Here we will install PHP 7.3 the current supported version for ownCloud. Add the ondrej/php which has PHP 7.3 package and other required PHP extensions.

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Once you have added the PPA you can execute the following command to install PHP 7.3.

sudo apt install php7.3 libapache2-mod-php7.3 openssl php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl php7.3-gd php7.3-imagick php7.3-dev php7.3-imap php7.3-mbstring php7.3-zip php7.3-intl php7.3-json php-ssh2 php-apcu php-redis redis-server unzip mysql-client -y

Step 5: Configure PHP 7.3 for ownCloud

Now we configure PHP for Web Applications by changing some values in php.ini file.

For PHP 7.3 with Apache the php.ini location will be in following directory.

sudo nano /etc/php/7.3/apache2/php.ini

Hit F6 for search inside the editor and update the following values for better performance.

upload_max_filesize = 64M 
post_max_size = 64M 
memory_limit = 256M 
max_execution_time = 600 
max_input_vars = 5000 
max_input_time = 1000

Once you have modified your PHP settings you need to restart your Apache for the changes to take effect.

Step 6: Download ownCloud

Now you can download latest ownCloud package from the official website using the wget command.


Once the download is completed you can extract the zip file inside the /var/www/html directory using the following command.

sudo unzip  -d /var/www/html

Now ownCloud will be located inside this directory /var/www/html/owncloud

Now you need to setup correct permissions.

sudo chmod -R 755 /var/www/html/owncloud
sudo chown -R www-data:www-data /var/www/html/owncloud

Step 7: Configure Apache for ownCloud

Disable default Apache configuration.

sudo a2dissite 000-default

Create a new virtual host configuration.

sudo nano /etc/apache2/sites-available/owncloud.conf

Paste the following configurations in the new file.

<VirtualHost *:80>
     ServerAdmin [email protected]

     DocumentRoot /var/www/html/owncloud

     <Directory /var/www/html/owncloud>
         Options Indexes FollowSymLinks
         AllowOverride All
         Require all granted

     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 

Enable the new configuration.

sudo a2ensite domainname.conf

Step 8: Install Let’s Encrypt SSL

HTTPS is a protocol for secure communication between a server (instance) and a client (web browser). Due to the introduction of Let’s Encrypt, which provides free SSL certificates, HTTPS are adopted by everyone and also provides trust to your audiences.

sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt install python-certbot-apache

Now we have installed Cert bot by Let’s Encrypt for Ubuntu 18.04, run this command to receive your certificates.

sudo certbot --apache --agree-tos --redirect -m [email protected] -d -d

Select the appropriate option and hit Enter

This command will install Free SSL, configure redirection to HTTPS and restarts the Apache server.

Step 9: Renewing SSL Certificate

Certificates provided by Let’s Encrypt are valid for 90 days only, so you need to renew them often. So, let’s test the renewal feature using the following command.

sudo certbot renew --dry-run

This command will test the certificate expiry and configures the auto-renewable feature.

Now you are ready to install ownCloud from your web interface.

Step 10: Install ownCloud

Once all the above setup is done, go to your web browser and enter your domain name. You should see the welcome page to create a new account and setup database.

Install ownCloud

Enter the appropriate details of your CloudSQL connection details and click Finish setup.

Wait for sometime for the setup to complete.

Once the installation is done you can login using the credentials you set and start using ownCloud.

ownCloud Dashboard

Get your Professional Google Cloud Architect certificate with this easy to learn course now.


Now you have learned how to install ownCloud on Ubuntu 18.04 with PHP 7.3 and secure the installation using Let’sEncrypt SSL certificate.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.