Before proceeding, ensure you are using Ubuntu with the following requirements:
- Primary disk: 50GB
- Secondary disk: At least 250GB (adjust as needed for your storage requirements)
Run the following script to install Docker:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.shRun the following command to list available disks:
fdisk -lExample output:
Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors
Disk /dev/sdb: 250 GiB, 268435456000 bytes, 524288000 sectors
mkfs.ext4 /dev/sdbblkidExample output:
/dev/sdb: UUID="f0fe2cb4-7dc2-4221-b2d7-43dca43a3151" BLOCK_SIZE="4096" TYPE="ext4"
Edit /etc/fstab:
nano /etc/fstabAdd the following line:
UUID=f0fe2cb4-7dc2-4221-b2d7-43dca43a3151 /srv/docker/nextcloud ext4 defaults 0 2
mkdir -p /srv/docker/nextcloud
mount -aCheck if the disk is mounted correctly:
df -hExample output:
/dev/sdb 246G 28K 233G 1% /srv/docker/nextcloud
After mounting, the lost+found directory is automatically created on ext4 filesystems. It should be removed before proceeding:
rm -rf /srv/docker/nextcloud/lost+foundIf you want to install the container manually you can continue with manual install
python3 -m venv envsource env/bin/activate # Linux/macOS
env\Scripts\activate # Windowspip install -r requirements.txtpython nextcloud-cli.pydeactivatepython nextcloud-cli.pyThis will set up the following directory structure:
/srv/docker/nextcloud/
├── docker-compose.yml
├── nextcloud.env
├── nextcloud-nginx/
│ ├── nginx.conf
│ ├── Dockerfile
├── data/
│ ├── nc_postgres/
│ ├── nc_redis/
│ ├── nc_html/
│ ├── nc_config/
│ ├── nc_custom_apps/
│ ├── nc_data/
│ ├── nginx_conf/
- Clone the repository
git clone https://github.com/netzint/nextcloud-cli.git /srv/docker/nextcloud
- Copy Configuration File
cp /srv/docker/nextcloud/nextcloud.env.example /srv/docker/nextcloud/nextcloud.env
- Modify Passwords in nextcloud.env
Edit
/srv/docker/nextcloud/nextcloud.envand change:POSTGRES_PASSWORD=YOUR_SECURE_PASSWORD NEXTCLOUD_DB_PASSWORD=YOUR_SECURE_PASSWORD REDIS_PASS=YOUR_SECURE_PASSWORD NEXTCLOUD_ADMIN_PASSWORD=YOUR_SECURE_PASSWORD - Configure Trusted Domains
Open
/srv/docker/nextcloud/nextcloud.envand setNEXTCLOUD_TRUSTED_DOMAINS:NEXTCLOUD_TRUSTED_DOMAINS=your.domain.com - Start the containers
cd /srv/docker/nextcloud docker-compose up -d
python nextcloud-cli.pyThe script will:
- Detect the currently installed Nextcloud version
- Fetch and update to the latest version
- Offer optional updates for PostgreSQL, Redis, and Nginx
- Restart Nextcloud automatically
-
Edit your environment file
nano nextcloud.env
-
Add OnlyOffice configuration
# OnlyOffice Document Server Configuration ONLYOFFICE_SERVER_URL=https://office.your-domain.com ONLYOFFICE_JWT_SECRET=YourJWTSecretHere
./onlyoffice_connect.sh./setup_onlyoffice_cron.shChoose your preferred monitoring frequency:
- Every minute - For production systems with frequent connection issues
- Every 2 minutes - Recommended for critical systems
- Every 5 minutes - Recommended for normal usage
- Every 15 minutes - For stable systems
tail -f logs/onlyoffice_cron.log