sudo apt update sudo apt upgrade
sudo apt install lsb-release curl https://packages.sury.org/php/apt.gpg | sudo tee /usr/share/keyrings/suryphp-archive-keyring.gpg >/dev/null echo "deb [signed-by=/usr/share/keyrings/suryphp-archive-keyring.gpg] https://packages.sury.org/php/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/sury-php.list sudo apt update sudo apt upgrade sudo apt install php8.4-cli
sudo apt install php8.4 php8.4-gd php8.4-sqlite3 php8.4-curl php8.4-zip php8.4-xml php8.4-mbstring php8.4-mysql php8.4-bz2 php8.4-intl php8.4-smbclient php8.4-imap php8.4-gmp php8.4-bcmath libapache2-mod-php8.4
echo "<?php echo 'Hello World';" > test.php php8.4 test.phpfix Sury-Repository
grep -R "packages.sury.org/php" /etc/apt/sources.list /etc/apt/sources.list.d/ sudo rm -f /etc/apt/sources.list.d/php.list sudo rm -f /etc/apt/sources.list.d/sury-php.list sudo wget -O /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb sudo dpkg -i /tmp/debsuryorg-archive-keyring.deb echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ bookworm main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt install apache2 sudo service apache2 restartLogfiles
cd /var/log/apache2/ nano error.logTest
sudo nano /var/www/html/info.php
< ?php phpinfo();browse: http://192.168.6.11/info.php
sudo apt install mariadb-server sudo mysql_secure_installationy, rootpw, n, n, y, y, y, y
sudo mysql -u root -p
CREATE DATABASE nextclouddb; CREATE USER 'nextclouduser'@'localhost' IDENTIFIED BY '[PASSWORD]'; GRANT ALL PRIVILEGES ON nextclouddb.* TO 'nextclouduser'@'localhost'; FLUSH PRIVILEGES;quit
sudo apt install php-mysql
cd /var/www/ sudo wget https://download.nextcloud.com/server/releases/latest.tar.bz2 sudo tar -xvf latest.tar.bz2 sudo mkdir -p /var/www/nextcloud/data sudo chown -R www-data:www-data /var/www/nextcloud/ sudo chmod 750 /var/www/nextcloud/data
sudo nano /etc/apache2/sites-available/nextcloud.confadd the following lines
<VirtualHost *:80>
DocumentRoot /var/www/nextcloud/
ServerName shadownextcloud.duckdns.org
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
</VirtualHost>
save (CTRL + S) and exit (CTRL + X)
sudo a2ensite nextcloud.confand restart
sudo systemctl reload apache2 sudo reboot now
shadownextcloud.duckdns.org
sudo mkdir -p /var/nextcloud sudo mv -v /var/www/nextcloud/data /var/nextcloud/data cd /var/www/nextcloud/config sudo cp -p config.php config.php.bk sudo nano config.phpchange line:
'datadirectory' => '/var/www/nextcloud/data',to
'datadirectory' => '/var/nextcloud/data',save (
CTRL + S) and exit (CTRL + X)
sudo chown -R www-data:www-data /var/nextcloud/data
php -i |grep php.iniedit
sudo nano /etc/php/8.4/apache2/php.inifind
memory_limit = max_execution_time: max_input_time: post_max_size = upload_max_filesize =set to
memory_limit = 512M max_execution_time: 3600 max_input_time: 3600 post_max_size = 2G upload_max_filesize = 2G
opcache.interned_strings_buffer=20save (
CTRL + S) and exit (CTRL + X)
sudo service apache2 restart
sudo nano /var/www/nextcloud/config/config.phpadd
'maintenance_window_start' => '1',
cd /etc/nginx/sites-enabled/ sudo nano reverse-proxy.conf
server {
server_name shadownextcloud.duckdns.org;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
root /;
index index.html;
# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
rewrite ^/.well-known/webfinger /nextcloud/public.php?service=webfinger last;
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
deny all;
}
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location / {
proxy_pass http://192.168.6.11;
proxy_set_header Host $host;
}
}
sudo nginx -t && sudo nginx -s reload
sudo nano /etc/php/8.4/cli/php.ini
opcache.interned_strings_buffer=20
sudo nano /var/www/nextcloud/config/config.phpchange/add
'default_phone_region' => 'DE',
sudo nano /var/www/nextcloud/config/config.phpadd/change
'overwritehost' => 'www.shadownextcloud.duckdns.org',
sudo apt-get install imagemagick php8.2-imagick php -m | grep imagick sudo systemctl reload apache2
sudo apt-get install php8.2-apcu sudo apt-get install redis-server php8.2-redis sudo nano /var/www/nextcloud/config/config.phpadd to end
'memcache.local' => '\OC\Memcache\APCu', 'memcache.locking' => '\OC\Memcache\Redis', 'redis' => [ 'host' => 'localhost', 'port' => 6379, ],
sudo nano /etc/php/8.2/apache2/php.iniadd to end
apc.enable_cli=1systemctl restart apache2.service
sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
sudo -u www-data php /var/www/nextcloud/occ db:convert-type --all-apps --password="[PASSWORD]" mysql nextclouduser 127.0.0.1 nextclouddb
sudo -u www-data php /var/www/nextcloud/occ maintenance:repair --include-expensive
sudo truncate -s 0 /var/www/nextcloud/data/nextcloud.log
Sendemosud: SMTP Verschlüsselung: SSL Absendeadresse: [my] @ gmx.de Serveradresse: mail.gmx.net : 465 Zugangsdaten: [my]@gmx.de mysecretpassword
sudo apt install coturn
sudo nano /etc/default/coturn
TURNSERVER_ENABLED=1
sudo nano /etc/turnserver.conf
listening-port=3478 fingerprint lt-cred-mech use-auth-secret static-auth-secret=???????? realm=shadownextcloud.duckdns.org total-quota=100 bps-capacity=0 stale-nonce no-loopback-peers no-multicast-peers
sudo systemctl edit coturn.service
[Service] ExecStartPre=/bin/sleep 30
sudo service coturn restart
apt install openssh-server unzip wget sudo nano jq
wget -O latest.zip $(wget -q -O - 'https://api.github.com/repos/sunweaver/nextcloud-high-performance-backend-setup/releases/latest' | jq -r '.zipball_url')
unzip latest.zip cd sunweaver-nextcloud-high-performance-backend-setup-*
nano settings.sh
# !!! Be careful, this script will be executed by the root user. !!! # Please have a look at this Wiki page for this file: # NOTE: It's in german. # https://github.com/sunweaver/nextcloud-high-performance-backend-setup/wiki/02-Setup-Script # Dry run (Don't actually alter anything on the system. (except in $TMP_DIR_PATH)) # Leave empty, if you wish that the user will be asked about this. DRY_RUN=false # Should the script try to install the high-performance-backend server # without any user input? UNATTENDED_INSTALL=true # General settings # Leave empty, if you wish that the user will be asked about this. # You can also specify multiple Nextcloud servers by separating them with commas. NEXTCLOUD_SERVER_FQDNS="shadownextcloud.duckdns.org" # Leave empty, if you wish that the user will be asked about this. SERVER_FQDN="shadowtalk.duckdns.org" # Only modify if you know what you're doing. #SSL_CERT_PATH_RSA="" #SSL_CERT_KEY_PATH_RSA="" #SSL_CHAIN_PATH_RSA="" #SSL_CERT_PATH_ECDSA="" #SSL_CERT_KEY_PATH_ECDSA="" #SSL_CHAIN_PATH_ECDSA="" #DHPARAM_PATH="" # Collabora (Gets asked anyway, except unattended install.) SHOULD_INSTALL_COLLABORA=true # Signaling (Gets asked anyway, except unattended install.) SHOULD_INSTALL_SIGNALING=true SHOULD_INSTALL_UFW=true SHOULD_INSTALL_NGINX=true SHOULD_INSTALL_CERTBOT=true SHOULD_INSTALL_UNATTENDEDUPGRADES=true SHOULD_INSTALL_MSMTP=true # Logfile get created if UNATTENDED_INSTALL is true. # Leave empty, if you wish that the user will be asked about this. LOGFILE_PATH="./setup-nextcloud-hpb-$(date +%Y-%m-%dT%H:%M:%SZ).log" # Configuration gets copied and prepared here before copying them into place. # This prevents config being broken if something goes wrong. # Leave empty, if you wish that the user will be asked about this. TMP_DIR_PATH="./tmp" # Secrets, passwords and configuration gets saved in this file. # Leave empty, if you wish that the user will be asked about this. SECRETS_FILE_PATH="sfp" # This email address gets passed on to the services the user whiches to install. # The services (like Certbot) can send email notification for important info. # Leave empty, if you wish that the user will be asked about this. EMAIL_USER_ADDRESS="shadowpage@gmx.de" # The password for the address above. Used to authenticate to the SMTP server. EMAIL_USER_PASSWORD="22Shadow08!" # The username to authencicate with. Most likely it will be just the full email # address. But there are email hoster which require a different username. EMAIL_USER_USERNAME="shadowpage@gmx.de" # The SMTP server to send the emails to. EMAIL_SERVER_HOST="mail.gmx.net" # The port on which we will try to connect to the SMTP server. #EMAIL_SERVER_PORT="25" #EMAIL_SERVER_PORT="587" EMAIL_SERVER_PORT="465" # Should the ssh service be disabled? DISABLE_SSH_SERVER=false # Should nextcloud-spreed-signaling, nats-server and coturn be built and # installed from sources? SIGNALING_BUILD_FROM_SOURCES="yes" # DNS Resolver. Here a custom DNS server can be specified, # otherwise the one configured in resolv.conf is used DNS_RESOLVER="192.168.6.5"
sudo ./setup-nextcloud-hpb.sh settings.sh
rsync -Aavx nextcloud/ nextcloud-dirbkp_`date +"%Y%m%d"`/Backup database SQLite
sqlite3 data/owncloud.db .dump > nextcloud-sqlbkp_`date +"%Y%m%d"`.bak
sudo apt update sudo apt install restic rsync openssh-client cifs-utils -y sudo adduser backup sudo usermod -aG sudo backup su - backupNAS-Freigabe
sudo mkdir -p /mnt/nas-backup sudo mount -t cifs //NAS-IP/Backup /mnt/nas-backup \ -o username=backup
rsync -Aax nextcloud-dirbkp/ nextcloud/Restore database SQLite
mysql -h [server] -u [username] -p[password] [db_name] < nextcloud-sqlbkp.bak
restic snapshots \
--repo /mnt/nas-backup/restic \
--password-file ~/.restic-pass
mkdir -p /mnt/nas-backup/restore-tests/fullrestore
restic restore latest \
--target /mnt/nas-backup/restore-tests/fullrestore \
--repo /mnt/nas-backup/restic \
--password-file ~/.restic-pass
ls -lh /mnt/nas-backup/restore-tests/fullrestore/mnt/nas-backup/staging/nextcloud Dort sollten liegen:
config-db/ – Nextcloud-Konfiguration und SQLite-Dumpdata/ – Nextcloud-Datenverzeichnissudo rsync -a /mnt/nas-backup/restore-tests/fullrestore/mnt/nas-backup/staging/nextcloud/data/ \
/var/www/nextcloud/data/
cd /mnt/nas-backup/restore-tests/fullrestore/mnt/nas-backup/staging/nextcloud/config-db
tar -xzf nextcloud-config-*.tar.gz
sudo rsync -a var/www/nextcloud/config/ /var/www/nextcloud/config/
sudo chown -R www-data:www-data /var/www/nextcloud/config
sudo chown -R www-data:www-data /var/www/nextcloud/data
cd /var/www/nextcloud
sudo -u www-data php occ status
sudo -u www-data php occ files:scan --all
Hinweis: Bei SQLite kann die Datenbankdatei je nach Setup direkt in /var/www/nextcloud/data/ liegen. Vor einem echten Restore immer Pfade prüfen.
sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices