How to install and configure ownCloud on Ubuntu 18.04 LTS

With ownCloud, you can create your own private server and access the data anywhere you want.

ownCloud is an open-source file sharing server and collaboration platform. It allows controlling data on users’ servers and environments. Once configured, ownCloud provides easy access to all your data – whenever you want, wherever you want.

ownCloud Features

  • Access everything wherever you want
  • Share with anybody on your terms
  • Mobile and Desktop Syncing
  • End-to-end encryption support
  • Extensible through an Agile App framework

ownCloud is free to download and install on your private servers without paying to service providers.

In this article, we will help you install and configure ownCloud on your Ubuntu machine. This tutorial is thoroughly tested on Ubuntu 18.04 LTS.

Install ownCloud on Ubuntu 18.04 LTS

Before setting up Owncloud, you need to install Apache, PHP, and MySQL.

Step 1 – Install Apache HTTP Server

Let’s start with updating the system repositories. Launch the Terminal and enter the following command:

sudo apt-get update

Install Apache:

sudo apt-get install apache2

Generally, the Apache service starts automatically. Check the status using the command:

sudo systemctl status apache2.service

If you see the service has not started, you can start it manually using the following command.

sudo systemctl start apache2

Enable Apache On system boot.

sudo systemctl enable apache2

Allow Apache ports from the Ubuntu Firewall.

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Reload firewall and check the Firewall status.

sudo ufw reload
sudo ufw status

To check the Apache installation running status, launch the browser using hostname or server IP address.

http://hotname or IP/

If you see the Apache default page, it means everything went well.

Apache Default Page
Apache Default Page

Step 2 – Install MySQL

Let’s start with checking for available MySQL version.

sudo apt-cache policy mysql-server

As you see there is a new version available. We shall install using the command as follows:

sudo apt-get install mysql-server mysql-client

Securing MySQL installation

sudo mysql_secure_installation

You should see a prompt if you want to configure the VALIDATE PASSWORD PLUGIN. Type “Y” to yes and hit Enter to continue.

Then you should see a prompt to select a level of password validation. Select password strength and continue

Go ahead and provide a password for MySQL root user.

It should ask “Do you wish to continue with the password provided?”. Type “Y” and hit Enter.

You should see a series of questions — type “Y” for each one of them.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

By now you should have installed MySQL and also securely configured it. You can access MySQL server using the root login and password.

sudo mysql -u root -p
MySQL Root Login
MySQL Root Login

Step 3 – Install PHP

We should first check for available PHP versions and then install it.

sudo apt-cache policy php

Install PHP.

sudo apt-get install php php-cgi libapache2-mod-php php-common php-pear php-mbstring php-mysql php-curl php-json

Step 4 – Install ownCloud

You can add the repository key to apt.

sudo wget -nv -O Release.key
sudo apt-key add - < Release.key

Run the following shell commands to add the repository:

sudo echo 'deb /' |  sudo tee /etc/apt/sources.list.d/owncloud.list

Update repositories.

sudo apt-get update

Install additional PHP packages.

sudo apt install php-bz2 php-curl php-gd php-imagick php-intl php-mbstring php-xml php-zip

Install ownCloud package.

sudo apt-get install owncloud-files
Install Owncloud Package
Install Owncloud Package

Generally, the ownCloud package we installed copies the web files to “/var/www/owncloud” on the server.

Step 5 – Configure Apache with SSL

Now we shall create a virtual host for ownCloud.

Create a folder for SSL certificates.

sudo mkdir /etc/apache2/ssl

Enable SSL module.

sudo a2enmod ssl

Restart Apache.

sudo systemctl restart apache2

Copy your SSL certificates to “/etc/apache2/ssl/ ” folder

Create a virtual host file.

sudo vim /etc/apache2/sites-available/

Add the following lines to file. Replace ServerName with fosslinuxowncloud with whatever you want.

<VirtualHost *:80>
    DocumentRoot /var/www/owncloud

<Directory /var/www/owncloud>
        Options -Indexes +FollowSymLinks
        AllowOverride All
    ErrorLog ${APACHE_LOG_DIR}/
    CustomLog ${APACHE_LOG_DIR}/ combined

<VirtualHost *:443>
    DocumentRoot /var/www/owncloud

<Directory /var/www/owncloud>
        Options -Indexes +FollowSymLinks
        AllowOverride All
    ErrorLog ${APACHE_LOG_DIR}/
    CustomLog ${APACHE_LOG_DIR}/ combined

SSLEngine on

