How To Install ownCloud 10.5 on Ubuntu 20.04

ownCloud first coming as an alternative to Dropbox, Google Drive, etc. ownCloud is self hosted ‘cloud’ application that you can manage, the storage and speed depend on the hardware it installed on.

It’s similiar to file manager on cloud, which had client for Windows, MacOS, Linux, Android and iOS. For power user it had API which can used to integrated with other application or make your own.

In this tutorial we’ll start from fresh install Ubuntu 20.04, it’s beginner friendly tutorial which for most case you can just copy and paste except the domain name part. Please let us know if you had any question, we’ll talk later about scaling the ownCloud in production environment.

Install PHP

Install PHP directly from Ubuntu 20.04 repository.

sudo apt-get install php php-gd php-xmlrpc php-fpm php-curl php-intl php-imagick php-mysql php-zip php-xml php-mbstring php-bcmath -y

Install NGINX

Install latest available nginx versin from Ubuntu 20.04 repository.

sudo apt install nginx -y

Setup SSL Lets Encrypt

Let’s setup the SSL from Lets Encrypt, using acme.sh as the client

acme.sh --issue -d owncloud.EXAMPLE.com --standalone

lets encrypt ssl done

Install MariaDB Database

Install MariaDB from repository

sudo apt install mariadb-server -y

Create a database and user for ownCloud
1. Create Database

CREATE DATABASE owncloud;

2. Create User

GRANT ALL PRIVILEGES ON owncloud.* TO "owncloud"@"localhost" IDENTIFIED BY "SECURE-PASSWORD";

create owncloud database and user

Download ownCloud

Move to /var/www/html directory

cd /var/www/html/

Download the latest version of ownCloud, currently 10.5

wget https://download.owncloud.org/community/owncloud-complete-20200731.tar.bz2 https://download.owncloud.org/community/owncloud-complete-20200731.tar.bz2.sha256

to verify the file not corrupted or tampered by

sha256sum -c owncloud-complete-20200731.tar.bz2.sha256 2>&1 | grep OK

if that show OK nothing wrong with the files, it otherwise re-download the owncloud.
owncloud not tampered with anything

Extract the owncloud-complete-20200731.tar.bz2 file and rename the folder to owncloud.EXAMPLE.com

tar jxvf owncloud-complete-20200731.tar.bz2
mv owncloud owncloud.EXAMPLE.com

Set read and write permission for www-data user, an default nginx user in Ubuntu 20.04

chown www-data:www-data -R /var/www/html/owncloud.EXAMPLE.com

Install ownCloud from CLI

I love this feature a lot, because we can setup everything without visiting the URL, it can be automated in easy way using shell script.

sudo -u www-data php occ maintenance:install --database "mysql" --database-name "owncloud"  --database-user "owncloud" --database-pass "sXTHTPVJuo9zkVEAxrri" --admin-user "atetux" --admin-pass "XmN9RfvAhxA4cFhHmVHE"

Set trusted domain

sudo -u www-data php occ config:system:set trusted_domains 2 --value=owncloud.EXAMPLE.com

set trusted domain name
If you forgot to set trusted domain, ownCloud will gave warning
owncloud warning untrusted domain

ownCloud Login Page

Open https://owncloud.EXAMPLE.com on browser
owncloud login page
Login using credential we created earlier
owncloud first time login

Leave a Reply