VOOZH about

URL: https://dev.to/vultr/deploying-owncloud-file-sharing-platform-on-ubuntu-2404-5ffe

⇱ Deploying ownCloud File Sharing Platform on Ubuntu 24.04 - DEV Community


ownCloud is an open-source file sharing platform that lets you store, sync, and share files from a self-hosted server, with desktop, mobile, and web clients across every major platform. This guide deploys ownCloud with a MariaDB backend and Redis cache using Docker Compose, with Traefik handling automatic HTTPS. By the end, you'll have ownCloud serving files securely at your domain.


Set Up the Directory Structure

1. Create the project directory structure:

$mkdir -p ~/owncloud/{files,mysql,redis,letsencrypt}
$cd ~/owncloud

2. Create the environment file:

$nano .env
OWNCLOUD_DOMAIN=owncloud.example.com
ADMIN_USERNAME=admin
ADMIN_PASSWORD=STRONG_ADMIN_PASSWORD

DB_PASSWORD=STRONG_DB_PASSWORD
DB_ROOT_PASSWORD=STRONG_ROOT_PASSWORD

LETSENCRYPT_EMAIL=admin@example.com

Deploy with Docker Compose

1. Add your user to the Docker group:

$sudo usermod -aG docker $USER
$newgrp docker

2. Create the Docker Compose manifest:

$nano docker-compose.yml
services:
 traefik:
 image: traefik:latest
 container_name: traefik
 restart: unless-stopped
 environment:
 DOCKER_API_VERSION: "1.44"
 command:
 - "--providers.docker=true"
 - "--providers.docker.exposedbydefault=false"
 - "--entrypoints.web.address=:80"
 - "--entrypoints.websecure.address=:443"
 - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
 - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
 - "--certificatesresolvers.le.acme.httpchallenge=true"
 - "--certificatesresolvers.le.acme.httpchallenge.entrypoint=web"
 - "--certificatesresolvers.le.acme.email=${LETSENCRYPT_EMAIL}"
 - "--certificatesresolvers.le.acme.storage=/letsencrypt/acme.json"
 ports:
 - "80:80"
 - "443:443"
 volumes:
 - /var/run/docker.sock:/var/run/docker.sock:ro
 - ./letsencrypt:/letsencrypt

 mariadb:
 image: mariadb:10.11
 container_name: owncloud_db
 restart: unless-stopped
 environment:
 MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
 MYSQL_USER: owncloud
 MYSQL_PASSWORD: ${DB_PASSWORD}
 MYSQL_DATABASE: owncloud
 volumes:
 - ./mysql:/var/lib/mysql
 healthcheck:
 test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
 interval: 10s
 timeout: 5s
 retries: 3

 redis:
 image: redis:latest
 container_name: owncloud_redis
 restart: unless-stopped
 volumes:
 - ./redis:/data
 healthcheck:
 test: ["CMD", "redis-cli", "ping"]
 interval: 10s
 timeout: 5s
 retries: 3

 owncloud:
 image: owncloud/server:latest
 container_name: owncloud_server
 restart: unless-stopped
 depends_on:
 mariadb:
 condition: service_healthy
 redis:
 condition: service_healthy
 environment:
 OWNCLOUD_DOMAIN: ${OWNCLOUD_DOMAIN}
 OWNCLOUD_DB_TYPE: mysql
 OWNCLOUD_DB_NAME: owncloud
 OWNCLOUD_DB_USERNAME: owncloud
 OWNCLOUD_DB_PASSWORD: ${DB_PASSWORD}
 OWNCLOUD_DB_HOST: mariadb
 OWNCLOUD_ADMIN_USERNAME: ${ADMIN_USERNAME}
 OWNCLOUD_ADMIN_PASSWORD: ${ADMIN_PASSWORD}
 OWNCLOUD_REDIS_ENABLED: "true"
 OWNCLOUD_REDIS_HOST: redis
 volumes:
 - ./files:/mnt/data
 labels:
 - "traefik.enable=true"
 - "traefik.http.routers.owncloud.rule=Host(`${OWNCLOUD_DOMAIN}`)"
 - "traefik.http.routers.owncloud.entrypoints=websecure"
 - "traefik.http.routers.owncloud.tls=true"
 - "traefik.http.routers.owncloud.tls.certresolver=le"
 - "traefik.http.services.owncloud.loadbalancer.server.port=8080"

3. Start the services:

$docker compose up -d

4. Verify the services are running:

$docker compose ps

Access ownCloud

Open https://owncloud.example.com in a browser and sign in with ADMIN_USERNAME and ADMIN_PASSWORD from .env. The dashboard loads with file management and the app marketplace.


Next Steps

ownCloud is running and served securely over HTTPS. From here you can:

  • Install the desktop and mobile clients for two-way sync
  • Add users, groups, and per-folder sharing policies
  • Enable apps from the marketplace (Files Antivirus, OnlyOffice, Talk)

For the full guide with additional tips, visit the original article on Vultr Docs.