CentOS Stream 10

Apache httpd : Web Mail : RoundCube2025/07/17

 

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]

Install and Configure SMTP Server, refer to here.

[2]

Install and Configure IMAP Server, refer to here.

[3]

Configure SSL/TLS settings for SMTP/IMAP Server, refer to here. (Optional but strongly recommended)

[4]

Install PHP on httpd Server, refer to here.

[5]

Configure SSL/TLS settings on httpd Server, refer to here. (Optional but strongly recommended)

[6]

Install and Configure MariaDB Server on httpd Server, refer to here.

[7] Create a Database for RoundCube.
[root@www ~]#
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 63
Server version: 10.11.11-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)]> 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
// line 32 : specify IMAP server (STARTTLS setting)
$config['imap_host'] = 'tls://mail.srv.world:143';

// line 36 : specify SMTP server (STARTTLS setting)
$config['smtp_host'] = 'tls://mail.srv.world:587';

// line 40 : confirm (use the same user for SMTP auth and IMAP auth)
$config['smtp_user'] = '%u';

// line 44 : confirm (use the same password for SMTP auth and IMAP auth)
$config['smtp_pass'] = '%p';

// line 51 : possible to change to any title you like
$config['product_name'] = 'Server World Webmail';

// add to last line
// 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