How to Install RainLoop Webmail on Ubuntu 16.04

RainLoop is a simple, modern, fast and open source Web-based email client written in PHP. This tutorial is going to show you how to install RainLoop Webmail on Ubuntu 16.04 with Apache or Nginx web server and PHP7.

RainLoop webmail features:

  • A modern web interface.
  • Fast and lightweight
  • Supports both SMTP and IMAP.
  • Supports multiple accounts, which means you can access all your email addresses from one place.
  • Supports two-factor authentication.
  • Integration with Facebook, Twitter , Google and Dropbox.
  • Direct access to mail server, no database needed.
  • Easy to install and upgrade

. There are two editions of RainLoop:

  • community edition released under the AGPL v3 license
  • standard edition released under the RainLoop software license.

We will use the free and open source community edition in this tutorial.

Step 1: Install Apache, PHP7 or Nginx, PHP7

If you use Apache and PHP7, then install them on Ubuntu 16.04 with:

sudo apt update

sudo apt install apache2 php7.0 libapache2-mod-php7.0

If you use Nginx and PHP7, then install them with:

sudo apt update

sudo apt install nginx php7.0

And install the following PHP extensions which are required by RainLoop.

sudo apt install php7.0-curl php7.0-xml

Step 2: Download and Install RainLoop Webmail on Ubuntu 16.04

First, make a directory for rainloop in the current working directory.

mkdir rainloop

Cd into the directory and download the latest RainLoop community edition with the following commands:

cd rainloop

curl -s http://repository.rainloop.net/installer.php | php

Once that’s done, move this directory to /var/www/.

cd ..

sudo mv rainloop /var/www/

Now set web server user (www-data) as the owner.

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

Step 3: Configure a Virtual Host for RainLoop

We can use either Apache or Nginx web server.

Apache

If you like to use Apache web server, then create the virtual host file with the following command:

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

Put the following text into the file. Replace red text with your actual info.

<VirtualHost *:80>
  ServerName mail.example.com
  DocumentRoot "/var/www/rainloop/"
  ServerAdmin [email protected]

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

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

</VirtualHost>

Save and close the file. Then enable this virtual host.

sudo a2ensite rainloop.conf

And reload Apache.

sudo systemctl reload apache2

Installing TLS/SSL Certificate (Apache)

If you want to add HTTPS to webmail, then you can obtain a free TLS/SSL certificate from Let’s Encrypt CA. First Let’s install the certbot client. The client is still named letsnecrypt in Ubuntu repository. The following command will install the client and apache plugin.

sudo apt install letsencrypt python-letsencrypt-apache

Now issue the following command to obtain a free TLS/SSL certificate. Replace the red-colored text with your actual email address and domain name.

sudo letsencrypt --apache --agree-tos --email your-email-address -d mail.example.com

You will be asked to choose easy or secure. It’s recommended to choose secure so that all http requests will be redirected to https.

let's encrypt apache

Once you hit the OK button, a free TLS/SSL certificate is obtained and installed on the Apache virtual host.

Nginx

If you like to use Nginx web server, then create the virtual host file with the following command:

sudo nano /etc/nginx/conf.d/rainloop.conf

Put the following text into the file.Replace mail.example.com with your own domain name.

server {
   listen 80;
   server_name mail.example.com;

   root /var/www/rainloop;
   index index.php index.html;
	
   access_log /var/log/nginx/rainloop_access.log;
   error_log /var/log/nginx/rainloop_error.log;
   
   location / {
       try_files $uri $uri/ /index.php?$query_string;
   }

   location ~ ^/(.+\.php)$ {
        try_files $uri =404;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
   }
 
   location ^~ /data {
       deny all;
   }
}

Save and close the file. Then test Nginx configurations.

sudo nginx -t

If the test is successful, reload Nginx configurations.

sudo systemctl reload nginx

Installing TLS/SSL Certificate (Nginx)

Let’s obtain a free TLS certificate from Let’s encrypt. Install Let’s Encrypt (certbot) client with:

sudo apt install letsencrypt

Then use the webroot plugin to obtain the certificate. Replace red text with your actual email address and domain name.

sudo letsencrypt certonly --webroot --email your-email-address -d mail.example.com -w /var/www/rainloop/

You will see the following text indicating that you have successfully obtained a TLS certificate. Your certificate and chain have been saved at /etc/letsencrypt/live/mail.example.com/ directory.

squirrelmail let's encrypt

After the certificate is obtained, we need to manually configure TLS/SSL settings. Edit the virtual host file.

sudo nano /etc/nginx/conf.d/rainloop.conf

Change the configuration to the following.

server {
    listen 80;
    server_name mail.example.com;
    return 301 https://$server_name$request_uri;
}
server {
    listen 443 ssl http2;
    server_name mail.example.com;

    root /var/www/rainloop/;
    index index.php index.html index.htm;
 
    access_log /var/log/nginx/rainloop_access.log;
    error_log /var/log/nginx/rainloop_error.log;
    ssl_certificate /etc/letsencrypt/live/mail.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mail.example.com/privkey.pem;

    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:10m;
    ssl_session_tickets off;
    ssl_protocols TLSv1.1 TLSv1.2;

   ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK';
   ssl_prefer_server_ciphers on;

   location / {
     try_files $uri $uri/ /index.php?$query_string;
   }
   location ~ ^/(.+\.php)$ {
      try_files $uri =404;
      fastcgi_pass unix:/run/php/php7.0-fpm.sock;
      fastcgi_index index.php;
      fastcgi_param HTTPS on;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi_params;
   }

   location ^~ /data {
     deny all;
   }
}

Save and close the file. Then test Nginx configurations.

sudo nginx -t

If the test is successful, reload Nginx configurations.

sudo systemctl reload nginx

Step 4: Configure RainLoop Webmail

Log into RainLoop admin panel via the following URL.

mail.example.com/?admin

Default username is admin and default password is 12345.

rainloop webmail admin login page

Once you are logged in, it’s recommended to change both your username and password since admin is an easy target. Click the security tab on the left pane. Update your password first, then re-login and update your username.

rainloop webmail ubuntu 16.04

To access your emails through RainLoop, you need to configure email server settings in the Domains tab. By default, 4 email domains are added: gmail.com, outlook.com, qq.com, yahoo.com.

rainloop webmail multiple email domains

The SMTP server settings and IMAP server settings for these email domains are configured by RainLoop, but only Gmail is enabled by default. To enable other 3 email domains, simple put a check inside the box on the right.

To be able to access your own email server, click the Add Domain button and enter the IMAP and SMTP server settings of your own email server.

rainloop webmail add email domain

You also need to enable your own email domain by putting a check inside the box on the right, or the error domain is not allowed will appear when logging into your email address.

After finishing the configuration, enter your RainLoop webmail domain name in browser address bar without /?admin suffix.

mail.example.com

And log into your email account.

rainloop ubuntu

RainLoop webmail

rainloop webmail ubuntu

If authentication failed, then you may need to enable short login in the IMAP server settings page.

That’s all you need to do in order to access your emails on Gmail, outlook mail or your own email domain. If you add multiple email accounts, you can easily switch between them from the user drop-down menu. Very cool indeed! You can also configure other settings and customize your webmail interface.

That’s it!

I hope this tutorial helped you install RainLoop Webmail on Ubuntu 16.04. As always, if you found this post useful, then subscribe to our free newsletter.You can also follow us on Google+Twitter or like our Facebook page.

Rate this tutorial
[Total: 6 Average: 3.5]
  • Thanks for the detailed tutorial. i was searching for webmail setup with my new ubuntu installation. Thank you very much (Y).

    Robin.