Nextcloud
Create User
sudo sed -i '$ a cloud:*:3000:3000::/data/cloud:/bin/sh' /etc/passwd
sudo sed -i '$ a cloud:x:3000:' /etc/group
sudo mkdir -p /data/cloud
sudo chown cloud: /data/cloud
Install Software
PHPVERSION=x.x
sudo apt install redis-server nginx php-redis php$PHPVERSION-{cli,curl,fpm,gd,intl,mbstring,sqlite3,xml,zip}
wget https://download.nextcloud.com/server/releases/latest.zip
sudo -u cloud unzip -d /data/cloud ~/latest.zip
Apply Configuration
DOMAIN=example.com
sudo cp nginx.conf /etc/nginx/sites-available/nextcloud
sudo cp fpm.conf /etc/php/nextcloud.conf
sudo ln -s /etc/php/nextcloud.conf /etc/php/*/fpm/pool.d
sudo sed -i '$ r redis.conf' /etc/redis/redis.conf
sudo -u cloud cp local.config.php /data/cloud/nextcloud/config
sudo -u cloud crontab crontab
sudo ln -s ../sites-available/nextcloud /etc/nginx/sites-enabled
sudo sed -i s/example.com/$DOMAIN/ /etc/nginx/sites-available/nextcloud /data/cloud/nextcloud/config/local.config.php
sudo -u cloud mkdir -p /data/cloud/.config/user-tmpfiles.d
echo 'e %h/data/*/files/tmp - - - 7d' | sudo -u cloud tee /data/cloud/.config/user-tmpfiles.d/nextcloud-tmp.conf