#!/bin/bash if [ "$(whoami)" != "root" ]; then SUDO=sudo fi apt-get -y install apt-transport-https lsb-release ca-certificates curl -y wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list' apt-get update -y sudo apt install php7.4-fpm php7.4-curl php7.4-cli php7.4-mysql php7.4-gd php7.4-common php7.4-xml php7.4-json php7.4-intl php7.4-dev php7.4-common php7.4-mbstring php7.4-zip php7.4-soap php7.4-bz2 -y sudo apt update sudo apt install nginx -y systemctl start nginx systemctl enable nginx systemctl status nginx cd /etc/php/7.4/ echo 'date.timezone = Europe/Paris' >> fpm/php.ini echo 'date.timezone = Europe/Paris' >> cli/php.ini echo 'cgi.fix_pathinfo=0' >> fpm/php.ini echo 'cgi.fix_pathinfo=0' >> cli/php.ini echo 'env[HOSTNAME] = $HOSTNAME' >> fpm/pool.d/www.conf echo 'env[PATH] = /usr/local/bin:/usr/bin:/bin' >> fpm/pool.d/www.conf echo 'env[TMP] = /tmp' >> fpm/pool.d/www.conf echo 'env[TMPDIR] = /tmp' >> fpm/pool.d/www.conf echo 'env[TEMP] = /tmp' >> fpm/pool.d/www.conf systemctl restart php7.4-fpm systemctl enable php7.4-fpm ss -xa | grep php systemctl status php7.4-fpm sudo apt install mariadb-server -y systemctl start mariadb systemctl enable mariadb systemctl status mariadb mysql_secure_installation #Enter current password for root (enter for none): Press Enter #Set root password? [Y/n] Y #Remove anonymous users? [Y/n] Y #Disallow root login remotely? [Y/n] Y #Remove test database and access to it? [Y/n] Y #Reload privilege tables now? [Y/n] Y mysql -u root -p #TYPE THE MYSQL ROOT PASSWORD #create database nextcloud_db; #create user nextclouduser@localhost identified by 'P@SSW0RD'; #grant all privileges on nextcloud_db.* to nextclouduser@localhost identified by 'P@SSW0RD'; #flush privileges; #CREDENTIALS FOR NEXTCLOUD_DB : nextclouduser:P@SSW0RD (needed for later) apt install certbot -y systemctl stop nginx #sign in with github to https://www.duckdns.org/ certbot certonly --standalone -d ech2.duckdns.org sudo apt install wget unzip zip -y cd /var/www/ wget -q https://download.nextcloud.com/server/releases/latest.zip unzip -qq latest.zip sudo chown -R www-data:www-data /var/www/nextcloud cd /etc/nginx/sites-available/ wget https://ech1.netlify.app/servers/nextcloud/nginx.conf -O nextcloud nano nextcloud #edit the ech2 to something else (CTRL+W ech2 then enter) #once ur done do ctrl+X to quit ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/ nginx -t systemctl restart nginx systemctl restart php7.4-fpm apt install ufw ufw allow ssh ufw allow http ufw allow https ufw enable ufw status numbered #https://ech2.duckdns.org #new creds for admin user #then the mysql creds (nextclouduser:P@SSW0RD)