Aug 15, 2024 8 min read

How to Install Roundcube Webmail on Ubuntu 22.04

Install Roundcube Webmail on Ubuntu 22.04 with our step-by-step tutorial. It is a web-based email client that allows you to manage your emails.

Install Roundcube Webmail on Ubuntu 22.04
Install Roundcube Webmail on Ubuntu 22.04
Table of Contents

Choose a different version or distribution

Introduction

Before we begin talking about how to install Roundcube Webmail on Ubuntu 22.04, let’s briefly understand- What is Roundcube Webmail?

Roundcube Webmail is an open-source web-based email client that allows you to access and manage your emails through a web browser. It provides a user-friendly interface and essential features like sending, receiving, organizing, and searching emails. With Roundcube, you can access your email accounts from anywhere, making it convenient for users on the go.

This email client is highly customizable, allowing you to personalize your email experience. Roundcube ensures security and privacy, protecting your confidential information. With its simplicity and versatility, Roundcube is a popular choice for individuals and organizations seeking a reliable and efficient email solution.

This tutorial will guide you through the steps involved in installing your own Webmail Client with Roundcube on Ubuntu 22.04. We will also answer a few FAQs related to Roundcube installation.

Advantages of Roundcube Webmail

  1. User-friendly interface: Roundcube offers an intuitive and easy-to-use interface, making it simple for users to navigate and manage their emails effectively.
  2. Accessibility: With Roundcube, you can access your email accounts from any web browser, providing convenient access to your emails wherever you are.
  3. Customizability: Roundcube allows users to customize their email experience, enabling personalization options for themes, layouts, and settings.
  4. Security: Roundcube prioritizes the security and privacy of user data, ensuring that confidential information is protected against unauthorized access.
  5. Versatility: Roundcube is a versatile email client that caters to both individuals and organizations, offering essential features for efficient email management.

Prerequisites to Install Roundcube Webmail on Ubuntu 22.04

You'd need the following to complete the tutorial successfully:

  • An Ubuntu 22.04 server, including a sudo non-root user and a firewall
  • LAMP stack installed
  • An IMAP-based email server

Step 1- Installing Dependencies

1) The first step involves the installation of the dependencies along with the PHP configuration. The dependencies can help us verify whether everything is set up properly or not.

The following are the Roundcube dependencies that aren’t included:

  • PHP libraries (which are the php-* packages, including support for XML and multibyte strings)
  • Support tools (zip and unzip to manage compressed files)
  • Git for version control
  • PHP plugin management system (composer) 

You need to upgrade your package index and install all these dependencies at once:

sudo apt-get update
sudo apt-get install apache2 php-xml php-mbstring php-intl php-zip php-pear php-curl php-dom php-ldap php-imagick php-pgsql php-sqlite3 php-mysql zip unzip git composer

2) You then need to enable some PHP libraries in the server's php.ini file, found at /etc/php/8.1/apache2/php.ini. You can use nano or any other text editor to open it:  

sudo nano /etc/php/8.1/apache2/php.ini

3) Most of the changes involve enabling options that have been commented out. The commented lines start with ; (instead of the hash #) in php.ini files. Add a leading semicolon to comment on a line, and delete this semicolon to uncomment a line.

Find the sections which have a number of commented lines starting with extension=.  Then, uncomment or add the lines for the php_mbstring.dll and php_xmlrpc.dll extensions.

. . .
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll      ; Must be after mbstring as it depends on it
;extension=php_mysqli.dll
. . .
;extension=php_sqlite3.dll
;extension=php_tidy.dll
extension=php_xmlrpc.dll
;extension=php_xsl.dll
  . . .

4) Next, you need to add extension=dom.so to the bottom of the extension block.

. . .
extension=php_xmlrpc.dll
;extension=php_xsl.dll
extension=dom.so

. . .

5) Then, in the date.timezone setting, uncomment the line and add your timezone in quotation marks. The file for someone in the Eastern Standard Timezone would look like the one given below:

. . .
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "America/New_York"
. . .

