Cloud VPS from $1.98/mo · pay with Bitcoin, Ethereum, Monero, USDT or Solana · paid in crypto
Self-hosting

Install Nextcloud on Ubuntu: All-in-One or manual

Install Nextcloud 35 on Ubuntu 26.04 two ways: the All-in-One Docker image, or Apache, PHP 8.5 and MariaDB by hand, with Redis, cron and the occ settings.

CloudSat teamNovember 18, 20267 min read
Abstract illustration of a cloud shape assembled from small file tiles above two diverging paths
On this pageWhich route fits

Nextcloud 35, released as Nextcloud Hub 26 Summer, is the current major version, with 35.0.3 out since November 12, 2026. There are two sensible ways to run it on your own server. The All-in-One image, which the project itself maintains, sets up Nextcloud and its helpers in Docker and handles updates and backups from a web interface. A manual install puts Apache, PHP and MariaDB on the host, so you control every file and every setting. This guide covers both on Ubuntu 26.04 LTS, the operating system Nextcloud recommends for version 35.

Which route fits

All-in-One (AIO) Manual install
What you manage One container that manages the others Each package and config file
Office, Talk, antivirus, full-text search Tick boxes in the AIO interface Install and wire up each one
Updates From the AIO interface occ upgrade or the updater, plus OS packages
Backups Built in Yours to set up
Best for Most self-hosters and small teams Admins who want full control or an unusual layout

A community-maintained snap package also exists and is kept current, but the AIO and manual routes are the ones the documentation centers on.

Before either route

Create a DNS record such as cloud.example.com pointing at the server, and decide where the files will live: Nextcloud's storage grows with every user. AIO's documentation recommends a KVM-based virtual server, which is what every CloudSat server runs on; if you would rather skip both routes, Nextcloud is also a one-click app on CloudSat.

Office editing and Talk add their own memory needs on top of Nextcloud itself. Start with what your users need today; a server can be resized to a bigger plan later.

Route 1: Nextcloud All-in-One

Install Docker Engine, then open the ports AIO uses: 80 for the certificate challenge, 8080 and 8443 for the AIO interface, 443 for Nextcloud itself, and 3478 over TCP and UDP if you plan to use Talk.

curl -fsSL https://get.docker.com | sudo sh
sudo ufw allow 80,443,8080,8443/tcp
sudo ufw allow 3478

Start the master container exactly as the project documents it:

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

Open https://<server-ip>:8080 in a browser, using the IP address rather than the domain, and accept the self-signed certificate. AIO shows a passphrase; keep it, because it is the key to this interface. Enter your domain, which must already point at the server, choose the optional containers you want, such as office editing, Talk or ClamAV, set the time zone, and start the containers. When they are up, the interface shows the initial administrator password and a link to your new Nextcloud.

The same interface runs updates and the built-in backups. Configure a backup location before you invite users. If the server already runs a reverse proxy, AIO has a documented reverse proxy mode, and port 80 is then not needed.

Route 2: a manual install

Packages and PHP

Nextcloud 35 supports PHP 8.3, 8.4 and 8.5, with 8.5 recommended, and that is what Ubuntu 26.04 ships. MariaDB 11.8 from Ubuntu is on the supported list too.

sudo apt update
sudo apt install -y apache2 mariadb-server redis-server \
  php-fpm php-gd php-mysql php-curl php-mbstring php-intl php-gmp php-bcmath \
  php-xml php-zip php-bz2 php-apcu php-redis php-imagick
sudo a2enmod proxy_fcgi setenvif rewrite headers env dir mime
sudo a2enconf php8.5-fpm

Give PHP room for Nextcloud, and let the command-line PHP that runs cron jobs use APCu too:

; /etc/php/8.5/fpm/conf.d/90-nextcloud.ini
memory_limit = 512M
upload_max_filesize = 2G
post_max_size = 2G
opcache.interned_strings_buffer = 16
; /etc/php/8.5/cli/conf.d/90-nextcloud.ini
apc.enable_cli = 1

Database and files

sudo mariadb <<'SQL'
CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'replace-with-a-long-password';
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
SQL

cd /tmp
curl -LO https://download.nextcloud.com/server/releases/latest.tar.bz2
curl -LO https://download.nextcloud.com/server/releases/latest.tar.bz2.sha256
sha256sum -c latest.tar.bz2.sha256
sudo tar -xjf latest.tar.bz2 -C /var/www
sudo chown -R www-data:www-data /var/www/nextcloud
sudo install -d -o www-data -g www-data -m 0750 /srv/nextcloud-data

