Back to all guides
DevOps & Cloud

How to Install Nextcloud Hub with Docker & MariaDB (Ubuntu 24.04)

5 read2026-08-31

Nextcloud Hub is the leading open-source private cloud solution for file synchronization, calendars, contacts, and collaborative office tools. Running Nextcloud in Docker with MariaDB and Redis ensures optimal performance and easy updates.

1. Install Docker & Docker Compose

bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y curl docker.io docker-compose
sudo systemctl enable --now docker

2. Create Docker Compose Configuration

Create a project folder for Nextcloud:

bash
mkdir -p ~/nextcloud && cd ~/nextcloud
nano docker-compose.yml

Paste the following production-ready docker-compose.yml:

yaml
version: '3.8'

services:
  db:
    image: mariadb:10.11
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - db_data:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=RootSecretDbPassword123!
      - MYSQL_PASSWORD=NextcloudDbPassword123!
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  redis:
    image: redis:alpine
    restart: always

  app:
    image: nextcloud:apache
    restart: always
    ports:
      - 8080:80
    links:
      - db
      - redis
    volumes:
      - nextcloud_data:/var/www/html
    environment:
      - MYSQL_PASSWORD=NextcloudDbPassword123!
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - REDIS_HOST=redis

volumes:
  db_data:
  nextcloud_data:

3. Start Nextcloud

Launch all services in the background:

bash
sudo docker-compose up -d

4. Firewall & Web Setup

Allow port 8080:

bash
sudo ufw allow 8080/tcp

Open your browser at http://<YOUR-SERVER-IP>:8080, create your administrator account, and your private cloud is ready!

KVM Linux VPS

Looking for the right Linux VPS?

Put your project into practice right away: Our KVM VPS provide full root access, lightning-fast NVMe storage, and reliable KVM isolation. Flexible prepaid billing with no subscription and personal Discord support.

Full Root Access (SSH)
Datacenter NVMe SSD
4+ Tbps DDoS Protection
100% Prepaid (No Subscription)