SSLCertificateFile /etc/apache2/ssl/fosslinuxowncloud.cer
SSLCertificateKeyFile /etc/apache2/ssl/fosslinuxowncloud.key
SSLCertificateChainFile /etc/apache2/ssl/


You can give whatever name to your SSL certificate files.

SSLCertificateFile /etc/apache2/ssl/certificatefile-name.cer
SSLCertificateKeyFile /etc/apache2/ssl/certificate-key-name.key
SSLCertificateChainFile /etc/apache2/ssl/

Check the syntax of the configuration file.

sudo apachectl -t

If you get a “Syntax OK” message, use this command line to disable the default, virtual host.

sudo a2dissite 000-default.conf

The following commands should enable new virtual hosts.

sudo a2ensite

Restart Apache to activate changes.

sudo systemctl restart apache2

Step 6 – Configuring the MySQL Database for Owncloud

Access MySQL using the root account.

sudo mysql -u root -p

Create a database, and name it as you want.

create database fosslinuxowncloud;

Create a DB user and grant privileges.

create user 'ownclouduser'@'localhost' identified BY 'QB35JaFV6A9=BJRiT90';
grant all privileges on fosslinuxowncloud.* to ownclouduser@localhost;

Flush privileges.

flush privileges;

Step 7 – Configure ownCloud

Open a web browser and navigate to the following address to access the ownCloud web interface.

https://Domain-Name or IP
Owncloud Web Interface
Owncloud Web Interface

Create an admin account by choosing a username and a password. No need to modify Data Folder.

Fill out the details of the database name, database username, and database password. Here we installed the database in the same server, so we leave the database host as “localhost”.


Click the “Finish setup” button to finish configuring.

Now it should redirect to login page. You can provide given username and password to access the dashboard.

Login Page
Login Page
Inside Owncloud
Inside Owncloud

You can use a desktop or mobile client to sync your data to your ownCloud. Download OwnCloud client from here.


Step 8 – Install Owncloud client on Ubuntu 18.04 Desktop

Run following commands to add the repository. We should run commands as root user.

wget -nv -O Release.key
apt-key add - < Release.key

Update repository.

apt-get update

Add repository.

sh -c "echo 'deb /' > /etc/apt/sources.list.d/isv:ownCloud:desktop.list"

Update repository.

apt-get update

Install client.

apt-get install owncloud-client

After installation is complete, open ownCloud desktop Sync client, add your Domain name and click next.


Then you should get User credentials window where you should provide your username and password.

User Credentials
User Credentials

Then you can select the local folder and configure sync settings.



After you click connect, it should sync data with the server.


You can add your files to the ownCloud local folder. For example, I have added an image to the folder.


Then it should sync to the server.

Now you can go to the server and check the data. You can see the added image on the server.


If you have come this far, you successfully installed and configured the ownCloud server and also synced files with its desktop client.

How did your installation go? Let us know your feedback in the comments below, and don’t forget to share this article with your friends and colleagues who may find it useful.


Related Articles


  1. Hi there,
    I’m missing as to where the SSL certificates I am to copy to the created folder are.
    “Copy your SSL certificates to “/etc/apache2/ssl/ ” folder”

  2. For certificates, you can buy them from a trusted company or generate your own files.

    To generate your own, use the command:

    sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/apache2/ssl/MyOwnCloud.key -out /etc/apache2/ssl/MyOwnCloud.cer

    The command will give you a 10 years (3650 days) validity. Along with site information you provided during the execution.

    Also, please change the name of the certificate files and comment out the chain file.

    SSLCertificateFile /etc/apache2/ssl/MyOwnCloud.cer
    SSLCertificateKeyFile /etc/apache2/ssl/MyOwnCloud.key
    #SSLCertificateChainFile /etc/apache2/ssl/

    This will enable your SSL connection but your browser will notify you that you are not secure. It is because this is a self-signed keys hence there is no one to verify it. But the connection will be encryped securely.

  3. When I try the website.. I get a huge error message, and says something along the lines of; “owncloud not supported by microsoft windows” and “This version of ownCloud requires at least PHP 7.1.0 “.
    How can I fix this?

  4. Pong Songpongs you’re a life saver!
    You forgot to add file to you command. I’ve retyped with this command and added the 3rd missing file.
    sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/apache2/ssl/

    Big thanks to everyone involved!

  5. Thanks a lot for the tutorial. I did not understand how to access to my owncloud outside the local network, I want to have access from WAN.


Please enter your comment!
Please enter your name here


More Articles Like This