
ownCloud is an open-source file-sharing platform that enables you to store, sync, and manage files from a self-hosted server. It offers a privacy-focused alternative to cloud services like Google Drive and Dropbox by giving you full control over your data and infrastructure.
In this article, you will deploy ownCloud on an Ubuntu 24.04 server using Docker. You’ll set up a MariaDB database container, secure your environment, access the ownCloud web interface, and explore features such as file sharing, user management, and app integration.
Prerequisites
Before you begin:
- Have access to an Ubuntu 24.04 instance as a non-root sudo user.
- Create a domain A record that points to your server’s IP address. For example,
cloud.example.com
.
Install ownCloud Using Docker Compose
Docker Compose provides a structured way to manage multi-container applications like ownCloud. This method allows you to define services, networks, and volumes in a single file and manage them together with simple commands.
Install Docker Compose
Update your
APT
package index.console$ sudo apt update
Install Docker.
console$ sudo apt install docker.io -y
Enable and start Docker.
console$ sudo systemctl enable docker
console$ sudo systemctl start docker
Add your
user
to the docker group to avoid usingsudo
with every command.console$ sudo usermod -aG docker $USER
Log out and log back in to apply the change.
Install the new Docker Compose plugin.
console$ mkdir -p ~/.docker/cli-plugins
console$ curl -SL https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
console$ chmod +x ~/.docker/cli-plugins/docker-compose
Verify the installation.
console$ docker compose version
Output should be similar to:
Docker Compose version v2.X.X
Deploy ownCloud with Docker Compose
Create a project directory and switch into it.
console$ mkdir ~/owncloud
console$ cd ~/owncloud
Create a
docker-compose.yml
file.console$ nano docker-compose.yml
Add the following configuration to define the ownCloud and MariaDB services:
yamlversion: "3" volumes: files: driver: local mysql: driver: local redis: driver: local services: owncloud: image: owncloud/server:${OWNCLOUD_VERSION} container_name: owncloud_server restart: always ports: - ${HTTP_PORT}:8080 depends_on: - mariadb - redis environment: - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN} - OWNCLOUD_TRUSTED_DOMAINS=${OWNCLOUD_TRUSTED_DOMAINS} - OWNCLOUD_DB_TYPE=mysql - OWNCLOUD_DB_NAME=owncloud - OWNCLOUD_DB_USERNAME=owncloud - OWNCLOUD_DB_PASSWORD=owncloud - OWNCLOUD_DB_HOST=mariadb - OWNCLOUD_ADMIN_USERNAME=${ADMIN_USERNAME} - OWNCLOUD_ADMIN_PASSWORD=${ADMIN_PASSWORD} - OWNCLOUD_MYSQL_UTF8MB4=true - OWNCLOUD_REDIS_ENABLED=true - OWNCLOUD_REDIS_HOST=redis healthcheck: test: ["CMD", "/usr/bin/healthcheck"] interval: 30s timeout: 10s retries: 5 volumes: - files:/mnt/data mariadb: image: mariadb:10.11 # minimum required ownCloud version is 10.9 container_name: owncloud_mariadb restart: always environment: - MYSQL_ROOT_PASSWORD=owncloud - MYSQL_USER=owncloud - MYSQL_PASSWORD=owncloud - MYSQL_DATABASE=owncloud - MARIADB_AUTO_UPGRADE=1 command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"] healthcheck: test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=owncloud"] interval: 10s timeout: 5s retries: 5 volumes: - mysql:/var/lib/mysql redis: image: redis:6 container_name: owncloud_redis restart: always command: ["--databases", "1"] healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 volumes: - redis:/data
Replace environment values like
securepassword
with secure production credentials.Start the containers using Docker Compose.
console$ docker compose up -d
Check that both services are running.
console$ docker compose ps
Output should show both the
owncloud
anddb
containers asUp
.
Configure ownCloud
After deploying ownCloud with Docker Compose, secure and optimize it for production use with HTTPS, a reverse proxy using Nginx, and proper firewall configuration.
Configure Nginx as a Reverse Proxy
Install Nginx if it’s not already installed.
console$ sudo apt update
console$ sudo apt install nginx -y
Create a configuration file for ownCloud.
console$ sudo nano /etc/nginx/sites-available/owncloud
Paste the following, replacing
cloud.example.com
with your domain:iniserver { listen 80; server_name cloud.example.com; location / { proxy_pass http://localhost:8080/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }
Enable the configuration.
console$ sudo ln -s /etc/nginx/sites-available/owncloud /etc/nginx/sites-enabled/
console$ sudo nginx -t
console$ sudo systemctl reload nginx
Allow Nginx Through the Firewall
Open HTTP and HTTPS ports.
console$ sudo ufw allow 'Nginx Full'
console$ sudo ufw reload
Secure ownCloud with HTTPS
Install Certbot and the Nginx plugin.
console$ sudo apt install certbot python3-certbot-nginx -y
Generate and apply a TLS certificate.
console$ sudo certbot --nginx -d cloud.example.com
Certbot will automatically edit your Nginx config to enable HTTPS.
Enable Automatic Renewal
Ensure Certbot renewal is scheduled.
console$ sudo systemctl enable certbot.timer
Test the renewal process.
console$ sudo certbot renew --dry-run
Verify Setup
Open your browser and navigate to:
https://cloud.example.com
You should see the ownCloud setup wizard served securely over HTTPS.
Access and Set Up ownCloud
Complete the final setup through the ownCloud web interface:
Open your browser and visit your domain over HTTPS.
https://cloud.example.com
The ownCloud setup wizard will appear.
Create an admin account by choosing a secure username and password.
Under Database Configuration, enter the following:
- Database user:
ownclouduser
- Database password: the password you used when starting the MariaDB container
- Database name:
owncloud
- Database host:
owncloud-db
- Database user:
Click Finish Setup.
After setup completes, you'll be redirected to the login page. Use your admin credentials to sign in and access the ownCloud dashboard.
Manage and Share Files with ownCloud
After logging into the ownCloud dashboard, you can begin managing your files:
Upload and organize files using the web interface. Drag-and-drop support is available.
Create folders and move files to structure your storage.
Share files or folders via public or private links. You can:
- Set expiration dates
- Require passwords
- Enable or disable editing
Create user groups and set granular permissions for collaboration.
Sync files across devices by installing the ownCloud desktop or mobile clients. These apps automatically synchronize your data between the server and your devices.
ownCloud also supports WebDAV, making it compatible with third-party tools and OS-native file managers.
Install and Manage Apps in ownCloud
ownCloud includes an integrated App Marketplace that allows you to extend your server with additional features.
Access the App Marketplace:
- Log in as an admin user.
- Click the Apps icon in the top navigation bar.
Browse or search for apps based on categories like productivity, storage, authentication, or multimedia.
Enable an app:
- Click Enable next to the desired app.
- Some apps may require additional configuration after activation.
Popular apps include:
- Calendar – Schedule and share events with users or groups.
- Contacts – Manage address books and sync them across devices.
- External Storage – Integrate with Dropbox, Google Drive, S3, or local mount points.
Manage installed apps:
- Use the Enabled tab to view or disable currently active apps.
- Some apps offer settings accessible via the Settings panel under the Admin section.
Refer to the official app documentation for details on configuring specific apps or developing custom ones.
Backup and Restore ownCloud Data
To ensure data durability and prevent accidental loss, regularly back up your ownCloud installation. This includes both user files and database content.
If you deployed ownCloud using Docker, your data is typically stored in a named volume like owncloud_files
.
Export the ownCloud data volume to a tarball.
console$ docker run --rm \ -v files:/volume \ -v $(pwd):/backup \ alpine \ tar -czf /backup/owncloud_files_backup.tar.gz -C /volume .
This command saves a
.tar.gz
backup of the ownCloud volume to the current directory on your host.Backup the MariaDB data directory (optional but recommended). If using a MariaDB container, you can similarly back up its volume.
console$ docker run --rm \ -v mysql:/volume \ -v $(pwd):/backup \ alpine \ tar -czf /backup/mariadb_backup.tar.gz -C /volume .
To restore the ownCloud volume:
Create a fresh volume (if needed).
console$ docker volume create files
console$ docker volume create mysql
Restore contents into it.
console$ docker run --rm \ -v files:/volume \ -v $(pwd):/backup \ alpine \ tar -xzf /backup/owncloud_files_backup.tar.gz -C /volume
Apply the same process to your MariaDB volume if restoring database content.
Backup Best Practices
- Perform regular backups (daily or weekly) using a scheduled cron job.
- Store backups off-server (e.g., to S3, rsync to remote machine).
- Use snapshot-based backups if deploying with cloud storage.
For production deployments, also consider backing up your docker-compose.yml
and .env
files if using Docker Compose.
Conclusion
In this article, you deployed ownCloud on an Ubuntu 24.04 server using Docker. You configured a secure MariaDB backend, set up reverse proxy and firewall rules, optionally enabled SSL with Let's Encrypt, and accessed the ownCloud dashboard via the browser. You also explored optional configurations like background cron jobs, app installation, and backup strategies.
With ownCloud, you gain full control over your file storage and collaboration environment, making it a powerful alternative to third-party platforms like Google Drive and Dropbox.
To explore advanced features or troubleshoot issues, refer to the official documentation:
No comments yet.