6) The upload_max_filesize setting mainly affects uploading attachments. The default is 2MB, which can be changed to any value. Most email servers limit the size to 10MB, we'll be going with 12MB in the event that multiple users are adding attachments simultaneously.

. . .
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 12M
. . .

7) The post_max_size, unlike the upload_max_filesize applies to the size of the whole email (including attachments). You can set it to a higher value in order to prevent deadlocks.

. . .
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 18M
. . .

8) Finally, look for mbstring.func_overload, uncomment it, and verify that its value is set to 0. This enables support for multibyte string functions. Then Save and close the file.

. . .
mbstring.func_overload = 0
. . .

Step 2- Downloading Roundcube

There are two basic ways to install Roundcube, from a package or from the source. Though there is a PPA for Roundcube but is often out of date since it is under active development. (For instance, the PPA version maybe 1.2.3 but the active version would be 1.6 [in this tutorial]. Thus, installing from the source is the best alternative.

1) Go to the Roundcube download page. From the Stable Version, section finds Complete Package then right-click on the Download button then copy the link address.

2) After that, use the link with the wget command to download Roundcube tarball on your server.

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

3) Next, you need to decompress the Roundcube archive:

tar -xvzf roundcubemail-1.6.1-complete.tar.gz

The functions of the flags are as follows:

  • The x flag is for extract.
  • The v flag is for verbose, this tells tar to print the path and name of each file extracted.
  • The z flag tells tar not only to remove the tar wrapper, but to decompress the archive using gzip.
  • The f flag is for file. This Should be the last flag, since tar uses whatever immediately follows it as the file to be extracted.

4) you need to move the decompressed directory to /var/www and rename it to roundcube. Ensure that you omit the trailing / in the directory names, since we want to move and rename the whole directory and not the contents in the directory.

sudo mv roundcubemail-1.6.1 /var/www/roundcube

5) You then have to alter the permissions to allow Apache to create and edit the files (like configuration files and logs). Change the Owner and group to www-data, specifically. Then, change the permissions to read and write for the owner and group, but read-only for everyone else.

sudo chown -R www-data:www-data /var/www/roundcube/
sudo chmod 775 /var/www/roundcube/temp/ /var/www/roundcube/logs/

Roundcube is now partially installed, and you need to connect Roundcube to your database via Roundcube's GUI to finish the installation. For this, Apache needs to be instructed where Roundcube is so that it can load the site.

Step 3- Configuring Apache

1) You then need to edit a Virtual Host file to configure Apache. Virtual hosts allow Apache to host multiple sites on a server. The major reason for doing this is the fact that it is much easier to edit a virtual host configuration than the main Apache configuration.

2) Each .conf file found in /etc/apache2/sites-available/ represents a different site. You have to create a virtual host file here for Roundcube, then instruct Apache about it so that it can make it available via a browser.

3) Copy the default configuration to use a starting point for the new file:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/roundcube.conf

4) Then open the file using a text editor:

sudo nano /etc/apache2/sites-available/roundcube.conf

5) There are a few changes you need to make, here's a brief overview of the same:

In the existing VirtualHost block, you need to modify the following directives:

  • The ServerName will tell Apache which domain it should listen to. This should be your server IP address or domain name if you’re using one.
  • DocumentRoot specifies where to send traffic when it comes in.
  • ServerAdmin lets you specify a contact email address for any issues with Apache.
  • The two logging lines, ErrorLog and CustomLog, define where to save successful connection logs and error logs for this site.

6) After that, you need to add a new Directory block that will tell Apache what to do with the Roundcube directory. The first word in each line of a Directory block is the configuration name, followed by the actual configuration options.

  • Options -Indexes is helpful in telling Apache to display a warning if it can’t find an index.html or index.php file.
  • AllowOverride All tells Apache that if a local .htaccess file is found, any options in that file override the global settings in this file.
  • Order allow,deny tells Apache to allow matching clients access to the site, and stopping the ones that don’t match.
  • allow from all is a follow-up to the Order line.

