Configuración de ISPConfig Perfect Multiserver en Ubuntu 20.04 y Debian 10 – Página 7
8 Instalación del servidor de correo web
Este es un paso opcional, si no desea un servidor de correo web separado, salte al siguiente paso.
Iniciar sesión como root o ejecutar
su -
para convertirse en usuario root en su servidor antes de continuar. IMPORTANTE: debe usar ‘su -‘ y no solo ‘su’, de lo contrario, Debian configura incorrectamente su variable PATH.
8.1 Configurar el nombre de host
El nombre de host de su servidor debe ser un subdominio como «panel.example.com». No use un nombre de dominio sin una parte de subdominio como «example.com» como nombre de host, ya que esto causará problemas más adelante con la configuración de su correo. Primero, debe verificar el nombre de host en /etc/hosts y cambiarlo cuando sea necesario. La línea debe ser: «Dirección IP – espacio – nombre de host completo, incluido el dominio – espacio – parte del subdominio». Para nuestro nombre de host webmail.example.com, el archivo se verá así:
nano /etc/hosts
127.0.0.1 localhost.localdomain localhost # This line should be changed on every node to the correct servername: 127.0.1.1 webmail.example.com webmail # These lines are the same on every node: 10.0.64.12 panel.example.com panel 10.0.64.13 web01.example.com web01 10.0.64.14 mx1.example.com mx1 10.0.64.15 mx2.example.com mx2 10.0.64.16 ns1.example.com ns1 10.0.64.17 ns2.example.com ns2 10.0.64.18 webmail.example.com webmail # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters
Como puede ver, también agregamos los nombres de host de nuestros otros servidores, para que puedan comunicarse a través de la red interna más tarde.
Luego edite el archivo /etc/hostname:
nano /etc/hostname
Contendrá únicamente la parte del subdominio, en nuestro caso:
webmail
Finalmente, reinicie el servidor para aplicar el cambio:
systemctl reboot
Inicie sesión nuevamente y verifique si el nombre de host es correcto ahora con estos comandos:
hostname hostname -f
La salida será así:
[email protected]:~$ hostname webmail [email protected]:~$ hostname -f webmail.example.com
8.2 Instalación de ISPConfig
Ahora podemos ejecutar el instalador automático para todos los paquetes e ISPConfig:
wget -O - https://get.ispconfig.org | sh -s -- --no-mail --no-dns --roundcube --use-php=system --interactive
Después de un tiempo, verás:
WARNING! This script will reconfigure your complete server! It should be run on a freshly installed server and all current configuration that you have done will most likely be lost! Type 'yes' if you really want to continue:
Responda «sí» y presione enter. Ahora se iniciará el instalador.
Cuando finalice la instalación y configuración de los paquetes, se mostrará la contraseña de root para MySQL en el correo web. Anote esto (junto con el nombre del servidor, para evitar confusiones más adelante).
Ahora tendremos que responder algunas preguntas ya que estamos usando el modo interactivo. Esto es necesario ya que este servidor se agregará a su configuración multiservidor.
[INFO] Installing ISPConfig3. [INFO] Your MySQL root password is: kl3994aMsfkkeE -------------------------------------------------------------------------------- _____ ___________ _____ __ _ ____ |_ _/ ___| ___ \ / __ \ / _(_) /__ \ | | \ `--.| |_/ / | / \/ ___ _ __ | |_ _ __ _ _/ / | | `--. \ __/ | | / _ \| '_ \| _| |/ _` | |_ | _| |_/\__/ / | | \__/\ (_) | | | | | | | (_| | ___\ \ \___/\____/\_| \____/\___/|_| |_|_| |_|\__, | \____/ __/ | |___/ -------------------------------------------------------------------------------- >> Initial configuration Operating System: Debian 10.0 (Buster) or compatible 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]: <-- Hit enter Installation mode (standard,expert) [standard]: <-- expert Full qualified hostname (FQDN) of the server, eg server1.domain.tld [webmail.example.com]: <-- Hit Enter MySQL server hostname [localhost]: <-- Hit Enter MySQL server port [3306]: <-- Hit Enter MySQL root username [root]: <-- Hit Enter MySQL root password []: <-- Enter the MySQL password the script just gave you MySQL database to create [dbispconfig]: <-- Hit Enter MySQL charset [utf8]: <-- Hit Enter The next two questions are about the internal ISPConfig database user and password. It is recommended to accept the defaults which are 'ispconfig' as username and a random password. If you use a different password, use only numbers and chars for the password. ISPConfig mysql database username [ispconfig]: <-- Hit Enter ISPConfig mysql database password [aakl203920459853sak20284204]: <-- Hit Enter Shall this server join an existing ISPConfig multiserver setup (y,n) [n]: <-- y MySQL master server hostname []: <-- panel.example.com MySQL master server port []: <-- Hit Enter MySQL master server root username [root]: <-- Hit Enter MySQL master server root password []: <-- the password you gave the external root user on the master server. MySQL master server database name [dbispconfig]: <-- Hit Enter Adding ISPConfig server record to database. Configure Mail (y,n) [y]: <-- n Configuring Jailkit Configuring Pureftpd Configure DNS Server (y,n) [y]: <-- n The Web Server option has to be enabled when you want run a web server or when this node shall host the ISPConfig interface. Configure Web Server (y,n) [y]: <-- Hit enter Configuring Apache Configuring vlogger [WARN] autodetect for OpenVZ failed Force configure OpenVZ (y,n) [n]: <-- Hit enter Skipping OpenVZ Configure Firewall Server (y,n) [y]: <-- Hit enter Configuring Ubuntu Firewall [WARN] autodetect for Metronome XMPP Server failed Force configure Metronome XMPP Server (y,n) [n]: <-- Hit enter Skipping Metronome XMPP Server Configuring Fail2ban Install ISPConfig Web Interface (y,n) [n]: <-- Hit enter Do you want to create SSL certs for your server? (y,n) [y]: <-- n Configuring Apps vhost Configuring DBServer Installing ISPConfig crontab Detect IP addresses Restarting services ... Installation completed. [INFO] Adding php versions to ISPConfig. [INFO] Checking all services are running. [INFO] mysql: OK [INFO] clamav-daemon: OK [INFO] postfix: OK [INFO] bind9: OK [INFO] pureftpd: OK [INFO] apache2: OK [INFO] Installation ready. [INFO] Your MySQL root password is: kl3994aMsfkkeE [INFO] Warning: Please delete the log files in /tmp/ispconfig-ai/var/log/setup-* once you don't need them anymore because they contain your passwords!
8.3 Configurar el sitio de correo web
Ahora vamos a configurar el sitio web de correo web. Primero, deshabilitaremos la configuración predeterminada de Apache, ya que de lo contrario interferirá con el sitio de correo web:
a2dissite 000-default systemctl reload apache2
Ahora inicie sesión en ISPConfig y vaya a Sitios -> Agregar nuevo sitio web.
Introduzca «webmail.example.com» como dominio. Deshabilite el subdominio automático y habilite Let’s Encrypt. También habilite PHP.
Una conexión segura es importante, así que vaya a la pestaña Redirigir y habilite «Reescribir HTTP a HTTPS».
Ahora, vaya a la pestaña de opciones y agregue el siguiente fragmento de directiva de Apache:
DocumentRoot "/var/lib/roundcube/public_html" Alias "/stats" "{DOCROOT}/stats"
Haga clic en Guardar para guardar esta configuración.
8.4 Configuración de cubo redondo
Vamos a ajustar la configuración para que use MX2 como servidor IMAP y MX1 como servidor SMTP. Puede cambiar esto según sus propias necesidades/ideas.
nano /etc/roundcube/config.inc.php
Tendrá que ajustar la siguiente configuración para que se vea así:
$config['default_host'] = 'ssl://mx2.example.com'; $config['smtp_server'] = 'tls://mx1.example.com'; $config['smtp_port'] = 587;
8.5 Configuración del cortafuegos
Lo último que debemos hacer es configurar nuestro firewall.
Inicie sesión en la interfaz de usuario de ISPConfig y vaya a Sistema -> Firewall. Luego haga clic en «Agregar nuevo registro de firewall».
Asegúrese de seleccionar el servidor correcto. Para nuestro servidor de correo web, tenemos que abrir los siguientes puertos:
TCP:
22,80,443
No es necesario abrir puertos UDP a través de la interfaz de usuario.
También vamos a abrir el puerto 3306, que se usa para MySQL, pero solo desde nuestra red local por razones de seguridad. Para hacerlo, ejecute el siguiente comando desde la CLI, después de que se propague el cambio desde el panel ISPConfig (cuando el punto rojo desaparezca):
ufw allow from 10.0.64.0/24 to any port 3306 proto tcp
Su servidor de correo web ahora está listo para usar. Si desea integrar Roundcube con la función de usuario de correo de ISPConfig, donde cualquier cuenta de correo puede cambiar su propia contraseña, la configuración del filtro de spam, la respuesta automática y más, eche un vistazo a esta guía.