RoundCube

From DreamHost

Jump to: navigation, search
The instructions provided in this article or section are considered advanced.

You are expected to be knowledgeable in the UNIX shell.
Support for these instructions is not available from DreamHost tech support.

The instructions provided in this article or section require shell access unless otherwise stated.

You can use the PuTTY client on Windows, or SSH on UNIX and UNIX-like systems such as Linux or Mac OS X.
Your account must be configured for shell access in the Control Panel.
More information may be available on the article's talk page.

Note, the following article discusses installing your own instance of RoundCube. If you are interested in using a "pre-installed" version of RoundCube, DreamHost has installed a "very beta" version for all users as announced in the December Newsletter (V9.12_December_2007).

Contents

About RoundCube

From the RoundCube website:

"RoundCube Webmail is a browser-based multilingual IMAP client with an application-like user interface. It provides full functionality you expect from an e-mail client, including MIME support, address book, folder manipulation and message filters. RoundCube Webmail is written in PHP and requires the MySQL database. The user interface is fully skinnable using XHTML and CSS 2."

This page will be a step-by-step tutorial on getting a RoundCube installation to work on Dreamhost.

Installation

1. Go to the downloads page here and copy the link for the most recent version (note: you'll have to select a mirror to get the actual address) (another note: the download file is actually the source package).

2. Log into your account over SSH and download the file:

wget http://whatever/the/path/is/filename.tar.gz
tar xvfz filename.tar.gz

3. Create a MySQL database and user for RoundCube (in this case, we will assume you name it roundcubedb, name the user roundcubeuser, and set the hostname to rcdb).

4. cd into the config directory and edit the db.inc.php file.

Note: This file may be named db.inc.php.dist if so type
mv db.inc.php.dist db.inc.php
  • Set your MySQL connection address on line 21:
$rcmail_config['db_dsnw'] = 'mysql://roundcubeuser:password@rcdb.yourdomain.com/roundcubedb';

5. Now edit the main.inc.php file in the config directory.

Note: This file may be named main.inc.php.dist if so type
mv main.inc.php.dist main.inc.php
  • Set your default mail host on line 38:
$rcmail_config['default_host'] = 'mail.yourdomain.com';
  • If you want your users to be able to log in with just their username, rather than the full address, set the username domain on line 46:
$rcmail_config['username_domain'] = 'yourdomain.com';
  • Set your smtp server on line 63:
$rcmail_config['smtp_server'] = 'mail.yourdomain.com';
  • Add the email account you want your RoundCube installation to send email with on lines 48 and 52 - you can find this on lines 70 and 74:
  • Note: You really should use '%u' for user and '%p' for password. Otherwise RoundCube cannot automatically add new accounts for you. If you choose to enter a specific user and password you will have to follow the step listed below under 'Adding User Accounts'
$rcmail_config['smtp_user'] = 'm1234567'; (or use '%u' for the mail user when you log into RoundCube)
$rcmail_config['smtp_pass'] = 'password'; (or use '%p' for the pass of the mail user)
  • Set the session lifetime to 30 minutes on line 97 (as per instructions in the RoundCube installation guide):
$rcmail_config['session_lifetime'] = 30;
  • Set your timezone offset on line 198 (note that this is using GMT notation--you can find your offset here):
$rcmail_config['timezone'] = -8;

NOTE: Step 6 should only need to be performed with versions prior to 0.1-beta 2.

6. Due to Dreamhost's wacky pathnames (/home/.server/username/path), I've found that Roundcube incorrectly autodetects the install directory. This requires you editing index.php as follows:

  • Type "cd ..", then type "pico index.php"
  • Replace line 47:
$INSTALL_PATH = dirname($_SERVER['SCRIPT_FILENAME']);

with

$INSTALL_PATH = dirname($_SERVER['PATH_TRANSLATED']);
  • Replace line 60:
ini_set('include_path', $INSTALL_PATH.PATH_SEPARATOR.$CURRENT_PATH.'program'.PATH_SEPARATOR.$CURRENT_PATH.'program/lib'.PATH_SEPARATOR.ini_get('include_path'));

with

ini_set('include_path', ini_get('include_path').PATH_SEPARATOR.$INSTALL_PATH.PATH_SEPARATOR.'program'.PATH_SEPARATOR.'program/lib');

then save the file.

7. Create the necessary SQL tables in your database.

  • Change directory to the SQL directory in the RoundCube install.
  • Log into to mySQL
mysql -u roundcubeuser -p -h rcdb.yourdomain.com roundcube 
  • Use the mySQL 'source' command to create the tables
source mysql5.initial.sql;

Don't forget the semicolon at the end. You can enter 'show tables;' to see if the tables were installed.

  • Quit mySQL
quit;


Using phpMyAdmin:

  • Browse to http://rcdb.yourdomain.com/ to access phpMyAdmin. Log in using roundcubeuser/password.
  • Select roundcubedb from the dropdown menu on the left side.
  • Hit the SQL link at the top of the right frame on the page that loads.
  • Paste everything in the mysql5.initial.sql file from the SQL folder in your RoundCube folder into the provided textbox on the page that loads and hit the Run button.

At this point, the installation should be complete and you should be able to browse to wherever you have it located. Unfortunately, you won't be able to log in with any accounts.

Adding User Accounts

Note: If you set $rcmail_config['smtp_user'] and $rcmail_config['smtp_pass'] to '%u' and '%p' respectively in config/main.inc.php, you do not have to do the following steps.

Unfortunately, due to how Dreamhost has its email account system set up, RoundCube will not work out-of-the-box as it usually does. We have to manually add any accounts we want to be able to log in with to the users table in our MySQL database. Hopefully, an Admin interface that makes this easier will be added in the future. Until then, we get to do it the old-fashioned way.

  1. Log into your database via phpMyAdmin (http://rcdb.yourdomain.com in our installation example).
  2. Click on the link to the users table in the left frame after you've selected your database from the dropdown menu.
  3. Click on the "Insert" link at the top of the right frame.
  4. The only fields you need to enter information in are username, mail_host, and alias. Username is user@domain.com (the same username this user would use for a normal email client), mail_host is mail.yourdomain.com, and alias is whatever you want the user to enter in the username field when logging into RoundCube.
  5. Hit the Go button at the bottom of the page to submit the form after you've supplied the correct information.
  6. Repeat for each user you want to have access to your RoundCube installation.
  7. Log into RoundCube and add the following folders on the options page.
    • Drafts
    • Sent
    • Junk
    • Trash
  8. To activate mail sending, you will also need to create an identity under Personal Settings --> Identities.

Replacing SquirrelMail with RoundCube

Fortunately, we can replace the default webmail application if we want.

  1. Log into your Dreamhost webpanel.
  2. Select "Webmail" from the Mail section of the menu.
  3. Click on the "Edit" link next to the domain you want to replace SquirrelMail on.
  4. Check the "Disable webmail altogether?" checkbox and save changes.
  5. Select "Manage Domains" from the Domains section of the menu.
  6. Add a new subdomain titled webmail.yourdomain.com.
  7. Move your RoundCube installation into that subdomain's directory on the server.

Limitations

  • Unfortunately, the replacement described here will mean that you LOSE your ability to leverage the https (with certificate warning) that you have today on webmail.<domain>.com. If you wish to have your Roundcube installation secure, you will have to install a HTTPS certificate onto your domain. You can read more about how to set up a secure server here: Setting up a Secure Server
  • Additionally, you will no longer be able to access Dreamhost's special Junk Mail folder directly from http://webmail.yourdomain.com, as this is only typically accessible through Dreamhost's version of SquirrelMail. However, a workaround exists, as dreamhost's mail servers also have running web servers. Instead of accessing the Junk Mail folder via http://webmail.yourdomain.com, use http://mail.yourdomain.com -- where SquirrelMail will still be available. (Note that this issue is only relevant to those using Dreamhost's junk mail filtering option.)

Automatic Updater

Update your roundcube installation to the latest SVN.

Copy the script below into a file rcupdate.sh Change RCINSTALL to the directory in which Roundcube has been installed.

At the bash shell type:

chmod +x ./rcupdate.sh
./rcupdate.sh

The Script

#!/bin/sh

#Roundcube SVN Updater
#Author  : Paul-Robert Archibald
#License : http://www.archtechnologies.co.uk/osl.html
#Version : 1.0

#Abort on any errors
set -e

#Edit These As Required
TEMP=newrc
RCINSTALL=roundcube

echo Downloading Roundcube
cd ~/
mkdir ~/${TEMP}
cd ~/${TEMP}
svn export https://svn.roundcube.net/trunk/roundcubemail

echo Removing Previous Roundcube Files
rm -rf ~/${RCINSTALL}/skins/default/
rm -rf ~/${RCINSTALL}/program/
rm ~/${RCINSTALL}/index.php
rm ~/${RCINSTALL}/.htaccess

echo Moving New Files
mv ~/${TEMP}/roundcubemail/program ~/${RCINSTALL}/program
mv ~/${TEMP}/roundcubemail/skins/default ~/${RCINSTALL}/skins/default
mv ~/${TEMP}/roundcubemail/index.php ~/${RCINSTALL}/index.php
mv ~/${TEMP}/roundcubemail/.htaccess ~/${RCINSTALL}/.htaccess

echo Copying New Configuration file
cp ~/${TEMP}/roundcubemail/config/main.inc.php.dist ~/${RCINSTALL}/config/main.inc.php.dist

echo Cleaning Surplus Files
cd ~/
rm -rf ~/${TEMP}

echo Please remember to check main.inc.php.dist for changes.
echo ---------- INSTALL COMPLETE! ----------
Personal tools