How to Install Roundcube Webmail on Ubuntu 20.04

install roundcube webmail ubuntu 20.04

In this tutorial, we will be showing you how to install the Roundcube Webmail email client on our latest Ubuntu 20.04 VPS, LTS release (Focal Fossa). Roundcube is a free and open source webmail client.

installation Roundcube Linux 20.04

Roundcube has an intuitive and user-friendly interface translated in more than 80 languages. Its excellent UX makes Roundcube one of the most popular webmail solutions in the world. The installation of Roundcube is pretty easy and it can run on any Linux server with either a LAMP or LEMP stack. It can also run on almost all web servers and database servers. With all of this, let’s start our installation process.

Features

Roundcube comes with lots of handy features out of the box, such as:

  • Drag-&-drop message management
  • Support for MIME and HTML messages
  • Spell checker
  • Support for external SMTP server
  • Support for access control lists (ACL)
  • Built-in caching for fast mailbox access
  • Custom skins
  • and much more…

Prerequisites

  • System user with root privileges
  • Apache, Nginx, Lighttpd, Cherokee or Hiawatha web server
  • PHP Version 5.4 or newer
  • MariaDB, MySQL, PostgreSQL, SQLite, MSSQL or Oracle database server
  • SMTP server and IMAP server with IMAP4 rev1 support

Step 1. Connect to and Update The Server

Login to your Ubuntu 20.04 VPS via SSH as user root

ssh root@IP_Address -p Port_Number

Where IP_Address and Port_Number are the actual IP address of your server and SSH port number.

Now, the first thing we should do is to make sure that all installed packages are updated to the latest available version:

apt update && apt upgrade

We also suggest restarting your server so that all configuration files being used are the latest version.

Step 2. Install MariaDB server

Roundcube needs a database where it will store its preferences, users, contacts and email messages (if caching is enabled). So for this purpose we will install MariaDB server. MariaDB is an open-source variant of MySQL. The MariaDB package is available in the official Ubuntu 20.04 repository, so the installation is pretty easy.

apt install mariadb-server

Once the database server is installed, start it and enable it to automatically start after a server reboot.

systemctl start mariadb
systemctl enable mariadb

Additionally, you can run the mysql_secure_installation post installation script, to strengthen the security of the MariaDB server as well as set a password for the MariaDB root user. It’s optional, but we strongly recommend securing your database server properly.

Step 3. Create a MariaDB database and User

We have the database server up and running, so we can proceed and create a database and user for Roundcube. Login to the database server as the root user, enter your password if you set one on the previous step, then run the following SQL commands:

mysql -u root -p

MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS `roundcube` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON roundcube.* TO roundcubeuser@localhost IDENTIFIED BY 'PASSWORD';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> quit

Don’t forget to replace ‘PASSWORD‘ with an actual strong password.

Step 4. Install PHP and its Dependencies

Roundcube is a PHP-based application, therefore we need to install PHP along with some PHP extensions that are required by Roundcube.

apt install php7.4 php7.4-gd php7.4-common php7.4-json php-imagick php7.4-imap php7.4-xml php7.4-opcache php7.4-mbstring php7.4-curl php7.4-zip  php7.4-bz2 php7.4-intl

Once all packages are installed, you can check the installed PHP version with the following command:

php -v
PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Step 5. Install Apache and Create a Virtual Host

Roundcube is webmail solution, so we have to install web server to serve the Roundcube file. It supports almost all of the major web servers, but in this tutorial we will use Apache. It can be easily installed with the following command

apt -y install apache2

Once the APT package manager completes the installation, start the web server and enable it to start upon a reboot

systemctl start apache2
systemctl enable apache2

Next, create Apache virtual host directory, so you can access Roundcube with a domain or subdomain, instead of your server’s IP address.

vim /etc/apache2/sites-available/roundcube.domain.com.conf
<VirtualHost *:80>
  ServerName roundcube.domain.com
  DocumentRoot /var/www/roundcube/

  ErrorLog ${APACHE_LOG_DIR}/roundcube.domain.com_error.log
  CustomLog ${APACHE_LOG_DIR}/roundcube.domain.com_access.log combined
  
    Options FollowSymLinks
    AllowOverride All
  
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</VirtualHost>

Save the file and run the following command to enable the virtual host:

a2ensite roundcube.domain.com

Finally, reload the web server for the changes to take effect:

systemctl reload apache2

Step 6. Download and Install Roundcube

We have all of our prerequisites configured on the server, so we can go ahead and download the most recent release of Roundcube. At the moment of writing the article, it is version 1.4.6. Go to the Download page of Roundcube’s official website, copy the URL, and download the complete package:

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

The next command will unpack the downloaded tarball archive and rename the directory:

tar -xzf roundcubemail-1.4.6-complete.tar.gz -C /var/www/html --transform s/roundcubemail-1.4.6/roundcube/

Change the permissions of the Roundcube content directory to www-data, the owner for the web server:

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer
NVME 2 VPS

Now just $43 .99
/mo

GET YOUR VPS
chown www-data: -R /var/www/html/roundcube

Initiate the Roundcube database:

mysql -u roundcubeuser -p roundcube < /var/www/html/roundcube/SQL/mysql.initial.sql

