Website Vidya
Linux & ServersStep-by-Step Guide

How to Install and Configure ownCloud on Ubuntu 24.04

Step-by-step tutorial on how to install and configure ownCloud on Ubuntu 24.04 LTS with Apache, MariaDB, PHP 8.x, and Let's Encrypt SSL certificates.

RR
Rajesh RayLead Systems Educator
Published:
6 min read
PDF Cheat Sheet
How to Install and Configure ownCloud on Ubuntu 24.04
AI Executive SummaryWebsiteVidya AI

6 min read

Step-by-step tutorial on how to install and configure ownCloud on Ubuntu 24.04 LTS with Apache, MariaDB, PHP 8.x, and Let's Encrypt SSL certificates.

Key Highlights
  • Prerequisites and Supported Releases
  • Step 1: Installing the Apache Web Server and MariaDB Database
  • Step 2: Installing PHP and Required Extensions
Grounded in full engineering runbookWebsiteVidya AI Engine

In an era where data privacy, digital sovereignty, and compliance regulations (such as GDPR and HIPAA) are paramount, relying exclusively on third-party commercial cloud storage providers introduces operational and security risks. ownCloud is an industry-leading open-source file synchronization, sharing, and content collaboration platform that allows individuals, teams, and enterprises to maintain 100% control over their sensitive data.

With ownCloud, you can sync files across Windows, macOS, Linux, Android, and iOS devices, share encrypted folders with external collaborators, and access versioned documents through an intuitive web interface. Learning how to install and configure owncloud on ubuntu 24.04 empowers you to build a private, enterprise-grade cloud storage infrastructure hosted on your own virtual hardware.

In this comprehensive step-by-step tutorial, we demonstrate how to install ownCloud Server on Ubuntu 24.04 LTS (Noble Numbat). We cover provisioning the complete LAMP stack (Apache, MariaDB, and PHP with required modules), securing the database, configuring Apache Virtual Hosts and directory permissions, enabling automated background cron jobs, and obtaining a free Let's Encrypt SSL/TLS certificate with Certbot.

Advertisement

Prerequisites and Supported Releases

This guide is thoroughly verified on Ubuntu 24.04 LTS (Noble Numbat). The instructions apply cleanly to cloud instances (AWS EC2, Google Compute Engine, DigitalOcean, Hetzner), bare-metal servers, and local virtual machines.

Before proceeding, ensure you have the following requirements satisfied:

  • A virtual or dedicated server running Ubuntu 24.04 LTS.
  • A non-root user with administrative sudo privileges.
  • A fully qualified domain name (e.g., cloud.example.com) pointed to your server's public IP address.
  • At least 2 GB of RAM (4 GB recommended for multiple active sync clients).

Step 1: Installing the Apache Web Server and MariaDB Database

ownCloud requires a robust web server and a relational database engine. We will use the Apache HTTP server and MariaDB.

Update your local package index and install apache2, mariadb-server, and standard utility packages using APT.

Advertisement

Verify that both Apache and MariaDB services are enabled and running.

# Update package lists
sudo apt update && sudo apt upgrade -y

# Install Apache web server and MariaDB database
sudo apt install -y apache2 mariadb-server mariadb-client curl wget unzip bzip2

# Verify active services
sudo systemctl status apache2 mariadb --no-pager

Step 2: Installing PHP and Required Extensions

ownCloud relies heavily on PHP and numerous specialized extensions for cryptographic hashing, XML parsing, image thumbnail generation, and database connectivity.

Install PHP along with required modules including libapache2-mod-php, php-mysql, php-curl, php-gd, php-intl, php-mbstring, php-xml, php-zip, and php-apcu.

After installing PHP extensions, restart the Apache service so the web server loads the newly installed modules.

Advertisement
# Install PHP runtime and required ownCloud modules
sudo apt install -y php php-cli php-fpm php-mysql php-curl php-gd php-intl php-mbstring php-xml php-zip php-bz2 php-gmp php-apcu libapache2-mod-php