Keeping the data directory outside the web root means a web server mistake can never expose user files directly.

The Apache site, in /etc/apache2/sites-available/nextcloud.conf, follows the layout in Nextcloud's admin manual:

<VirtualHost *:80>
  ServerName cloud.example.com
  DocumentRoot /var/www/nextcloud/
  <Directory /var/www/nextcloud/>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews
    <IfModule mod_dav.c>
      Dav off
    </IfModule>
  </Directory>
</VirtualHost>
sudo a2ensite nextcloud && sudo a2dissite 000-default
sudo systemctl restart php8.5-fpm apache2

Install with occ

occ is Nextcloud's command-line tool. Leaving out the passwords makes it prompt for them, so they stay out of your shell history:

cd /var/www/nextcloud
sudo -E -u www-data php occ maintenance:install \
  --database mysql --database-name nextcloud --database-user nextcloud \
  --admin-user cloudadmin --data-dir /srv/nextcloud-data

Caching, cron and the remaining settings

OCC="sudo -u www-data php /var/www/nextcloud/occ"
$OCC config:system:set trusted_domains 1 --value=cloud.example.com
$OCC config:system:set overwrite.cli.url --value=https://cloud.example.com
$OCC config:system:set memcache.local --value='\OC\Memcache\APCu'
$OCC config:system:set memcache.distributed --value='\OC\Memcache\Redis'
$OCC config:system:set memcache.locking --value='\OC\Memcache\Redis'
$OCC config:system:set redis host --value=localhost
$OCC config:system:set redis port --value=6379 --type=integer
$OCC config:system:set default_phone_region --value=US
$OCC config:system:set maintenance_window_start --value=1 --type=integer
$OCC background:cron
$OCC db:add-missing-indices

APCu caches locally, Redis handles file locking, and the maintenance window starts heavy background jobs at 01:00 UTC for the four hours that follow. Then run background jobs from the system scheduler every five minutes: open the web user's crontab with sudo crontab -u www-data -e and add:

*/5 * * * * php -f /var/www/nextcloud/cron.php

HTTPS

sudo apt install -y certbot python3-certbot-apache
sudo certbot --apache -d cloud.example.com

After the install

Sign in as the administrator and open Administration settings > Overview. Nextcloud lists everything it still dislikes about the setup. On a fresh manual install the usual leftovers are a missing HTTP Strict Transport Security header and PHP-FPM hiding environment variables, fixed by uncommenting the env[PATH] line in /etc/php/8.5/fpm/pool.d/www.conf.

A few settings are worth changing before the first user arrives:

  • Two-factor authentication: enable the TOTP provider app and require it for administrators at least.
  • Fewer apps: disable bundled apps nobody will use. Every enabled app is code that runs on each request and must be updated.
  • Server-side encryption: leave it off unless the storage is not yours, such as external object storage. On your own disk it adds overhead and makes recovery harder without protecting against anyone who can read the server.

Then plan the two chores that never go away:

  • Backups: the database, the data directory and config/config.php belong together. AIO's built-in backups cover all three; on a manual install, dump the database and copy the files off the server on a schedule, as in Back up your data off the server.
  • Updates: move through major versions one at a time, never skipping one, and update apps before you update the server.

Connect the clients

Install the desktop client on each computer and sign in with the server's address. Its virtual files option shows the whole cloud in the file manager but downloads a file only when someone opens it, which keeps laptops with small disks usable. On phones, the Nextcloud app can upload new photos automatically.

Everything else can speak WebDAV. File managers, backup tools and office suites connect to:

https://cloud.example.com/remote.php/dav/files/USERNAME/

For tools that store a password, create an app password under Personal settings > Security instead of using the account password. It works with two-factor authentication turned on, and you can revoke it for one device without touching the others.

FAQ

How do I update a manual install?

Run the built-in updater as the web user, sudo -u www-data php /var/www/nextcloud/updater/updater.phar, which downloads the next release, replaces the code and runs the database upgrade. Take a database dump first, and read the release notes for each major version.

Can I move from a manual install to AIO later?

Yes. The AIO project documents a migration path from an existing installation that brings the database and files across. Take a full backup and rehearse it on a second server first.

Where should the data directory live?

On the largest fast disk you have, outside /var/www. Moving it later means updating datadirectory in config.php and the database's file cache, which is easier to avoid than to do.

Is SQLite enough for a small install?

Only for testing. Nextcloud supports SQLite for evaluation, but real use with sync clients needs MariaDB, MySQL or PostgreSQL.

Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.