Next, go to http://roundcube.domain.com/installer enter all the necessary details. The installation wizard will create the Roundcube configuration file and then webmail will be ready to use.

Before going any futher, don’t forget to remove the installer directory:

rm -rf /var/www/html/roundcube/installer

Finally, visit http://roundcube.domain.com and login to Roundcube with your email account.

Congratulations! You now have Roundcube Webmail installed on your Ubuntu 20.04 VPS.


installing webmail roundcube ubuntu 20.04

We can make your email server experience seamless and easy if you use our Managed Roundcube Hosting services. Our in-depth support team will give you the freedom to do whatever you want with your server, while also giving you the ultimate support experience. Our admins can set up email on your server, configure it to perform exactly the way you want, as well as perform any requests that you might have.

Did you enjoy this tutorial? Feel free to post a comment with any questions or suggestions that you might have. We’d also appreciate you sharing this post online with our share buttons if you found this article useful.

12 thoughts on “How to Install Roundcube Webmail on Ubuntu 20.04”

  1. Hello Goodnight.

    I followed your 2 tutorials, how to install How to Install a Mail Server with PostfixAdmin on Ubuntu 20.04 and then the one on how to install Roundcube Webmail on Ubuntu 20.04
    What happens to me is that when I try to enter with a username and password in roundcube I get the wrong username or password message.

    I understand that the users that must be entered in roundcube are the ones that were created in postfixadmin, right?

    Is there any way to know why it is failing?

    Thank you very much, regards

    Reply
    • Yes, the user created in Postfixadmin should be used in Roundcube login. You should check the logs and provide us with more details.

      Reply
      • Hello, thank you very much for your help.

        I have gone to /var/log/apache2/
        there are several logs
        roundcube.midominio_error.log

        roundcube.midominio_access.log

        roundcube.midominio_error.log

        roundcube_error.log

        All of them are completely empty.

        Maybe I should look elsewhere?

        Reply
          • I just looked at the log of the file you mention.

            I get this:
            Jun 15 21:01:56 ns3247118 dovecot: pop3-login: Disconnected (no auth attempts in 10 secs): user=, rip=192.241.213.94, lip=164.132.173.9, session=

            Jun 15 21:01:59 ns3247118 dovecot: imap-login: Disconnected (no auth attempts in 2 secs): user=, rip=92.118.161.21, lip=164.132.173.9, TLS handshaking: SSL_accept() failed: error>

            Jun 15 21:13:14 ns3247118 postfix/smtpd[73840]: connect from unknown[37.0.8.40]

            Jun 15 21:13:14 ns3247118 postfix/smtpd[73840]: disconnect from unknown[37.0.8.40] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4

            Jun 15 21:16:34 ns3247118 postfix/anvil[73842]: statistics: max connection rate 1/60s for (smtp:37.0.8.40) at Jun 15 21:13:14

            Jun 15 21:16:34 ns3247118 postfix/anvil[73842]: statistics: max connection count 1 for (smtp:37.0.8.40) at Jun 15 21:13:14

            Jun 15 21:16:34 ns3247118 postfix/anvil[73842]: statistics: max cache size 1 at Jun 15 21:13:14

            Jun 15 21:38:11 ns3247118 postfix/smtpd[73994]: connect from unknown[194.31.98.76]

            Jun 15 21:38:11 ns3247118 postfix/smtpd[73994]: disconnect from unknown[194.31.98.76] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4

            Jun 15 21:40:39 ns3247118 postfix/smtpd[74088]: connect from unknown[37.0.8.40]

            Jun 15 21:40:39 ns3247118 postfix/smtpd[74088]: disconnect from unknown[37.0.8.40] ehlo=1 auth=0/1 rset=1 quit=1 commands=3/4

            Jun 15 21:43:59 ns3247118 postfix/anvil[73996]: statistics: max connection rate 1/60s for (smtp:194.31.98.76) at Jun 15 21:38:11

            Jun 15 21:43:59 ns3247118 postfix/anvil[73996]: statistics: max connection count 1 for (smtp:194.31.98.76) at Jun 15 21:38:11

            Jun 15 21:43:59 ns3247118 postfix/anvil[73996]: statistics: max cache size 1 at Jun 15 21:38:11

            In case it helps with anything, if I enter postfixadmin from the browser it lets me log in with the username and password.

            But doing the same in roundcube I have no luck. It tells me that the username or password is incorrect.

          • If I enter the roundcube/logs directory, there is also a file there and these errors appear within it:

            [15-Jun-2022 22:16:42 +0200]: IMAP Error: Login failed for admin@clancte.es against localhost from 83.42.93.215. AUTHENTICATE PLAIN: Authentication failed. in /var/www//roundcube/program/lib/Roundcube/rcube_imap.php on line 200 (POST /roundcube/?_task=login&_action=login)

          • The issue might be on dovecot and you should check the configuration or if possible reinstall Roundcube.

          • Is this the article you followed in installing Roundcube?
            Yes
            and to install postfix this other.
            https://www.rosehosting.com/blog/how-to-install-a-mail-server-with-postfixadmin-on-ubuntu-20-04/#comment-48902

            I will reinstall or take a good look, lest I miss something.

  2. I installed Roundcube through AWS marketplace and successfully pointed it to an FQDN. I have failed to login to setup the mail server. How can I achieve this?

    Reply

Leave a Comment