Webserver mit Debian Bullseye Unterbau für Groupware wie Nextcloud

installieren, modifizeren, administrieren
Post Reply
User avatar
h3rb3rn
Administrator
Posts: 189
Joined: Mon 9. Feb 2015, 23:29

Webserver mit Debian Bullseye Unterbau für Groupware wie Nextcloud

Post by h3rb3rn »

aktualisierte Fassung vom 09.11.2022

Das Hostsystem

Debian Debian 11.5 Bullseye amd64

Automatisierte Installation
setup_isp_debian.sh
(7.4 KiB) Downloaded 245 times

Code: Select all

cd ~;
wget https://4noobs.de/download/file.php?id=252 -O setup_isp_debian.sh;
chmod u+x setup_isp_debian.sh;
./setup_isp_debian.sh


Manuelle Installation
Repo von Debian Buster

Code: Select all

deb http://deb.debian.org/debian buster main contrib non-free
deb-src http://deb.debian.org/debian buster main contrib non-free

deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free
deb-src http://deb.debian.org/debian-security/ buster/updates main contrib non-free

deb http://deb.debian.org/debian buster-updates main contrib non-free
deb-src http://deb.debian.org/debian buster-updates main contrib non-free

deb http://deb.debian.org/debian buster-backports main contrib non-free
deb-src http://deb.debian.org/debian buster-backports main contrib non-free


Debian Server installieren (Server oder Desktop ist egal)

Wichtig: wer per SSH seinen Server aufsetzt, der sollte alle Schritte in einer Bash ausführen welche in einer Screen Session gestartet wurde. Nur so führt der Server alle Schritte bis zum Ende aus auch wenn die SSH Session unterbrochen wurde.

Code: Select all

sudo apt update && sudo  apt -y install screen
Screen Session starten mit

Code: Select all

sudo screen bash
Hostname an die öffentliche Domain anpassen (wenn bei der Installation des Basis Systems noch nicht geschehen)

Der Hostname muss identisch (gleichnamig) sein zur verwendete Domain oder Subdomain die auf die Server IP zeigt. Die Server IP muss in der Domainverwaltung der Nameserver Einstellungen hinterlegt sein.

Beispiel:

Code: Select all

sudo nano /etc/hosts
Inhalt von /etc/hosts

Code: Select all

127.0.0.1       localhost
127.0.1.1       cloud.4noobs.de cloud

# The following lines are desirable for IPv6 capable hosts
#::1     localhost ip6-localhost ip6-loopback
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters

Code: Select all

sudo nano /etc/hostname
Inhalt von /etc/hostname

Code: Select all

cloud

Server anschließend neu starten damit der neue Hostname übernommen wird.

Hinweis: Wenn die IP des Servers nicht in den Nameserver Einstellungen der Domain hinterlegt ist, kann der Hostname nicht aufgelöst werden. Dadurch lässt sich der Mailserver Dienst amavisd-new nicht konfigurieren.

Bei Heimservern, welche hinter einem DSL Anschluss mit öffentlicher IPv4 Adresse hängen, muss statt der Server IP die öffentliche IPv4 Adresse des DSL Anschlusses in den Nameserver Einstellungen der verwendeten Domain hinterlegt werden. Wer keine feste IP Adresse hat kann stattdessen auch einen CNAME Eintrag einen DynDNS Dienstes in den Nameserver Einstellungen hinterlegen. Zusätzlich muss ein Portforwarding im Router auf die lokale IP des Servers eingerichtet werden.
https://4noobs.de/viewtopic.php?f=4&t=1 ... rcona#p153


System bereinigen und für Groupware Installation vorbereiten

Code: Select all

sudo service sendmail stop; update-rc.d -f sendmail remove
Grundinstallation für Webservices und Verschlüsselungszertifikate

Paketquellen aktualisieren

Code: Select all

sudo apt update && sudo apt -y full-upgrade
Tools und Webserver

Code: Select all

