This guide provides a step-by-step process to install and configure Nextcloud All-in-One (AIO) on an Ubuntu system with software RAID, including RAID 5 for storage and RAID 1 for the operating system, along with IPv6 support and a custom data directory. It is tailored for users with a setup similar to the one discussed, featuring NVMe drives in RAID 1 and HDDs in RAID 5.
Hardware Setup Assumptions
The following hardware setup is assumed:
- NVMe Drives: Two NVMe SSDs, each approximately 953.9GB, configured in a RAID 1 array for redundancy and performance. These drives host the operating system, swap space, and boot partition.
- HDDs: Four hard disk drives, each approximately 20TB, configured in a RAID 5 array for data storage, providing approximately 60TB of usable space with fault tolerance for one drive failure.
- Network Interface: A network interface supporting IPv6 with a global address (e.g., 2a01:4f8:13b:3004::2), ensuring compatibility with IPv6-enabled Docker networks.
- Server: A system capable of running Ubuntu (e.g., 22.04 Jammy or 24.04 Noble LTS), with sufficient CPU and RAM to handle Nextcloud AIO and its services (recommended: 4+ cores, 8GB+ RAM).
Note: Adjust this based on your specific hardware specifications if they differ (e.g., drive sizes or counts).
Prerequisites
- Ubuntu Version: Ubuntu 22.04 (Jammy) or 24.04 (Noble) LTS, 64-bit.
- Software: Docker Engine (non-Snap installation), `mdadm` for RAID, and basic system tools.
- Network: IPv6 support from your ISP or network configuration.
- Access: Root or sudo privileges.
Step 1: Set Up Software RAID
Configure your NVMe drives in RAID 1 (already done in your setup) and set up the four HDDs in RAID 5 for Nextcloud data storage.
1.1 Verify Current RAID Setup
lsblk
Confirm NVMe drives (nvme0n1, nvme1n1) are in RAID 1 (/dev/md0 for swap, /dev/md1 for /boot, /dev/md2 for /) and HDDs (sda, sdb, sdc, sdd) are unused.
1.2 Create RAID 5 for HDDs
mdadm --create --verbose /dev/md3 --level=5 --raid-devices=4 /dev/sda /dev/sdb /dev/sdc /dev/sdd
Monitor progress: cat /proc/mdstat Format the array: mkfs.ext4 /dev/md3 (note: this may take hours for 60TB).
1.3 Mount the RAID 5 Array
mkdir /data
sudo mount /dev/md3 /data
Configure for boot: Edit /etc/fstab with the UUID:
blkid /dev/md3
Add to /etc/fstab (e.g., UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /data ext4 defaults 0 0). Test: mount -a Save RAID config: mdadm --detail --scan | tee -a /etc/mdadm/mdadm.conf Update initramfs: update-initramfs -u
Step 2: Install Docker Engine
Install Docker using the official repository to avoid Snap conflicts.
- Set up the Docker APT repository:
apt-get update apt-get install ca-certificates curl install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc chmod a+r /etc/apt/keyrings/docker.asc echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$UBUNTU_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null apt-get update - Install Docker:
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - Verify Installation:
docker run hello-world
Step 3: Enable IPv6 Support
Configure Docker to support IPv6 for the default bridge network. Note that the default-network-opts method did not work in this setup, requiring a custom global IPv6 configuration.
- Edit Docker Configuration:
Add the custom global IPv6 configuration (replacenano /etc/docker/daemon.json2001:db8:1::/64with your actual IPv6 subnet, e.g.,2a01:4f8:13b:3004::/64):
Note: The{ "ipv6": true, "fixed-cidr-v6": "2001:db8:1::/64", "ip6tables": true }default-network-optsapproach ({"default-network-opts": {"bridge": {"com.docker.network.enable_ipv6": "true"}}}) was attempted but did not enable IPv6, necessitating this global configuration. Save and exit. - Restart Docker:
systemctl restart docker - Verify IPv6:
Ensuredocker network inspect bridge"EnableIPv6": trueand an IPv6 subnet (e.g.,2001:db8:1::/64) appear. If not, check logs:journalctl -u docker.service -b.
Step 4: Install Nextcloud AIO
Deploy Nextcloud AIO with a custom data directory on the RAID 5 array.
- Prepare Data Directory:
mkdir -p /data/ncdata chown 33:0 /data/ncdata chmod 750 /data/ncdata - Run AIO Container:
Usedocker run -d \ --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 \ --env NEXTCLOUD_DATADIR="/data/ncdata" \ ghcr.io/nextcloud-releases/all-in-one:latest-dfor detached mode to avoid terminal lock.
Step 5: Configure Firewall
Allow necessary ports for AIO and SSH.
ufw allow 80,8080,443,8443,3478,2222/tcp
ufw allow 3478/udp
ufw reload
Ensure IPv6 is enabled in UFW (check /etc/default/ufw for IPV6=yes). SSH Configuration: Edit /etc/ssh/sshd_config, set Port 2222, and restart with systemctl restart sshd.
Step 6: Access and Configure Nextcloud AIO
- Access Interface:Open
https://:8080(e.g.,https://94.130.41.126:8080orhttps://[2a01:4f8:13b:3004::2]:8080).Accept the self-signed certificate warning.Note: Make sure to usehttps://and nothttp://. - Complete Setup Wizard:Enter your domain or IP, admin credentials, and verify the data directory is
/data/ncdata. - Verify:
docker ps docker logs nextcloud-aio-mastercontainer ls -l /data/ncdata
Step 7: Post-Installation
- SSH Configuration: Ensure SSH listens on 2222 by editing
/etc/ssh/sshd_config(Port 2222), then restart:systemctl restart sshd. - Backup: Enable daily backups via the AIO interface.
- Updates: Use the AIO interface to update containers and Nextcloud.
Troubleshooting
- Script Stuck: Use
Ctrl+Z, thenkill %1, or kill via PID from another terminal (ps aux | grep setup_nextcloud_aio.sh,kill -9). - IPv6 Issues: If no IPv6 address, check
ip -6 addrand network routing. Use a custom network if needed:
Adddocker network create --driver bridge --ipv6 --subnet 2a01:4f8:13b:3004::/64 --gateway 2a01:4f8:13b:3004::1 nextcloud-aio-ipv6--network nextcloud-aio-ipv6to thedocker runcommand. - Interface Not Loading: Check logs (
docker logs nextcloud-aio-mastercontainer) or port conflicts (netstat -tuln | grep 8080). - Data Directory Errors: Reapply permissions:
chown 33:0 /data/ncdata; chmod 750 /data/ncdata.
Automation Script
Use this script to automate the setup:
#!/bin/bash
# Exit on error
set -e
# Step 1: Clean up Docker environment
echo "Cleaning up Docker environment..."
docker ps -q | xargs -r docker stop || true
docker ps -a -q | xargs -r docker rm || true
docker network rm nextcloud-aio || true
docker volume ls -q --filter dangling=true | xargs -r docker volume rm || true
docker volume rm nextcloud_aio_mastercontainer nextcloud_aio_backupdir nextcloud_aio_nextcloud_datadir || true
# Step 2: Verify Docker installation
echo "Verifying Docker installation..."
if docker info | grep -q "/var/snap/docker/"; then
echo "Snap-based Docker detected. Removing and reinstalling..."
snap remove docker
curl -fsSL https://get.docker.com | sh
fi
docker --version
# Step 3: Configure IPv6
echo "Configuring Docker for IPv6..."
cat << EOF > /etc/docker/daemon.json
{
"default-network-opts": {
"bridge": {
"com.docker.network.enable_ipv6": "true"
}
}
}
EOF
chown root:root /etc/docker/daemon.json
chmod 644 /etc/docker/daemon.json
# Step 4: Restart Docker
echo "Restarting Docker..."
systemctl stop docker docker.socket
systemctl start docker
systemctl status docker --no-pager
# Step 5: Verify IPv6
echo "Verifying IPv6 configuration..."
if ! docker network inspect bridge | grep -q '"EnableIPv6": true'; then
echo "IPv6 not enabled. Trying fallback configuration..."
cat << EOF > /etc/docker/daemon.json
{
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64",
"ip6tables": true,
"default-network-opts": {
"bridge": {
"com.docker.network.enable_ipv6": "true"
}
}
}
EOF
systemctl restart docker
fi
if ! docker network inspect bridge | grep -q '"EnableIPv6": true'; then
echo "IPv6 configuration failed. Exiting. Check logs with 'journalctl -u docker.service -b'."
exit 1
fi
echo "IPv6 enabled: $(docker network inspect bridge | grep 'EnableIPv6')"
# Step 6: Prepare data directory
echo "Setting up data directory..."
mkdir -p /data/ncdata
chown 33:0 /data/ncdata
chmod 750 /data/ncdata
ls -ld /data/ncdata
# Step 7: Run Nextcloud AIO in detached mode with timeout
echo "Starting Nextcloud AIO..."
timeout 60 docker run -d \
--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 \
--env NEXTCLOUD_DATADIR="/data/ncdata" \
ghcr.io/nextcloud-releases/all-in-one:latest || {
echo "Container start timed out or failed. Check logs with 'docker logs nextcloud-aio-mastercontainer'."
exit 1
}
echo "Setup complete! Access the AIO interface at https://[your-ipv4-address-here]:8080"
Save as setup_nextcloud_aio.sh, make executable (chmod +x setup_nextcloud_aio.sh), and run (./setup_nextcloud_aio.sh).
Support
For issues, check logs (docker logs nextcloud-aio-mastercontainer) or contact support with detailed outputs.