Mail server

How to deploy ownCloud on Ubuntu Server 20.04

Image: sigoisette/Getty Images

OwnCloud was one of the first on-premises cloud solutions and is still going strong today. This cloud/collaboration platform can be easily deployed on your internal data center or on a third-party cloud host and can serve multiple use cases. It can be used for cloud storage, team collaboration, file sharing, calendaring, and even a full cloud-based office suite.

TO SEE: Recruitment Kit: Cloud Engineer (TechRepublic Premium)

The ownCloud feature set includes:

  • Data synchronization
  • Data sharing
  • Version management
  • encryption
  • Drag-and-drop upload
  • Thematization
  • Groups
  • Activity stream
  • Android, iOS and desktop apps
  • Office 365 integration
  • Guest users

Before you think ownCloud is a challenge to install, let me dispel those fears by walking you through a deployment on Ubuntu Server 20.04.

What you will need

To successfully deploy ownCloud, you will need a running instance of Ubuntu Server 20.04 and a user with sudo privileges. That’s it. Let’s make it happen.

How to install the LAMP stack

The first thing we need to do is install the LAMP stack. Log in to your Ubuntu Server instance and run the command:

sudo apt-get install lamp-server^ -y

Once the LAMP server is installed, make sure to start and activate the Apache and MySQL servers with the following commands:

sudo systemctl enable --now apache2
sudo systemctl enable --now mysql

Next, we need to secure the MySQL installation with the command:

sudo mysql_secure_installation

You will be asked if you want to enable the PASSWORD VALIDATION COMPONENT. By enabling this feature, you require all passwords to have a certain strength. You can get around this by typing n. If you choose not to enable the feature, you should always make sure to use very strong passwords for your MySQL admin user (and all MySQL users).

Finally, answer the remaining questions there to secure the MySQL database.

How to create the ownCloud database

Next, we will create the necessary database and a user for the database. Log in to the MySQL console with:

sudo mysql -u root -p

Once in the console, create the database with:


Create the new ownCloud database user with:

CREATE USER 'ownclouduser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Grant the necessary privileges to the new database user with:

GRANT ALL PRIVILEGES ON ownclouddb.* TO 'ownclouduser'@'localhost';

Dump privileges and exit the MySQL console with:



How to install PHP

OwnCloud relies heavily on PHP, so we’ll need to install it and a number of modules with the command:

sudo apt-get install php php-opcache php-gd php-curl php-mysqlnd php-intl php-json php-ldap php-mbstring php-mysqlnd php-xml php-zip -y

Once the installation is complete, restart Apache with:

sudo systemctl restart apache2

How to download and unzip ownCloud

We will now download the latest version of ownCloud with the command:


Unzip the file with:


If the unzip command is not found, install it with:

sudo apt-get install unzip -y

Move the newly created directory with:

sudo mv owncloud /var/www/html

Change the owner of the directory with the command:

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

How to Create an Apache Configuration File

We will now create an Apache configuration file for ownCloud. Create the new file with the command:

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

In this file, paste the following (be sure to add your own admin email address and ServerName):

   ServerAdmin [email protected]
   DocumentRoot /var/www/html/owncloud
   Options FollowSymlinks
   AllowOverride All
   Require all granted

ErrorLog ${APACHE_LOG_DIR}/your-domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/your-domain.com_access.log combined

Restart Apache with:

sudo systemctl restart apache2

How to complete the installation

Open a web browser and point it to http://SERVER/owncloud (where SERVER is your server’s IP address or domain). In the resulting window (Figure A), fill in the information for a new administrator account, then add the database server details.

Figure A

The ownCloud web installer is where you install.
The ownCloud web installer is where you install.

For the database, fill in the following fields:

  • Database user–ownclouduser
  • Database password – the password you set for the owncloud user
  • Database–ownclouddb
  • Localhost–localhost

After filling in all the necessary details, click Finish setup and in less than a minute the installation will complete and you can then log in as an administrator user.

Congratulations, you now have a working ownCloud instance to use as an on-premises cloud server. If you’ve used Nextcloud before, you’ll notice some similarities, but even more differences. For example, out of the box, ownCloud does not include as many pre-installed apps as Nextcloud. To complete your deployment, you’ll want to immediately head to the market and start installing additional apps.

Subscribe to TechRepublic How to make technology work on YouTube for all the latest tech tips for professionals from Jack Wallen.