How to install Roundcube Webmail on CentOS 8


In this tutorial we will show you how to install Roundcube Webmail on CentOS 8. For those of you who did not know, Roundcube is a popular webmail interface written in PHP programming language. You can access the mailbox created on your Linux server via POP / IMAP in the Roundcube web interface.

This article assumes that you have at least basic knowledge of Linux, know how to use the shell and most importantly, that you host your website on your own VPS. The installation is quite simple and requires you to run in the root account, otherwise you may need to add ‘sudoto the commands for root privileges. I show you step by step installation of Roundcube Webmail on CentOS 8.

Install Roundcube Webmail on CentOS 8

Step 1. Let’s first start by making sure your system is up to date.

sudo dnf clean all
sudo dnf update

Step 2. Install LAMP Stack.

If you do not already have a LAMP stack installed on your server, you can follow our guide here.

Step 3. Install Roundcube Webmail on CentOS 8.

Now we download the Roundcube installer from the official website:

tar -zxvf roundcubemail-1.4.11-complete.tar.gz
mv roundcubemail-1.4.11 /var/www/html/roundcubemail

We need to change some folder permissions:

chown -R apache:apache /var/www/html/roundcubemail 
chmod -R 755 /var/www/html/roundcubemail

Step 4. Configure MariaDB for Roundcube.

By default, MariaDB is not hardened. You can secure MariaDB using mysql_secure_installation script. You should read and below each step carefully, which sets a root password, deletes anonymous users, allows remote root login and deletes the test database and access to secure MariaDB.


Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Then we have to log in to the MariaDB console and create a database for Roundcube. Run the following command:

mysql -u root -p

This will ask you for a password, so enter your MariaDB root password and press Enter. Once logged in to your database server, you must create a database for installing Roundcube:

MariaDB [(none)]> CREATE DATABASE roundcubemail;
MariaDB [(none)]> CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'your-strong-passwords';
MariaDB [(none)]> GRANT ALL ON roundcubemail.* to 'roundcube'@'localhost';
MariaDB [(none)]> Exit

Step 5. Configure Apache for Roundcube.

We create a virtual Apache host for your Roundcube. Create first ‘/etc/apache/conf.d/vhosts.conf‘file with a text editor of your choice:

nano /etc/apache/conf.d/vhosts.conf
IncludeOptional vhosts.d/*.conf

Then create the virtual value:

mkdir /etc/apache/vhosts.d/
nano /etc/apache/vhosts.d/

Add the following lines:

   DocumentRoot "/var/www/html/roundcubemail"
   ErrorLog "/var/log/httpd/"
   CustomLog "/var/log/httpd/" combined

<Directory "/var/www/html/roundcubemail">
   DirectoryIndex index.html index.php
   Options FollowSymLinks
   AllowOverride All
   Require all granted

Save and close the file. Restart the Apache service for the changes to take effect:

systemctl restart httpd.service
systemctl enable httpd.service

Step 6. Install SSL for Apache on CentOS 8.

Run these commands on the command line on the machine to install Certbot:

sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo chown root /usr/local/bin/certbot-auto
sudo chmod 0755 /usr/local/bin/certbot-auto

Then run this command to get a certificate and have Certbot edit your Apache configuration automatically:

sudo /usr/local/bin/certbot-auto --apache

Step 7. Configure firewall.

Before accessing the Roundcube web interface, you must enable HTTP and HTTPS services via firewall:

sudo firewall-cmd --add-port={http,https} --permanent
sudo firewall-cmd --reload

Step 8. Access the Roundcube webmail interface.

Invoice Ninja will be available on HTTP port 80 by default. Open your favorite browser and navigate to and complete the necessary steps to complete the installation.

Congratulations! You have installed Roundcube. Thank you for using this guide to install Roundcube Webmail on your CentOS 8 system. For further help or useful information, we recommend that you check the official website for Roundcube Webmail.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More