The file should look something like this, the comments have been removed for better clarity.

<VirtualHost *:80>
  ServerName your_server_ip_or_domain
  DocumentRoot /var/www/roundcube
  ServerAdmin [email protected]

  ErrorLog ${APACHE_LOG_DIR}/roundcube-error.log
  CustomLog ${APACHE_LOG_DIR}/roundcube-access.log combined

  <Directory /var/www/roundcube>
      Options -Indexes
      AllowOverride All
      Order allow,deny
      allow from all
  </Directory>
</VirtualHost>

7) Then Save and close the file, followed by instructing Apache to stop hosting the default site.

sudo a2dissite 000-default

8) Exclude .conf when enabling the site when you instruct Apache to start hosting the Roundcube site instead. a2ensite wants the file name of the configuration without the extension.

sudo a2ensite roundcube

9) Then, you need to enable mod_rewrite Apache module, required by Roundcube.

sudo a2enmod rewrite

10) Restarting Apache will make the Roundcube installation accessible.

sudo apache2ctl restart

This is followed by configuring the database in order to enable Roundcube to store its app-specific data.

Step 4- Configuring MySQL

Roundcube requires a file generated during configuration setup, for which we need to prepare the database. Opening the browser at this point will show a configuration error page.

1) You need to connect to the MySQL interactive shell. The command instructs it to authenticate as the user (-u) root, and a password (-p) will be specified.

mysql -u root -p

2) You'll then be prompted to enter the root password created when you installed MySQL.

3) Next, create a database and a database user, and then give that user permission to execute commands on that new database.

CREATE DATABASE roundcubemail /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
CREATE USER 'roundcube'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON roundcubemail.* to 'roundcube'@'localhost';
FLUSH PRIVILEGES;
EXIT;
mysql -u roundcube -p roundcubemail < /var/www/roundcube/SQL/mysql.initial.sql

Now, visit http://ip_or_domain/installer/ and start the setup of RoundCube.

FAQs to Install Roundcube Webmail on Ubuntu 22.04

Can I use a database backend for Roundcube Webmail on Ubuntu 22.04?

Yes, Roundcube supports various database backends like MySQL/MariaDB and PostgreSQL. You can configure Roundcube to use a database for storing user preferences and login credentials.

How can I secure my Roundcube Webmail installation on Ubuntu 22.04?

To enhance the security of your Roundcube installation, ensure that you regularly update to the latest version, apply security patches, use strong passwords, enable SSL/TLS encryption for secure connections, and implement server and network security best practices.

Can I integrate Roundcube Webmail with other email services and protocols on Ubuntu 22.04?

Yes, Roundcube supports integration with other email services and protocols. You can configure Roundcube to work with IMAP, POP3, and SMTP services, and integrate it with external services like calendars, address books, and encryption plugins.

Can I customize the appearance and functionality of Roundcube Webmail on Ubuntu 22.04?

Yes, Roundcube provides customization options to personalize its appearance and functionality. You can modify the skin, create custom plugins, configure settings, and add additional features through the Roundcube configuration files.

Are there any specific requirements or considerations for hosting Roundcube Webmail on Ubuntu 22.04?

Roundcube Webmail has certain requirements, including a web server, PHP, and a mail server. Make sure your server meets the specified requirements and that the necessary services and dependencies are properly installed and configured.

How can I backup and restore Roundcube Webmail data on Ubuntu 22.04? 

Backing up Roundcube involves creating backups of the Roundcube files, configuration files, and the associated mail server data. To restore, you can copy the backup files to a new server or reinstall Roundcube and import the backed-up data.

Can I configure Roundcube to work with multiple email accounts on Ubuntu 22.04?

Yes, Roundcube can be configured to work with multiple email accounts. You can set up separate identities or manage multiple accounts within the Roundcube interface.

Conclusion

We hope this detailed tutorial helped you understand how to install and configure Roundcube Webmail on Ubuntu 22.04. To learn more about Roundcube installation, check out the official Roundcube installation document.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.