Roundcube Mail
Roundcube official installation docs: https://github.com/roundcube/roundcubemail/blob/master/INSTALL
Arch Linux Roundcube how-to: https://wiki.archlinux.org/title/Roundcube
The sc
command shown below is a wrapper script that can be found here. sc
works on either systemd or openrc systems, so it makes step-by-step instructions less cluttered.
Configuring Roundcube in Arch or Artix Linux
If you just do yay -Sy roundcubemail
you will end up with this message:
-> Failed to install the following packages. Manual intervention is required: composer-git - exit status 4
You must install extra/composer before using yay
to install Roundcubemail. If you are using Artix, this means you must also install the artix-archlinux-support
package (see Artix Linux).
The sc
script can be found on the sysadmin scripts page, or you can use systemctl
or /etc/init.d/postgresql
instead.
Be sure that /etc/php/php.ini has the relevant database extension enabled.
pacman -Sy composer ← the 'extra' repository must be enabled yay -Sy roundcubemail-git roundcubemail-skin-larry roundcubemail-plugin-delete_old roundcubemail-plugin-persistent_login roundcubemail-plugin-showfoldersize dovecot dovecot-openrc
- with PostgreSQL
-
sudo su Artix: pacman -Sy postgresql-openrc postgresql Arch: pacman -Sy postgresql php-pgsql su -l postgres -c "initdb --locale=C.UTF-8 --encoding=UTF8 -D '/var/lib/postgres/data'" sc postgresql start sudo -u postgres createuser -P roundcube → enter your chosen password; it will be used again below sudo -u postgres createdb -O roundcube -E UNICODE roundcubemail
Create configuration:
cd /usr/share/webapps/roundcubemail/config cp config.inc.php.sample config.inc.php vim config.inc.php
Change the database settings to use your password and a socket rather than TCP/IP:
$config['db_dsnw'] = 'pgsql://roundcube:password@/roundcubemail?host=/run/postgresql'; $config['skin_logo'] = 'mail-logo.png';
Then initialise the database:
cd .. bin/initdb.sh --dir=SQL
If it complains about a driver not being available, that means the PHP extension in php.ini was not un-commented.
- with MariaDB
-
sudo su Artix: pacman -Sy mariadb-openrc mariadb Arch: pacman -Sy mariadb sc mariadb start mariadb
CREATE DATABASE roundcubemail CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER roundcube@localhost IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost; \q
Create configuration:
cd /usr/share/webapps/roundcubemail/config cp config.inc.php.sample config.inc.php vim config.inc.php
Change the database settings to use your password and a socket rather than TCP/IP:
$config['db_dsnw'] = 'mysql://username:password@unix(/run/mariadbd/mysqld.sock)/dbname'; #|If your user name is roundcube and the database is roundcubemail it will be something like: #| $config['db_dsnw'] = 'mysql://roundcube:password@unix(/run/mariadbd/mysqld.sock)/roundcubemail'; #| or #| $config['db_dsnw'] = 'mysql://roundcube:password@unix(/run/mysqld/mysqld.sock)/roundcubemail'; $config['skin_logo'] = 'mail-logo.png';
Then initialise the database:
cd .. bin/initdb.sh --dir=SQL
If it complains about a driver not being available, that means the PHP extension in php.ini was not un-commented.
Apache configuration
- Show/hide sample block for Apache vhosts.d file.
-
<VirtualHost *:443> ServerName mail.gvrides.com DocumentRoot /usr/share/webapps/roundcubemail <IfModule log_config_module> CustomLog /var/log/apache2/mail-access.log combined ErrorLog /var/log/apache2/mail-error.log </IfModule> <LocationMatch ^(.*\.php)(\/|$)> SetHandler "proxy:unix:/run/php-fpm/php-fpm.sock|fcgi://localhost/" </LocationMatch> SSLEngine on SSLCertificateFile /etc/letsencrypt/live/mail.YOUR DOMAIN.com/cert.pem SSLCertificateChainFile /etc/letsencrypt/live/mail.YOUR DOMAIN.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/mail.YOUR DOMAIN.com/privkey.pem # SSLVerifyClient causes browser to request user authentication unless set to "none" # Possible settings: require, optional, none. SSLVerifyClient none SSLVerifyDepth 10 <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <IfModule mod_headers.c> Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains; preload" </IfModule> # If you have blacklists you can place them in the "include" directory below. # Otherwise, just delete the following <Files> block. <Files "*"> <RequireAll> Require all granted Include /etc/httpd/block-lists/ </RequireAll> </Files> </VirtualHost>
Dovecot configuration
- In Artix be sure to put the configuration file's path in /etc/conf.d/dovecot
- An example config can be found in /usr/share/doc/dovecot/example-config that you can copy into /etc and edit, e.g.,
cp -a /usr/share/doc/dovecot/example-config /etc/dovecot
- Set the SSL certificate in /etc/dovecot/conf.d/10-ssl.conf
Troubleshooting
If you get an error about database collation being incorrect do these steps:
sudo -u postgres pgsql roundcube ALTER DATABASE roundcube REFRESH COLLATION VERSION; REINDEX DATABSE roundcube; \q
NB: The prompt will come back silently without doing anything if you leave out the semicolon at the end of two lines as shown above.