Roundcube is a popular Webmail interface written on PHP programming language. You can access Mailbox created on your Linux server through POP/IMAP on the Roundcube web interface. This tutorial will help you to install Roundcube Webmail on CentOS 8

Advertisement

Prerequisites

  • Launched a CentOS 8 instance on DigitalOcean.
  • Setup a sudo privileged account and apply initial security by following initial server setup
  • Login to instance via SSH as root account

Step 1 – Install LAMP Server

Roundcube webmail application is written in PHP programming language. It uses MySQL as the database server. So we required to set up a LAMP server on your server.

All the packages are available in default repositories, to install them type:

sudo dnf install httpd \
  mysql mysql-server \
  php php-common php-curl php-json php-xml php-mbstring php-imap php-mysqlnd php-cli php-gd

Once the installation finished. enable and start the Apache and MySQL database service.

systemctl enable httpd.service
systemctl start httpd.service
systemctl enable mysqld.service
systemctl start mysqld.service

Next, you need to set MySQL root account password and apply security. Run the post-installation script to secure the database server.

sudo mysql_secure_installation

First set a strong password for the root account and complete the wizard steps. Your CentOS system is ready for the Roundcube installation.

Step 2 – Create Roundcube Database

We are using MySQL as the database server for Roundcube webmail. So first, log in to your MySQL server via the command line.

mysql -u root -p

Then create database and a user for authentication:

CREATE DATABASE roundcubemail;
CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'DFksfkksd89k32&ks';
GRANT ALL ON roundcubemail.* to 'roundcube'@'localhost';
FLUSH PRIVILEGES;

Step 3 – Download Roundcube

Roundcube webmail official releases can be downloaded from its github repository. At the time of writing this tutorial, Roundcubemail 1.4.4 is the latest available version for the installation. You can download it using the below command.

wget https://github.com/roundcube/roundcubemail/releases/download/1.4.4/roundcubemail-1.4.4-complete.tar.gz

After downloading the archive file, extract it. Then move the directory to the proper location to configure as webroot.

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

And set the proper username and permissions to run on web server. The default Apache server runs with user and group named “apache”. The Nginx users can use “www-data” as username and group.

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

Step 4 – Configure Apache Web Server

You can deploy Roundcube either as a subdirectory URL (like: https://example.com/webmail), or you can deploy directly on a domain or subdomain.

For this tutorial, we will deploy it directly to a subdomain like https://mail.tecadmin.net. Let’s configure Apache server to host the Roundcubemail application. Create an Apache virtual host configuration file and add the following values.

vim /etc/httpd/conf.d/roundcubemail.conf

Save your file and restart the Apache service.

sudo systemctl restart httpd

Step 5 – Run Roundcube Web Installer

The Roundcube webmail is configured with Apache. You can access the application in your web browser. Here you need to complete the web installer wizard, Which you can access as follows:

Open the below URL in browser. Change domain with your domain name:

https://mail.tecadmin.net/installer/

On the first page, you will see the server environment. Make sure there is no error message showing. All the required PHP extensions are properly installed.

Rouncube web install step 1

Once you verify that all the required extensions are installed. Slide down to bottom of page and click “Next” to continue wizard.

Enter the product name as per your requirements. This will be an identification of your webmail. Generally, You will see this in page titles.

Slide down to the “Database Setup” section. Update the details as per created database and user in the above steps.

Again slide down to the bottom of the page and click on “CREATE CONFIG” button. You will see a message like the below screenshot.

Once the configuration file created successfully, click on “Continue” button.

In the final page of wizard, click on “Initialize database” button. If you don’t see any button, make your the database details you entered in the previous step are correct.

The installation wizard has been completed now.

Step 6 – Access Roundcube Webmail

As the installation has been completed. The wizard will show you a message to remove the installer directory. You need to remove it manually. Do it with the below command

sudo rm -rf /var/www/html/roundcubemail/installer/

All done. Access the webmail interface in another tab with the domain you configured. You will see the login page. Enter the login details here:

If you see any error, make sure the user is able to access the mailbox with IMAP protocol on the terminal. To verify connection connect IMAP using mutt.

mutt -f imap://rahul@localhost

After successful login to the Roubcube webmail, you will see the dashboard like the screenshot below. This will also show you the email from your account here.

If you are not seeing any emails here, you need to check the Dovecot configuration. Most probably the Mailbox location configured on the email server (Postfix or Sendmail) is not matching the location on the Dovecot server.

Conclusion

In this tutorial, you learn about the installation and configuration of the Roundcube webmail interface on a CentOS 8 Linux system. Let’s use webmail for the emailing.

Share.

4 Comments

  1. When I complete, it shows this:

    Forbidden
    You don’t have permission to access this resource.Server unable to read htaccess file, denying access to be safe

    • Now ok, I applied this solution from CentOS Console:

      If you want to allow httpd to read user content
      You must tell SELinux about this by enabling the ‘httpd_read_user_content’ boolean.
      More Details:
      setsebool -P httpd_read_user_content 1

  2. Warron French on

    Rahul, thanks for sharing these instructions but I am getting stuck at the first step, specifically because I am not finding php-imap as your instructions state

    “All the packages are available in default repositories, to install them type:”

    Can you help? Also, do you know where I can find a web-front-end to email that comes in a package that has dependencies easily satisfied?

    • I have installed dovecot, postfix, and roundcube for my mails. I have removed php-imap from the command and it works well.

Leave A Reply

Exit mobile version