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.

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.
- Prerequisites and Supported Releases
- Step 1: Installing the Apache Web Server and MariaDB Database
- Step 2: Installing PHP and Required Extensions
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.
Deploy ownCloud self-hosted file sharing and synchronization platform on Ubuntu 24.04 LTS using the LAMP stack (Apache, MariaDB, PHP) with Let's Encrypt SSL.
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
sudoprivileges. - 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.
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.
# 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.
Related Ubuntu Tutorials and Documentation
Deepen your Linux system administration skills with our related production-tested guides:
Authoritative References and Official Documentation

UNIX and Linux System Administration Handbook, 5th Edition
Frequently Asked Questions
Quick answers to common questions and configurations
mysqldump -u owncloud_user -p owncloud_db > owncloud_backup.sql and archiving the file storage directory located at /var/www/owncloud/data.Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
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.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides


Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!