IT in Education

Nextcloud AIO with Proxmox VE, Ubuntu and Docker

awsThis article describes the process of deploying Nextcloud AIO (All-In-One) on your own hardware. I've chosen to deploy using Proxmox VE, with Ubuntu as a container, to take advantage of the excellent backup facilities built-in to Proxmox. Using this method I can backup the entire Ubuntu container in addition to using the backup functions that come with Nextcloud AIO.


Prerequisites

Before starting you will need to do the following:

  • Create a subdomain (e.g. cloud.yourschool.org).
  • Create an SSL Certificate for this domain.
  • Point the A record for this subdomain at your school's external IP address.
  • Designate an interal static IP address (e,g. 192.168.1.100) for the Docker host.

Configure your router and/or gateway server to forward the following TCP ports to your Docker host:

  • 80, web traffic
  • 443, secure web traffic
  • 8443, port used by Nextcloud AIO interface
  • 3478 (TCP and UDP), port used by Nextcloud Talk

Note that this procedure assumes that you don't have a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else) already in place.

Proxmox VE

Start by installing Proxmox VE on hardware of your choice. For this article I used the following configuration:

  • 1 processor with 6 cores
  • 24GB memory
  • 500GB hard drive for Proxmox
  • 2TB SSD drive for VM storage
  • 4TB hard drive for backup

Ubuntu 22.04 (LTS)

Now you are ready to install Ubuntu 22.04 (LTS) as a container. I used the following configuration:

  • 2 cores
  • 8GB memory
  • 1TB hard drive
  • 1 NIC bridged

Docker

You are now ready to install Docker on your Ubuntu server.

Nextcloud AIO for Docker

Now you can log on to your Ubuntu server via SSH and run the following command to install Nextcloud AIO:

# For Linux and without a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else) already in place:
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 \
nextcloud/all-in-one:latest

Nexcloud has more information on how this script works.

Initialise Nextcloud

Now you should be able to access your Nextcloud instance by browsing to

  1. Browse to https://IP-Address:8080
  2. Copy the Password that's displayed (e.g. amazingly easiness bats thank recant unreal exterior glutinous).
  3. Click the Open Nextcloud AIO login button.
  4. Paste the password and click Login.
  5. Click Update mastercontainer, if it appears.
  6. Enter your domain name (e.g. cloud.myschool.org), and click Submit domain.
  7. Enter your Timezone, being careful to enter a correctly named timezone (e.g. Europe/London) and click the Submit timezone button. 
  8. Click the Download and start containers button.

Note that if you enable the optional addons ClamAV and Fulltextsearch, I found that I needed 8GB memory.

It might take several minutes to create and start the required containers. Once this process is complete you'll be presented with the initial admin password.

Access Nextcloud

You are now ready to access Nextcloud using your admin account.

  1. Browse to your domain (e.g. cloud.myschool.org).
  2. Username: admin
  3. Password: from the previous step.

I recommend that you create your own admin account, and disable or delete the default admin account.

Backup

Nextcloud AIO has a built-in backup feature.

  1. Log on to Nextcloud with your admin account.
  2. Click your Avatar > Administration settings.
  3. Select Overview in the left pane.
  4. Click the Open Nextcloud AIO Interface button.
  5. In the Backup and restore section, enter a path for the backup (e.g. /mnt/backup)
  6. Click the Submit backup location button.
  7. Click the Create backup button to create your first backup.

This will stop all containers and make your Nextcloud unavailable during the backup process. Click OK to proceed. Click the Refresh button to see if the backup job has finished, it should only take a few minutes the first time it's run on an empty Nextcloud. Click Start containers, once the backup has finished.

Once you've run a first backup, you can configure a suitable time for a daily backup.

  1. Click to ...reveal all backup options.
  2. Make a note of the encryption password.
  3. In the Daily backup and automatic updates section, enter a time (e.g. 04:00) and click Submit backup time.

Docker containers

Nextcloud is running in Docker containers. To access your Nextcloud AIO server using SSH, log on to your Ubuntu host, and run the following command:

sudo docker exec -it nextcloud-aio-nextcloud sh

You will now be able to browse the web root directory, and edit the config.php file for example. You can also run OCC commands from here. Type exit to come out of the interactive session.

Alternatively you could use the console link in Portainer, to gain SSH access to the nextcloud-aio-nextcloud container.

Troubleshooting

Here are some issues that I've had to fix.

Container shows as unhealthy

This issue affected nextcloud-aio-apache and nextcloud-aio-talk, and can arise for various reasons. Unfortunately I'd configured port forwarding to point at the Proxmox VE host instead of the Ubuntu VM.


Thanks for visiting,
Steven