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 [email protected]_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 [email protected] 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:

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.

Leave a Comment

To prove you are human please solve the following *