Ever since I got rid of Exchange Server as my email server I’ve been sans webmail client.
For a time, this didn’t bother me. I’ve been able to read my email remotely using IMAP (although that’s not really secure) but sending email remotely was an issue. To overcome this, I setup OpenVPN to securely connect to my network (and therefore my email server) at home.
Eventually, I set up the same OpenVPN connection for Dear GF on her work computer so that she could read email and send it as well.
While this worked, it was clunky. To complicate matters, Dear GF got another job at another company where installing the OpenVPN client is out of the question.
So it was time that I started looking at webmail clients for Linux. I had two in mind. Squirrelmail and Roundcube.
I loaded up Debian on a virtual machine on my Mac (using Parallels) and gave Squirrelmail a shot. The install is easy. Install a web server (I used Apache2), PHP, and then run the command “aptitude install squirrelmail” and it’s installed (well you do have to configure Apache2 to point to squirrelmail, but I digress).
The beauty of this is that it’s a Debian Stable supported package and that means that any security vulnerabilites that are found in the future are automatically back-ported to the stable package. In short, you don’t have to worry about security as long as you are installing the updates from Debian.
The client is also very stable and works like a charm but it’s very, very mid-1990s web application. This was before people started caring about <abbr title=User Interface">UI, design, and before AJAX was even invented. I could use it, but I wouldn’t like it. With that, Squirrelmail was out.
So I took a look at RoundCube. At first, I was a little hesitant about it because it requires more than just a web server and the software itself. It requires a database server (either MySQL, Postgres, or SQLite) and in addition to that, it’s not a Debian Stable supported package. You can’t just install it using aptitude and you have to pay attention to security updates and apply them separately. I was having my doubts about it.
Eventually, I decided to test it out and install it into another virtual machine. The install is definitely more complicated that Squirrelmail, but if you’ve installed software on Linux before (without automated tools) then it’s really not that difficult.
Here are the steps that I followed (from a clean Debian install):
Installing Necessary Software to Support Roundcube
Note: I’ll assume that your IMAP server and MTA are on another machine or they have been already installed properly.
- Remove Apache 1.2 if installed
- Install Apache 2
- Install MySQL Server (5)
- aptitude install mysql-server-5.0
- Install PHP5
- Install php5-mysql
- aptitude install php5-mysql (this isn’t in the docs, but without this, I could never connect to the database)
- Create a “roundcube” directory at /var/www/
- Download roundcube stable from their website. I downloaded the tar file
- Unpack the contents of the folder to /var/www/roundcube
- Remove the .dist extensions from the files in /var/www/roundcube
- Create a database called roundcube in MySQL
- CREATE DATABASE roundcubemail DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
- GRANT ALL PRIVILEGES ON roundcubemail.* to roundcube@localhost INDENTIFIED BY ‘[password]’; (obviously you’ll want to supply a good, secure password to that user)
- Import SQL script to create database tables
- mysql roundcubemail < /var/www/roundcube/SQL/mysql5.initial.sql
Setting up Apache
Since this will be accessed over the Internet, I want to use SSL instead of plain old HTTP.
- Create an self-signed SSL certificate
- openssl req $@ – new -x509 [number of days] -nodes -out [path to file ] -keyout [path to file] (note: This requires OpenSSL to be installed (aptitude install openssl))
- Have Apache listen on port 443 instead of port 80
- Edit /etc/apache2/ports.conf and replace “Listen 80” with “Listen 443”
- Enable SSL Support in Apache
- a2enmod ssl
- /etc/init.d/apache2 force-reload
- /etc/init.d/apache2 restart
Configuring Apache website for SSL support
In your Apache web site config, you’ll want to have these values listed (in addition to the rest of your config):
- SSLEngine on
- SSLCertificateFile [path to file] (use the same [path to file] as when you used to generate the SSL certificate
- Point Roundcube to the database
- In the file /var/www/roundcube/config/db.inc.php change the database connection value:
- Example: $rcmail_config[‘db_dsnw’] = ‘mysql://roundcube:[password]@localhost/roundcubemail’;
You’ll also want to setup your mail server options in the main config file (/var/www/roundcube/main.inc.php), but these are self explanatory, so I won’t detail them.
With that, you should have a valid working RoundCube install that’s available over HTTPS.
RoundCube isn’t perfect, but it’s still being actively developed and it addresses my needs. It’s gonna work for me (and Dear GF).