Roundcube Installation

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen


Voraussetzungen

  • Ein funktionierender Mailserver mit IMAP (z. B. Dovecot) und SMTP (z. B. Postfix)
  • Ein Debian 12-Server mit Apache2, MariaDB und PHP 8.2
  • Eine registrierte Domain (z. B. webmail.example.com)
  • Let's Encrypt oder ein anderes SSL-Zertifikat für HTTPS

Dateien herunterladen

Apache-Konfiguration erstellen

  • Virtuelle Host-Datei erstellen
    • nano /etc/apache2/sites-available/roundcube.conf
<VirtualHost *:80>
     ServerAdmin webmaster@example.com
     DocumentRoot /var/www/roundcube/
     ServerName webmail.example.com
     ServerAlias webmail.example.com
     <Directory /var/www/roundcube/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
          <IfModule mod_dav.c>
            Dav off
          </IfModule>
        SetEnv HOME /var/www/roundcube
        SetEnv HTTP_HOME /var/www/roundcube
     </Directory>
     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
  • Seite aktivieren und Apache neu starten
    • a2ensite roundcube.conf
    • systemctl restart apache2

Datenbank einrichten

  • MariaDB starten
    • mysql -u root -p
  • Datenbank und Benutzer erstellen
    • CREATE DATABASE roundcube;
    • CREATE USER 'roundcubeuser'@'localhost' IDENTIFIED BY 'sicherespasswort';
    • GRANT ALL PRIVILEGES ON roundcube.* TO 'roundcubeuser'@'localhost';
    • FLUSH PRIVILEGES;
    • EXIT;

Berechtigungen setzen

  • Eigentümer und Berechtigungen anpassen
    • chown -R www-data:www-data /var/www/roundcube/
    • chmod -R 750 /var/www/roundcube/

Sicherheitsmaßnahmen

  • SSL-Verschlüsselung aktivieren
    • Let's Encrypt-Zertifikat einrichten
      • apt install certbot python3-certbot-apache
      • certbot --apache -d webmail.example.com
  • Das installer-Verzeichnis nach der Installation entfernen
    • rm -rf /var/www/roundcube/installer
  • Konfigurationsdateien absichern
    • chmod 640 /var/www/roundcube/config/config.inc.php
    • chown root:www-data /var/www/roundcube/config/config.inc.php
  • Apache-Sicherheitsheader setzen
    • Datei /etc/apache2/conf-available/security.conf anpassen
Header always set X-Frame-Options DENY
Header always set X-XSS-Protection "1; mode=block"
Header always set X-Content-Type-Options nosniff
    • a2enmod headers
    • systemctl restart apache2

PHP-Konfiguration für Roundcube

<?php
// Beispiel für eine PHP-Konfigurationsdatei für Roundcube
$config = array();
$config['db_dsnw'] = 'mysql://roundcubeuser:sicherespasswort@localhost/roundcube';
$config['default_host'] = 'localhost';
$config['smtp_server'] = 'localhost';
$config['smtp_port'] = 587;
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['enable_installer'] = false;
$config['log_dir'] = '/var/log/roundcube';
$config['temp_dir'] = '/tmp';
?>

Installation abschließen

Falls es Probleme gibt, kann die offizielle Dokumentation unter https://roundcube.net/help konsultiert werden.