Der perfekte Server – Ubuntu 18.04 (Nginx, MySQL, PHP, Postfix, BIND, Dovecot, Pure-FTPD und ISPConfig 3.1)
15. Roundcube Webmail installieren
Um RoundCube Webmail zu installieren, starten Sie:
apt-get -y install roundcube roundcube-core roundcube-mysql roundcube-plugins javascript-common libjs-jquery-mousewheel php-net-sieve tinymce
Das Installationsprogramm wird die folgenden Fragen stellen:
Configure database for roundcube with dbconfig-common? <-- Yes MySQL application password for roundcube: <-- Press enter
Bearbeiten Sie dann die RoundCube-Konfigurationsdatei config.inc.php:
nano /etc/roundcube/config.inc.php
und ändern Sie den Standard-Host in localhost:
$config['default_host'] = 'localhost';
Dies verhindert, dass Roundcube das Eingabefeld für den Servernamen im Anmeldeformular anzeigt.
Nein, erstellen Sie eine Symlib, damit wir die SquirrelMail-Konfiguration in ISPConfig für Roundcube verwenden können:
ln -s /usr/share/roundcube /usr/share/squirrelmail
Nachdem Sie ISPConfig 3 installiert haben, können Sie wie folgt auf Roundcube zugreifen:
Die ISPConfig-Anwendung vhost auf Port 8081 für nginx wird mit einer Roundcube-Konfiguration geliefert, so dass Sie über http://server1.example.com:8081/webmail auf Roundcube zugreifen können.
Wenn Sie einen /webmail-Alias verwenden möchten, den Sie von Ihren Websites aus verwenden können, ist dies etwas komplizierter als beim Apache, da nginx keine globalen Aliase hat (d.h. Aliase, die für alle vhosts definiert werden können). Daher müssen Sie diese Aliase für jeden vhost definieren, von dem aus Sie auf Roundcube zugreifen möchten.
Dazu fügen Sie Folgendes in das Feld nginx-Direktiven auf der Registerkarte Optionen der Website in ISPConfig ein:
location /roundcube { root /usr/share/; index index.php index.html index.htm; location ~ ^/roundcube/(.+\.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; include /etc/nginx/fastcgi_params; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; } location ~* ^/roundcube/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location /webmail { rewrite ^/* /roundcube last; }
Wenn Sie https anstelle von http für Ihren vhost verwenden, sollten Sie die Zeile fastcgi_param HTTPS on; zu Ihrer SquirrelMail-Konfiguration wie folgt hinzufügen:
location /roundcube { root /usr/share/; index index.php index.html index.htm; location ~ ^/roundcube/(.+\.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; fastcgi_param HTTPS on; # <-- add this line fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; include /etc/nginx/fastcgi_params; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; } location ~* ^/roundcube/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location /webmail { rewrite ^/* /roundcube last; }
Wenn Sie sowohl http als auch https für Ihren vhost verwenden, müssen Sie den folgenden Abschnitt zum Abschnitt http {} in /etc/nginx/nginx.conf (vor allen Include-Zeilen) hinzufügen, der bestimmt, ob der Besucher http oder https verwendet und die Variable $fastcgi_https (die wir in unserer Roundcube-Konfiguration verwenden werden) entsprechend setzt:
nano /etc/nginx/nginx.conf
[...] http { [...] ## Detect when HTTPS is used map $scheme $fastcgi_https { default off; https on; } [...] } [...]
Vergessen Sie nicht, nginx danach neu zu laden:
service nginx reload
Gehen Sie dann wieder in das Feld nginx Directives, und statt fastcgi_param HTTPS on; fügen Sie die Zeile fastcgi_param HTTPS $fastcgi_https hinzu; so dass Sie Roundcube sowohl für http- als auch für https-Anfragen verwenden können:
location /roundcube { root /usr/share/; index index.php index.html index.htm; location ~ ^/roundcube/(.+\.php)$ { try_files $uri =404; root /usr/share/; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; fastcgi_param HTTPS $fastcgi_https; # <-- add this line fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $request_filename; include /etc/nginx/fastcgi_params; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_buffer_size 128k; fastcgi_buffers 256 4k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; } location ~* ^/roundcube/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ { root /usr/share/; } } location /webmail { rewrite ^/* /roundcube last; }
16. ISPConfig 3.1 installieren
Bevor Sie mit der Installation von ISPConfig beginnen, stellen Sie sicher, dass Apache gestoppt ist (falls es installiert ist – es ist möglich, dass einige Ihrer installierten Pakete Apache als Abhängigkeit installiert haben, ohne dass Sie davon wissen). Falls Apache2 bereits auf dem System installiert ist, stoppen Sie ihn jetzt…
service apache2 stop
… und entfernen Sie die Systemstart-Verknüpfungen des Apache:
update-rc.d -f apache2 remove
Stellen Sie sicher, dass nginx läuft:
service nginx restart
(Wenn Sie sowohl Apache als auch nginx installiert haben, fragt Sie das Installationsprogramm, welches Sie verwenden möchten: Apache und nginx wurden erkannt: (Wenn Sie sowohl Apache als auch nginx installiert haben, fragt Sie das Installationsprogramm, welchen Sie verwenden möchten. Wählen Sie den Server aus, den Sie für ISPConfig verwenden wollen: (Wenn Sie sowohl Apache als auch nginx installiert haben, fragt Sie das Installationsprogramm, welchen Sie verwenden wollen: Apache und nginx erkannt: (Apache,nginx) [Apache]:
Geben Sie nginx ein. Wenn nur Apache oder Nginx installiert sind, wird dies vom Installationsprogramm automatisch erkannt, und es wird keine Frage gestellt): [apache]: [apache]: [nginx]: [nginx]: [apache]: [nginx]: [apache]: [nginx].
Um ISPConfig 3.1 aus dem stabilen GIT-Zweig zu installieren, tun Sie dies:
cd /tmp wget -O ispconfig.tar.gz https://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz tar xfz ispconfig.tar.gz cd ispconfig3*/install/
Der nächste Schritt ist die Ausführung von
php -q install.php
Dadurch wird das ISPConfig 3.1-Installationsprogramm gestartet. Das Installationsprogramm wird alle Dienste wie Postfix, Dovecot, etc. für Sie konfigurieren.
[email protected]:/tmp/ispconfig3-stable-3.1-da1e393d7bed829d180dd9006019201e3370e77a/install# php install.php
-------------------------------------------------------------------------------- _____ ___________ _____ __ _ ____ |_ _/ ___| ___ \ / __ \ / _(_) /__ \ | | \ `--.| |_/ / | / \/ ___ _ __ | |_ _ __ _ _/ / | | `--. \ __/ | | / _ \| '_ \| _| |/ _` | |_ | _| |_/\__/ / | | \__/\ (_) | | | | | | | (_| | ___\ \ \___/\____/\_| \____/\___/|_| |_|_| |_|\__, | \____/ __/ | |___/ --------------------------------------------------------------------------------
>> Initial configuration
Operating System: Ubuntu 18.04 LTS (Bionic Beaver)
Following will be a few questions for primary configuration so be careful. Default values are in [brackets] and can be accepted with <ENTER>. Tap in "quit" (without the quotes) to stop the installer.
Select language (en,de) [en]: <-- ENTER
Installation mode (standard,expert) [standard]: <-- ENTER
Full qualified hostname (FQDN) of the server, eg server1.domain.tld [server1.example.com]: <-- ENTER
MySQL server hostname [localhost]: <-- ENTER
MySQL server port [3306]: <-- ENTER
MySQL root username [root]: <-- ENTER
MySQL root password []: <--enter the MySQL root password here
MySQL database to create [dbispconfig]: <-- ENTER
MySQL charset [utf8]: <-- ENTER
Configuring Postgrey Configuring Postfix Generating a 4096 bit RSA private key .................................................................................................................................................................................................................................................................................................................................................................................................................++ ...++ writing new private key to 'smtpd.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]: <-- enter your 2 letter country code, e.g. DE in my case State or Province Name (full name) [Some-State]: <-- Enter your home state Locality Name (eg, city) []: <-- Enter your city, in my case Lueneburg Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Enter your company name, in my case ISPConfig UG Organizational Unit Name (eg, section) []: <-- Enter your Organisational unit name, I use IT here Common Name (e.g. server FQDN or YOUR name) []: <-- Enter the server hostname, in my case server1.example.com Email Address []: <-- Enter an email address, e.g. [email protected] Configuring Mailman Configuring Dovecot Configuring Spamassassin Configuring Amavisd Configuring Getmail Configuring Jailkit Configuring Pureftpd Configuring BIND Configuring nginx [INFO] service OpenVZ not detected Configuring Ubuntu Firewall Configuring Metronome XMPP Server writing new private key to 'localhost.key' ----- Country Name (2 letter code) [AU]: <-- Enter your 2 letter country code, e.g. DE in my case
Locality Name (eg, city) [City Name]: <-- Enter your city, in my case Lueneburg
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Enter your company name, in my case ISPConfig UG
Organizational Unit Name (eg, section) [Infrastructure]: <-- Enter your Organisational unit name, I use IT here
Common Name (e.g. server FQDN or YOUR name) [server1.example.com]: <-- Enter the server hostname, in my case server1.example.com
Email Address [[email protected]]: <-- Enter an email address, e.g. [email protected]
IMPORTANT: Localhost Key, Csr and a self-signed Cert have been saved to /etc/metronome/certs In order to work with all clients, the server must have a trusted certificate, so use the Csr to get a trusted certificate from your CA or replace Key and Cert with already signed files for your domain. Clients like Pidgin dont allow to use untrusted self-signed certificates.
Configuring Fail2ban
Configuring Apps vhost
Installing ISPConfig
ISPConfig Port [8080]: <-- ENTER
Admin password [admin]: <-- Enter your desired admin password
Do you want a secure (SSL) connection to the ISPConfig web interface (y,n) [y]: <-- ENTER
Generating RSA private key, 4096 bit long modulus ....................................................++ ........................++ e is 65537 (0x10001) You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]: <-- enter your 2 letter country code, e.g. DE in my case State or Province Name (full name) [Some-State]: <-- Enter your home state Locality Name (eg, city) []: <-- Enter your city, in my case Lueneburg Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- Enter your company name, in my case ISPConfig UG Organizational Unit Name (eg, section) []: <-- Enter your Organisational unit name, I use IT here Common Name (e.g. server FQDN or YOUR name) []: <-- Enter the server hostname, in my case server1.example.com Email Address []: <-- Enter an email address, e.g. [email protected]
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: <-- ENTER An optional company name []: <-- ENTER writing RSA key
Configuring DBServer Installing ISPConfig crontab Installing ISPConfig crontab no crontab for root no crontab for getmail Detect IP addresses Restarting services ... Installation completed.
Das Installationsprogramm konfiguriert automatisch alle zugrundeliegenden Dienste, so dass keine manuelle Konfiguration erforderlich ist.
Danach können Sie auf ISPConfig 3 unter http(s)://server1.example.com:8080/ oder http(s)://192.168.1.100:8080/ zugreifen (http oder https hängt davon ab, was Sie während der Installation ausgewählt haben). Melden Sie sich mit dem Benutzernamen admin und dem Passwort admin an (das Standardpasswort sollten Sie nach der ersten Anmeldung ändern):
Das System ist nun einsatzbereit.
16.1 ISPConfig 3.1 Handbuch
Um den Umgang mit ISPConfig 3 zu erlernen, empfehle ich dringend, das ISPConfig 3.1 Handbuch herunterzuladen.
Auf mehr als 300 Seiten behandelt es das Konzept hinter ISPConfig (Admin, Reseller, Kunden), erklärt, wie man ISPConfig 3 installiert und aktualisiert, enthält eine Referenz für alle Formulare und Formularfelder in ISPConfig zusammen mit Beispielen für gültige Eingaben und bietet Tutorials für die häufigsten Aufgaben in ISPConfig 3. Außerdem wird erläutert, wie Sie Ihren Server sicherer machen können, und am Ende wird ein Abschnitt zur Fehlerbehebung aufgeführt.
17. Links
- Ubuntu: http://www.ubuntu.com/
- ISPConfig: http://www.ispconfig.org/