sudo apt -y install ssh vim atop htop btop rsync mc net-tools openssh-server ntp postfix postfix-mysql postfix-doc mariadb-client mariadb-server openssl sudo apt-transport-https lsb-release ca-certificates curl

Code: Select all

mkdir -p /etc/systemd/system/mysql.service.d/

touch /etc/systemd/system/mysql.service.d/limits.conf;
echo '[Service]' > /etc/systemd/system/mysql.service.d/limits.conf;
echo 'LimitNOFILE=infinity' >> /etc/systemd/system/mysql.service.d/limits.conf

Code: Select all

apt install -y apache2 apache2-doc apache2-utils libapache2-mod-php php7.3 php7.3-common php7.3-gd php7.3-mysql php7.3-imap php7.3-cli php7.3-cgi libapache2-mod-fcgid apache2-suexec-pristine php-pear mcrypt  imagemagick libruby libapache2-mod-python php7.3-curl php7.3-intl php7.3-pspell php7.3-recode php7.3-sqlite3 php7.3-tidy php7.3-xmlrpc php7.3-xsl memcached php-memcache php-imagick php7.3-zip php7.3-mbstring memcached libapache2-mod-passenger php7.3-soap php7.3-fpm php7.3-opcache php-apcu libapache2-reload-perl patch certbot;

Code: Select all

a2enmod suexec rewrite ssl actions include dav_fs dav auth_digest cgi headers actions proxy_fcgi alias;
Quelle: https://packages.sury.org/php/README.txt

Code: Select all

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

Code: Select all

sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
Multi PHP Version

Code: Select all

sudo apt-get update && sudo apt -y install php-mysql php7.3 php7.3-common php7.3-gd php7.3-mysql php7.3-imap php7.3-cli php7.3-cgi php7.3-curl php7.3-intl php7.3-pspell php7.3-sqlite3 php7.3-tidy php7.3-xmlrpc php7.3-xsl php7.3-opcache php7.3-fpm php7.3-raphf php7.3-propro php7.3-zip php7.3-mbstring php7.3-bcmath php7.3-gmp php7.3-imagick php7.4 php7.4-common php7.4-gd php7.4-mysql php7.4-imap php7.4-cli php7.4-cgi php7.4-curl php7.4-intl php7.4-pspell php7.4-sqlite3 php7.4-tidy php7.4-xmlrpc php7.4-xsl php7.4-opcache php7.4-fpm php7.4-raphf php7.4-propro php7.4-zip php7.4-mbstring php7.4-bcmath php7.4-gmp php7.4-imagick php8.0 php8.0-common php8.0-gd php8.0-mysql php8.0-imap php8.0-cli php8.0-cgi php8.0-curl php8.0-intl php8.0-pspell php8.0-sqlite3 php8.0-tidy php8.0-xmlrpc php8.0-xsl php8.0-opcache php8.0-fpm php8.0-raphf php8.0-zip php8.0-mbstring php8.0-bcmath php8.0-gmp php8.0-imagick php8.1 php8.1-common php8.1-gd php8.1-mysql php8.1-imap php8.1-cli php8.1-cgi php8.1-curl php8.1-intl php8.1-pspell php8.1-sqlite3 php8.1-tidy php8.1-xmlrpc php8.1-xsl php8.1-opcache php8.1-fpm php8.1-raphf php8.1-zip php8.1-mbstring php8.1-bcmath php8.1-gmp php8.1-imagick php-apcu php-pear imagemagick libruby redis-server php-memcache php-imagick php-gettext php-bcmath php-gmp php-imagick openssl easy-rsa openvpn aptitude libreoffice clamav libnet-ldap-perl libconvert-asn1-perl ntp ntpdate  bind9 dnsutils haveged fail2ban ufw javascript-common libjs-jquery-mousewheel php-net-sieve tinymce libnet-rblclient-perl libparse-syslog-perl php-mbstring php-curl software-properties-common

Code: Select all

update-alternatives --set php /usr/bin/php7.3;