# Restart Apache
sudo systemctl restart apache2

Step 3: Creating the ownCloud MariaDB Database and User

Before extracting ownCloud, set up a dedicated database and database user inside MariaDB.

Log into the MariaDB shell as the administrative root user.

Create a database named owncloud_db, configure utf8mb4 character encoding, create a dedicated user owncloud_user, and grant full privileges.

Be sure to replace StrongSecurePassword123! with a strong, randomized password.

-- Access MariaDB root shell
sudo mariadb

-- Create database with utf8mb4 encoding
CREATE DATABASE owncloud_db CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

-- Create dedicated database user
CREATE USER 'owncloud_user'@'localhost' IDENTIFIED BY 'StrongSecurePassword123!';

-- Grant database privileges
GRANT ALL PRIVILEGES ON owncloud_db.* TO 'owncloud_user'@'localhost';

-- Apply changes and exit
FLUSH PRIVILEGES;
EXIT;

Step 4: Downloading and Extracting ownCloud Server

Download the latest stable ownCloud Community Server archive directly from the official ownCloud website into your /tmp directory.

Extract the archive into your web root directory at /var/www/owncloud.

Create the dedicated data directory (/var/www/owncloud/data) where user uploaded files will be stored, and assign ownership to the www-data web server user.

# Navigate to /tmp and download official ownCloud archive
cd /tmp
wget https://download.owncloud.com/community/owncloud-complete-latest.tar.bz2

# Extract into /var/www/
sudo tar -xjf owncloud-complete-latest.tar.bz2 -C /var/www/

# Create ownCloud data directory
sudo mkdir -p /var/www/owncloud/data

# Assign file permissions and ownership to web server user
sudo chown -R www-data:www-data /var/www/owncloud
sudo chmod -R 755 /var/www/owncloud

Step 5: Configuring Apache Virtual Host for ownCloud

Create a dedicated Apache Virtual Host configuration file for ownCloud to handle URL rewriting, directory access controls, and HTTP security headers.

Create the configuration file at /etc/apache2/sites-available/owncloud.conf.

Enable the Apache rewrite, headers, env, dir, and mime modules, activate the new virtual host, and restart Apache.

# Create virtual host configuration
sudo bash -c 'cat <<EOF > /etc/apache2/sites-available/owncloud.conf
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/owncloud/
    ServerName cloud.example.com

    <Directory /var/www/owncloud/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/owncloud_error.log
    CustomLog ${APACHE_LOG_DIR}/owncloud_access.log combined
</VirtualHost>
EOF'

# Enable required Apache modules and virtual host
sudo a2enmod rewrite headers env dir mime
sudo a2ensite owncloud.conf
sudo a2dissite 000-default.conf
sudo systemctl restart apache2

Step 6: Securing ownCloud with Let's Encrypt SSL Certificate

Encrypting user logins, API authentication tokens, and transferred files with SSL/TLS is mandatory for any production cloud storage deployment.

Install Certbot and its Apache plugin using APT.

Obtain and install a free, automated Let's Encrypt SSL certificate by executing the Certbot utility against your domain.

Certbot will automatically configure HTTPS redirects and renew certificates via systemd timers.

# Install Certbot and Apache plugin
sudo apt install -y certbot python3-certbot-apache

# Obtain and configure SSL certificate
sudo certbot --apache -d cloud.example.com

Step 7: Completing the Web-Based Installation Wizard

Open your web browser and navigate to your configured domain: https://cloud.example.com.

The ownCloud initial setup wizard will appear. Complete the installation fields as follows:

1. Create an admin account: Enter a secure administrative username and password.

2. Storage & database: Click to expand the database section, select MySQL/MariaDB, and fill in the database credentials created in Step 3 (Database user: owncloud_user, Password: StrongSecurePassword123!, Database name: owncloud_db, Host: localhost).

Click Finish setup. ownCloud will create database tables, initialize configuration files, and direct you to the main dashboard.

Admin Username: admin
Admin Password: <secure_admin_password>
Database: MySQL/MariaDB
DB User: owncloud_user
DB Name: owncloud_db
DB Host: localhost

Step 8: Configuring Background Jobs via Systemd Cron

ownCloud requires regular background tasks to clean trash bins, send notification emails, and optimize database indices. By default, ownCloud uses AJAX cron (triggered only when users browse pages), which is inefficient for busy servers.

The recommended method is configuring standard system cron. In the ownCloud web admin settings under General, change the background jobs setting from AJAX to Cron.

Configure the www-data user crontab to execute ownCloud's background worker every 15 minutes.

# Add cron job for www-data user
echo '*/15 * * * * /usr/bin/php -f /var/www/owncloud/occ system:cron > /dev/null 2>&1' | sudo crontab -u www-data -

# Test running the OCC maintenance utility manually
sudo -u www-data php /var/www/owncloud/occ status

Troubleshooting and Common Errors

When configuring Ubuntu servers, unexpected permission errors, network timeouts, or lock contention can occur. Review these common issues and verified resolutions:

'Strict-Transport-Security' HTTP header is not set to at least 15552000 seconds

Resolution: Open /etc/apache2/sites-available/owncloud-le-ssl.conf and add Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains" inside the <VirtualHost *:443> block, then restart Apache.

Access through untrusted domain error on login

Resolution: Open /var/www/owncloud/config/config.php and add your domain or IP to the trusted_domains array: 1 => 'cloud.example.com'.

PHP memory limit warning in admin overview

Resolution: Increase the memory limit in your active php.ini file (typically /etc/php/8.3/apache2/php.ini) by setting memory_limit = 512M and restarting Apache.

Security Best Practices and Hardening

Always enforce HTTPS and enable HTTP Strict Transport Security (HSTS) to prevent SSL-stripping attacks on file sync operations.

Place the ownCloud data directory (/var/www/owncloud/data) outside the web root if possible, or verify that .htaccess prevents direct HTTP access.

Enable Server-Side Encryption inside ownCloud settings if storing files on untrusted or third-party storage backends.

Keep ownCloud and PHP extensions updated by applying regular Ubuntu security patches and reviewing the official ownCloud release feed.

Deepen your Linux system administration skills with our related production-tested guides:

Authoritative References and Official Documentation

Frequently Asked Questions

Quick answers to common questions and configurations

3 FAQs
Yes! ownCloud provides native desktop synchronization clients for Windows, macOS, and Linux, as well as mobile apps for iOS and Android, allowing continuous file synchronization.
Nextcloud was originally forked from ownCloud in 2016. While both offer similar self-hosted storage and WebDAV file sharing, ownCloud Infinite Scale (OCIS) focuses on high-performance Golang microservice architecture, while classic ownCloud runs on the familiar PHP/LAMP stack.
A complete backup requires two components: backing up the database via mysqldump -u owncloud_user -p owncloud_db > owncloud_backup.sql and archiving the file storage directory located at /var/www/owncloud/data.
RR
Written byVerified Author

Rajesh Ray

I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.

SPAM-FREE MODERATED DISCOURSE

Join the Conversation & Perspective

Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.

AT
MP
JV
+2

No comments on this guide yet. Be the first to share your thoughts or ask a question!

Recommended Reading10 Guides

Related Technical Guides

Tested runbooks, server administration walkthroughs, and troubleshooting guides

Featured Infrastructure PartnerUp to 75% OFF + 3 Months Free

Supercharge Your Linux & Cloud Workloads with Hostinger

Deploy high-speed NVMe KVM VPS, Docker containers, and LiteSpeed-accelerated WordPress servers in under 60 seconds with full root access, dedicated IPv4, and 24/7 technical support.

Pure NVMe SSD StorageFull Root Access & SSHFree Domain & Unlimited SSL99.9% Uptime SLA
Plans from$2.99/mo
Claim Hostinger DealAffiliate link • Special discount applied at checkout