How to Install RainLoop Webmail with Free Let’s Encrypt SSL on Ubuntu

RainLoop Webmail is an open-source email client that can be installed on your own web server. It supports IMAP and SMTP and provides a user-friendly interface with a variety of features.

Some of the features offered by RainLoop Webmail include:

  • Unified Inbox - View all your email messages in a single inbox, regardless of the protocol used (IMAP, POP3, or SMTP).
  • Multiple Accounts - Add multiple email accounts and easily switch between them.
  • Message Filtering - Create filters to automatically move, delete, or reply to messages based on certain criteria.
  • Customizable Interface - Change the appearance and functionality of the RainLoop Webmail interface to suit your needs.
  • Offline Mode - View your messages even when you’re not connected to the internet.

RainLoop Webmail is an excellent choice for users who want a lot of control over their email client and don’t mind installing it on their own web server. It offers a wide range of features and customizable options, making it a great choice for users with unique needs. RainLoop is also open-source, which means it’s free to use and modify. If you’re looking for a powerful and customizable email client, RainLoop is definitely worth checking out.

If you want to learn more about RainLoop Webmail, visit the official website at http://www.rainloop.net/. You can also find installation instructions and documentation on the website. Or, if you have questions or need help, you can post in the RainLoop Forums. The community is friendly and helpful, and they’ll be happy to answer any questions you may have.

The following instructions will help you install RainLoop Webmail on Ubuntu 20.04 with Apache as the webserver.

Prerequisites

In order to install and run RainLoop Webmail, you will need

  • A webserver running Apache. You’ll also need a domain name in order to access the RainLoop control panel.
  • A server running Ubuntu 20.04 LTS with a minimum of 2GB of RAM.
  • A non-root user with sudo privileges.

Install Required Packages

First, SSH to your server and update the package list by running the following command.

sudo apt update -y

Next, install PHP 7.4 and extra modules for PHP by running the following commands. You must install PHP 7.4+ in order to use the @vendor/bin/phpize command, which is used to install some of the PHP modules required by RainLoop.

Extra modules like php7.4-xml , php7.4-mbstring, and php7.4-xmlrpc are required in order to install the Mailparse library.

sudo apt install apache2 mysql-server php7.4 -y
sudo apt install libapache2-mod-php7.4 php7.4-json php7.4-curl -y
sudo apt install php7.4-mysql php7.4-xml php7.4-zip php7.4-imap wget unzip -y

Next, run the command below to get a list of all available timezones. You will need to change the default timezone file to the location closest to you.

sudo timedatectl list-timezones

Sample output:

List time zones

Next, you will need to edit the PHP configuration file in the /etc/php/7.4/apache2/ directory.

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

Change the following values max_execution_time, memory_limit, upload_max_filesize to match the settings below.

Before:

After:

Save and exit the file by pressing CTRL+X and confirming with Y.

Restart Apache to make the changes take effect.

sudo systemctl restart apache2

Install and Configure RainLoop Webmail

Now that you have everything installed, you can download and install RainLoop from the Rainloop repository.

First, create a directory for RainLoop in your webroot directory.

sudo mkdir /var/www/rainloop

Next, change the directory to the new directory that you just created.

cd /var/www/rainloop

Now download the latest release of RainLoop Webmail by running this command. We will be using the community edition of RainLoop, which is completely open-source and free to use.

sudo wget -qO- https://repository.rainloop.net/installer.php | sudo php

Next, run the command below to give the www-data user ownership of the RainLoop directory.

sudo chown -R www-data:www-data /var/www/rainloop

Finally, run the command below to give the www-data user write access to the RainLoop directory.

sudo chmod -R 755 /var/www/rainloop

Once you’re done, the RainLoop Webmail installer is ready. But we must first create Apache virtual host file for RainLoop.

An Apache virtual host file is a configuration file that defines how Apache will handle the requests for your webmail.

You can create a new virtual host file by opening it with sudo privileges in an editor of your choice.

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

Now add the following lines to this file, making sure to replace your-domain.com with your own domain.

<VirtualHost *:80>

ServerAdmin [email protected]
ServerName your-domain.com
ServerAlias www.your-domain.com

DocumentRoot /var/www/rainloop/

<Directory />
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride All
Order deny,allow
Allow from all
Require all granted
</Directory>

<Directory /var/www/rainloop/data>
Require all denied
</Directory>

ErrorLog /var/log/apache2/rainloop_error_log
TransferLog /var/log/apache2/rainloop_access_log

</VirtualHost>

Save and exit the file by pressing CTRL+X and confirming with Y.

Now, run the command below to disable the default Apache virtual host file and enable your new virtual host file.

sudo a2dissite 000-default.conf && sudo a2ensite rainloop.conf

Now that the virtual host file is enabled, we must enable the Apache rewrite mode and restart Apache for the changes to take effect.

sudo a2enmod rewrite && sudo systemctl restart apache2

Setting up SSL/TLS for your Webmail

Now that you have a secure virtual host file enabled, you will need to generate an SSL/TLS certificate and key so that you can secure your webmail.

An SSL/TLS certificate is needed to encrypt the connection between your server and client (for example, a web browser).

First, run the command below to install the Certbot plugin. Certbot is a client that will obtain and install SSL/TLS certificates for you.

sudo apt install certbot -y

Next, you will need to run the command below with the --apache parameter to install the Certbot Apache plugin. The Certbot Apache plugin is the plugin that will help you automatically obtain and install SSL/TLS certificates for your Apache virtual hosts.

sudo apt install python3-certbot-apache -y

Now, run the command below to request an SSL/TLS certificate for your webmail. Make sure to replace your-domain.com with your own domain.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d mail.your-domain.com

Where:

  • certbot is the client that will obtain and install SSL/TLS certificates for you.
  • --apache is the parameter that tells Certbot to use the Apache plugin.
  • --agree-tos is the parameter that tells Certbot to agree to the Terms of Service.
  • --redirect is the parameter that tells Certbot to redirect all non-SSL traffic to SSL.
  • --hsts is the parameter that tells Certbot to enable HSTS with a preloaded domain (used for web browser security).
  • --staple-ocsp is the parameter that tells Certbot to hook into OCSP Stapling and use its stapled response when authenticating certificates. This will speed up the connection for your users.
  • --email is the parameter that tells Certbot your email address so you can receive alerts about your certificate status.
  • -d mail.your-domain.com is the parameter that tells Certbot to request an SSL/TLS certificate for your webmail using the domain mail.your-domain.com.

Once you are done, Certbot will generate the SSL/TLS certificate you need. The output below confirms that the SSL/TLS certificate was generated and installed.

Create Let#s Encrypt SSL certificate

Now, every time you access http://mail.your-domain.com, you will be redirected to https://mail.your-domain.com, and your connection will be secured. More information about Certbot can be found here.

Accessing RainLoop Webmail UI

Now you can open your web browser and go to https://your-domain.com/admin.

The RainLoop Webmail UI log-in screen will be opened in your web browser and you can log in with the default admin/12345 credentials.

RainLoop Login

Once logged in, make sure you change your admin password immediately. Because the combination of admin/12345 is easily guessed, it is best to change it to something more secure. This is done from the Security menu on the left, under the Admin Panel.

RainLoop Webmail Client

Conclusion

You have now successfully installed and configured RainLoop Webmail on your Ubuntu 20.04 server. You can now send and receive emails from your own domain!

For more information on RainLoop installation, please visit its official documentation page.