Nextcloud is a self-hosted alternative to Google Drive, Dropbox and OneDrive. It gives you file sync and sharing, calendars, contacts and, optionally, online document editing and video calls, with your data stored on your own VPS.
This guide uses Nextcloud All-in-One (AIO), the installation method Nextcloud recommends. It runs in Docker and sets up Nextcloud, the database, caching, HTTPS certificates and backups for you. Because it uses Docker, the steps are almost the same on every operating system we offer: Ubuntu 22.04, 24.04 and 26.04, Debian 12 and 13, AlmaLinux 8, 9 and 10, and Rocky Linux 9 and 10.
Before you start
- A VPS with at least 2 vCPU and 4 GB of RAM, and enough disk for your files. Add more RAM if you plan to use online document editing (Collabora) or virus scanning (ClamAV).
- A domain or subdomain with an A record pointing to your VPS IP address, for example
cloud.example.co.nz. Nextcloud AIO needs this to get an SSL certificate. - A fresh server, with nothing else using ports 80 or 443. AIO runs its own web server.
- SSH access as root or as a user with sudo rights. If you're logged in as root, you can leave
sudooff the commands.
Step 1: Install Docker
Skip this step if Docker is already installed (docker --version shows a version).
Ubuntu 22.04, 24.04, 26.04 and Debian 12, 13
sudo apt update
sudo apt install -y ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
. /etc/os-release
sudo curl -fsSL https://download.docker.com/linux/$ID/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/$ID
Suites: ${UBUNTU_CODENAME:-$VERSION_CODENAME}
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
AlmaLinux 8, 9, 10 and Rocky Linux 9, 10 (this removes Podman, which conflicts with Docker):
sudo dnf remove -y podman runc
sudo dnf install -y dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
All systems: start Docker and check it works.
sudo systemctl enable --now docker
sudo docker run --rm hello-world
Step 2: Open the firewall
Nextcloud AIO uses these ports:
- 80/tcp and 443/tcp + udp: Nextcloud itself and the SSL certificate check
- 8080/tcp: the AIO setup interface, used for first-time setup
- 8443/tcp: the AIO interface over HTTPS, once your domain is set up
- 3478/tcp + udp: only needed if you enable Nextcloud Talk (video calls)
Ubuntu/Debian with UFW enabled:
sudo ufw allow 80/tcp
sudo ufw allow 443
sudo ufw allow 8080/tcp
sudo ufw allow 8443/tcp
sudo ufw allow 3478
AlmaLinux/Rocky with firewalld:
sudo firewall-cmd --permanent --add-port={80/tcp,443/tcp,443/udp,8080/tcp,8443/tcp,3478/tcp,3478/udp}
sudo firewall-cmd --reload
A note on Docker and firewalls: Docker manages its own firewall rules, so ports published by a container can be reachable from the internet even if UFW or firewalld would normally block them. Don't rely on your firewall alone to hide a Docker port.
Step 3: Start Nextcloud AIO
Run this command exactly as shown. Don't change the container name, or AIO can't update itself.
sudo docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 80:80 \
--publish 8080:8080 \
--publish 8443:8443 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
ghcr.io/nextcloud-releases/all-in-one:latest
The command keeps showing log output. Once it's running, you can press Ctrl+C. The container keeps running in the background.
Step 4: Set up Nextcloud in your browser
- Open
https://YOUR_SERVER_IP:8080. Use the IP address, not your domain. Your browser will warn about the certificate on this first visit, which is expected. Continue to the page. - AIO shows you a passphrase. Copy it somewhere safe, such as your password manager. You need it every time you log in to the AIO interface.
- Log in with the passphrase, then enter your domain, for example
cloud.example.co.nz. AIO checks that the domain points to your server and that port 443 is open. - Choose the optional extras you want, such as Nextcloud Office (Collabora), Talk, Imaginary or ClamAV. You can change these later.
- Set your time zone, for example
Pacific/Auckland. - Click Download and start containers. This can take 10 to 15 minutes the first time.
- When it finishes, AIO shows the Nextcloud admin username and password. Copy these, then click Open your Nextcloud.
From now on, you can reach the AIO interface at https://cloud.example.co.nz:8443, so you can close port 8080 in your firewall if you like.
Step 5: Set up backups
In the AIO interface, go to the Backup and restore section and set a backup location. AIO uses BorgBackup to take encrypted, deduplicated backups of your whole Nextcloud, and can run them daily. Store backups on a separate disk or server where possible. A backup on the same VPS won't help if the server itself is lost.
Connect your devices
Install the Nextcloud desktop app (Windows, macOS, Linux) or the mobile app (iOS, Android) from nextcloud.com/install, and log in with your domain, for example https://cloud.example.co.nz.
Keeping it up to date
Log in to the AIO interface, click Stop containers, then Start and update containers. AIO updates Nextcloud and all its components together. You can also turn on automatic updates alongside the daily backup. Keep the server's operating system updated as well, with sudo apt update && sudo apt upgrade or sudo dnf upgrade.
Troubleshooting
- The domain check fails: make sure the A record points to your VPS IP and that port 443 is open. DNS changes can take a little while to take effect.
- The container won't start because a port is already in use: another web server, such as Nginx or Apache, is using port 80 or 443. Stop and disable it, or use a fresh VPS.
- Nextcloud feels slow or containers keep restarting: the server may be short on RAM. Turn off extras you don't need (ClamAV uses a lot of memory) or upgrade your VPS.
- You lost the AIO passphrase: see "How to reset the AIO interface password" in the Nextcloud AIO documentation.
Need help?
Our Cloud VPS plans are self-managed, so you're responsible for installing, securing and maintaining the software on your server. If something on our side isn't working, such as the network, or your VPS won't boot, open a support ticket. New to your VPS? Start with our Cloud VPS Getting Started Guide.







