How to Install and Configure ownCloud Server

OwnCloud is a powerful, web-based personal storage solution for Linux. It works by converting a standard Linux-Apache-MySQL-PHP (LAMP) software stack into an interactive web application that you can access anywhere.

This article shows you the process of installing an ownCloud server on Ubuntu 22.04. Not only that, we will also show you how you can secure it by enabling SSL support.

Tip: not keen to install your own cloud storage? Check out these cloud storage providers instead and see which is the best one for your buck.

Why Use ownCloud?

The biggest advantage of using ownCloud is that it only relies on a traditional web hosting stack. As a result, it is possible to run an ownCloud instance on almost any Linux installation with as little as 512MB of RAM.

A screenshot of the ownCloud default landing screen.

Aside from that, the entire ownCloud suite is free and open source. This means that you can deploy it in a machine and expect that it will receive the latest security updates faster compared to its proprietary counterparts.

A screenshot of the ownCloud github page.

Lastly, ownCloud also provides its own dedicated client similar to Google Drive. You can easily access the files inside your personal cloud drive in your File Manager.

A screenshot of the ownCloud desktop client.

Tip: not a fan of ownCloud? Check out NextCloud and how it compares with ownCloud!

Installing ownCloud

  1. The first step in installing ownCloud is to make sure that your machine has a Fully-Qualified Domain Name. This will allow the server to properly redirect any requests towards it:
sudo hostnamectl set-hostname "your-domain-name"
A terminal showing the hostname of the demo server.
  1. Configure a domain (or subdomain) to point to your server’s IP address. To do this, go to your registrar’s website and add an “A” record with your machine’s IPv4 address.
A screenshot of the DNS record for the demo server.
  1. Once done, update your entire system:
sudo apt update
sudo apt upgrade

Installing Docker and Docker Compose

  1. Install the Docker project’s third-party repository key:
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
  1. Create a new apt repository file for Docker in “/etc/apt/sources.list.d/:”
sudo nano /etc/apt/sources.list.d/docker.list
  1. Insert the following line of code inside your new “docker.list” file:
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable
  1. Save the file (using keyboard shortcut Ctrl + O) and exit the text editor.
A terminal showing the Docker repository information for Ubuntu.
  1. Refresh your system’s apt repository with the following command:
  1. Install Docker along with its necessary utilities with the following command:
sudo apt install wget openssl docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-buildx-plugin

Note: You might need to restart the system for it to take effect.

Preparing the System for the ownCloud Container

  1. Create a new directory for your server’s Docker files:
mkdir ./owncloud-server
cd ./owncloud-server

FYI: Learn how you can create a high-performance web hosting platform by building a LOMP stack today.

  1. Download the ownCloud Docker Compose template from the developers’ website:
wget https://raw.githubusercontent.com/owncloud/docs-server/master/modules/admin_manual/examples/installation/docker/docker-compose.yml
  1. Create a Docker environment file inside your Docker container’s folder:
  1. Add the basic environment variables that you want to use for your ownCloud instance. The following is an example template:
OWNCLOUD_VERSION=10.12
OWNCLOUD_DOMAIN=YOUR-DOMAIN-NAME
OWNCLOUD_TRUSTED_DOMAINS=localhost,YOUR-DOMAIN-NAME
ADMIN_USERNAME=YOUR-ADMIN-USERNAME-HERE
ADMIN_PASSWORD=YOUR-ADMIN-PASSWORD-HERE
HTTP_PORT=8080

You have to change “your-domain-name” to your own domain name. Also, the Admin username and password is referring to OwnCloud login admin, not the system administrator account.

A terminal showing a simple ownCloud Docker Compose environment variables file.

Note: You can generate a secure password by using your system’s “/dev/urandom” device file: cat /dev/urandom | tr -dc 'A-Za-z0-9' | fold -w 64 | head -n 1.

  1. Save your “.env” file and exit.
  1. Run Docker Compose on the container’s directory:
A terminal showing the process of building the Docker container for ownCloud.

Creating an Nginx Reverse Proxy

At this point, you now have a partially working ownCloud installation. In order for it to accept connection, you need to create a reverse proxy that links your internal instance to an outward-facing webserver.

  1. Install the Nginx webserver using apt:
  1. Create the site configuration file for your ownCloud reverse proxy:
sudo nano /etc/nginx/sites-available/owncloud
  1. Write a reverse proxy block that listens on port 80. The following is a simple boilerplate code that I modified to work with my server’s subdomain:
server {
    listen 80;
    listen [::]:80;
 
    root /var/www/html;
    server_name owncloud.myvpsserver.top;
 
    location / {
        proxy_set_header   X-Forwarded-For $remote_addr;
        proxy_set_header   Host $http_host;
        proxy_pass         http://localhost:8080;
    }
}
  1. Once done, create a symbolic link for your new site file:
sudo ln -s /etc/nginx/sites-available/owncloud /etc/nginx/sites-enabled/owncloud
  1. Test your Nginx configuration. If everything is fine, restart Nginx for the changes to take effect.
sudo nginx -t
sudo systemctl reload nginx

Obtaining an SSL Certificate for ownCloud

While it is possible to use ownCloud through HTTP, this can be highly insecure since all connections that you make to it is unencrypted. One way to solve this is by enabling SSL for your ownCloud server.

  1. Update your system’s snapd installation:
sudo snap install core
sudo snap refresh core
  1. Install the certbot snap package:
sudo snap install --classic certbot
  1. Create a symbolic link with your certbot snap package and your system’s binary path:
sudo ln -s /snap/bin/certbot /usr/bin/certbot
  1. Register your new certbot installation to the Electronic Frontier Foundation:
sudo certbot register --agree-tos --email ramces@email.invalid
  1. Run the certbot command for your server’s domain (or subdomain):
sudo certbot --nginx -d owncloud.myvpsserver.top
A terminal showing the automatic certbot SSL certificate issuance process for Nginx.
  1. Once done, you can type in your domain name in the browser and your new ownCloud login page should show up.
A screenshot showing a working ownCloud instance running over SSL.

Good to know: Learn how data is encrypted over the internet through SSL by creating your own self-signed certificate.

Frequently Asked Questions

Is it possible to add a regular user to ownCloud?

Yes. To add a new user, go to your ownCloud admin account and click the admin name on the page’s upper right corner. Next, click the “Users” button to open the server’s current user list. In there, you can add a new user by providing a username and an e-mail address.

Image credit: Quaritsch Photography via Unsplash (Background) and Wikimedia Commons (Logo). All alterations and screenshots by Ramces Red.

Ramces Red
Ramces Red

Ramces is a technology writer that lived with computers all his life. A prolific reader and a student of Anthropology, he is an eccentric character that writes articles about Linux and anything *nix.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Leave a Reply

Your email address will not be published. Required fields are marked *