AlmaLinux 9
Sponsored Link

Apache httpd : Web Mail : RoundCube2023/03/03

 
Install RoundCube to configure web-based mail transfer System.
On this example, it uses 2 servers like follows to configure RoundCube Mail.
+----------------------+          |          +----------------------+
|  [  www.srv.world  ] |10.0.0.31 | 10.0.0.32|  [ mail.srv.world  ] |
|     Apache httpd     +----------+----------+        Postfix       |
|      (Roundcube)     |                     |        Dovecot       |
|       MariaDB        |                     |                      |
+----------------------+                     +----------------------+

[1]
[2]
[3]
[4]
[5]
Configure SSL/TLS settings on httpd Server, refer to here. (Optional but strongly recommended)
[6]
[7] Create a Database for RoundCube.
[root@www ~]#
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 56
Server version: 10.5.13-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

# create [roundcube] database
# replace [password] to your own password you'd like to set
MariaDB [(none)]> create database roundcubemail;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> grant all privileges on roundcubemail.* to roundcube@'localhost' identified by 'password';
Query OK, 0 rows affected (0.083 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> exit
Bye
[8] Install and Configure RoundCube.
# install from EPEL

[root@www ~]#
dnf --enablerepo=epel -y install roundcubemail php-mysqlnd
[root@www ~]#
cd /usr/share/roundcubemail/SQL

[root@www SQL]#
mysql -u roundcube -D roundcubemail -p < mysql.initial.sql

Enter password:  
# MariaDB roundcube password

[root@www SQL]#
[root@www ~]#
cp -p /etc/roundcubemail/config.inc.php.sample /etc/roundcubemail/config.inc.php

[root@www ~]#
vi /etc/roundcubemail/config.inc.php
# lie 28 : set DB connection info
# replace to your own password for [password] section
$config['db_dsnw'] = 'mysql://roundcube:password@localhost/roundcubemail';

# line 41 : specify IMAP server
# with STARTTLS connection
$config['default_host'] = 'tls://mail.srv.world';

# line 55 : specify SMTP server
# with STARTTLS connection
$config['smtp_server'] = 'tls://mail.srv.world';

# line 58 : specify SMTP port
# with STARTTLS connection
$config['smtp_port'] = 587;

# line 62 : confirm
# use the same user for SMTP auth and IMAP auth
$config['smtp_user'] = '%u';

# line 66 : confirm
# use the same password for SMTP auth and IMAP auth
$config['smtp_pass'] = '%p';

# line 73 : change to any title you like
$config['product_name'] = 'Server World Webmail';

# add follows to the end
# specify IMAP port (with STARTTLS connection)
$config['default_port'] = 143;

# specify SMTP auth type
$config['smtp_auth_type'] = 'LOGIN';

# specify SMTP HELO host
$config['smtp_helo_host'] = 'mail.srv.world';

# specify domain name
$config['mail_domain'] = 'srv.world';

# specify UserAgent
$config['useragent'] = 'Server World Webmail';

# specify SMTP and IMAP connection option
$config['imap_conn_options'] = array(
  'ssl'         => array(
    'verify_peer' => true,
    'CN_match' => 'srv.world',
    'allow_self_signed' => true,
    'ciphers' => 'HIGH:!SSLv2:!SSLv3',
  ),
);
$config['smtp_conn_options'] = array(
  'ssl'         => array(
    'verify_peer' => true,
    'CN_match' => 'srv.world',
    'allow_self_signed' => true,
    'ciphers' => 'HIGH:!SSLv2:!SSLv3',
  ),
);

[root@www ~]#
vi /etc/httpd/conf.d/roundcubemail.conf
# line 14 : change access permission if need
# * only localhost is allowed by default

Require ip 10.0.0.0/24
[root@www ~]#
systemctl restart httpd

[9] If SELinux is enabled, change policy.
[root@www ~]#
setsebool -P httpd_can_network_connect on

[10] Access to [https://(your server's hostname or IP address/)/roundcubemail/], then Roundcube login form is shown, authenticate with any user on Mail Server.
[11] After successfully logined, verify possible to send or receive emails normally.
Matched Content