Code: Select all

touch /etc/apache2/conf-available/httpoxy.conf;
echo '<IfModule mod_headers.c>' > /etc/apache2/conf-available/httpoxy.conf;
echo '    RequestHeader unset Proxy early' >> /etc/apache2/conf-available/httpoxy.conf;
echo '</IfModule>' >> /etc/apache2/conf-available/httpoxy.conf;
a2enconf httpoxy;
systemctl restart apache2;
PureFTP Server installieren

Code: Select all

apt -y install pure-ftpd-common pure-ftpd-mysql;

openssl dhparam -out /etc/ssl/private/pure-ftpd-dhparams.pem 2048;

sed -i 's/^VIRTUALCHROOT=false/VIRTUALCHROOT=true/g' /etc/default/pure-ftpd-common;

echo 1 > /etc/pure-ftpd/conf/TLS;

mkdir -p /etc/ssl/private/;

openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem -subj "/C=DE/ST=Country/L=City/O=Company/CN=domain.tld";

chmod 600 /etc/ssl/private/pure-ftpd.pem;

systemctl restart pure-ftpd-mysql;
Mailserver Komponenten

Installieren

Code: Select all

sudo apt -y install amavisd-new spamassassin clamav clamav-daemon unzip bzip2 arj nomarch lzop cabextract p7zip p7zip-full unrar lrzip apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl libdbd-mysql-perl postgrey;
Konfigurieren

Code: Select all

sudo service spamassassin stop 
update-rc.d -f spamassassin remove

Code: Select all

sed -i 's/#smtp      inet  n       -       y       -       1       postscreen/465       inet  n       -       y       -       -       smtpd/g' /etc/postfix/master.cf;
sed -i 's/#  -o syslog_name=postfix\/submission/  -o syslog_name=postfix\/submission/g' /etc/postfix/master.cf;
sed -i 's/#  -o smtpd_tls_security_level=encrypt/  -o smtpd_tls_security_level=encrypt/g' /etc/postfix/master.cf;
sed -i 's/#  -o smtpd_sasl_auth_enable=yes/  -o smtpd_sasl_auth_enable=yes/g' /etc/postfix/master.cf;
sed -i 's/#  -o smtpd_client_restrictions=$mua_client_restrictions/  -o smtpd_client_restrictions=permit_sasl_authenticated,reject/g' /etc/postfix/master.cf;
sed -i 's/#  -o syslog_name=postfix\/smtps/  -o syslog_name=postfix\/smtps/g' /etc/postfix/master.cf;
sed -i 's/#  -o smtpd_tls_wrappermode=yes/  -o smtpd_tls_wrappermode=yes/g' /etc/postfix/master.cf;
sed -i 's/#  -o smtpd_sasl_auth_enable=yes/  -o smtpd_sasl_auth_enable=yes/g' /etc/postfix/master.cf;
sed -i 's/#  -o smtpd_client_restrictions=$mua_client_restrictions/  -o smtpd_client_restrictions=permit_sasl_authenticated,reject/g' /etc/postfix/master.cf;

systemctl restart postfix.service;

Code: Select all

sed -i 's/^AllowSupplementaryGroups.*//g' /etc/clamav/clamd.conf;
echo 'AllowSupplementaryGroups true' >> /etc/clamav/clamd.conf;

Code: Select all

sudo freshclam
sudo service clamav-daemon start


ISPConfig3 installieren

Code: Select all

cd /tmp
wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
tar xzf ISPConfig-3-stable.tar.gz
cd ispconfig3_install
cd install
php install.php

Hinweis: für ein Update von ISPConfig3 den gleichen Weg gehen, aber statt "php install.php" muss "php update.php" ausgeführt werden!


Nach der Installation von ISPConfig3 Rechner neustarten und über das

Webinterfache https://ipdesservers:8080 aufrufen und mit

Benutzer: admin
Passwort: "das bei der Installation vergebene Passwort"

einloggen.
Post Reply