Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

Changing From SquirrelMail To RoundCube On Your ISPConfig3 Server


This tutorial has been created for those who have installed The Perfect Server – CentOS 5.4 x86_64 [ISPConfig 3] and do not like SquirrelMail as webmail client. Here’s a guide to replace SquirrelMail with RoundCube, which is more visually attractive and easier to manage for our clients.

Important! I have not tried, but… like how to install SquirrelMail has not changed in recent CentOS 5.x Perfect Server Howtos. I think this tutorial is also valid for earlier versions of CentOS, and even other Linux distributions, it does not change practically anything in the system.

Step 1.

Download RoundCube, unpack, remove unnecessary files and prepare the installation folder. Replace roundcubemail-0.3.1 for the last available.

cd /usr/share
wget http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/0.3.1/roundcubemail-0.3.1.tar.gz?use_mirror=ignum
tar -vxf roundcubemail-0.3.1.tar.gz
rm -fr roundcubemail-0.3.1.tar.gz
cd roundcubemail-0.3.1
rm -fr installer
chmod 755 temp logs
cd config
cp db.inc.php.dist db.inc.php
cp main.inc.php.dist main.inc.php

 

Step 2.

Now let’s create our database for RoundCube. I created mine with ISPConfig because I want it to be shown in my ISPConfig database list. This is my Database sample:

Database name: roundcubedb
Database user: roundcubeuser
Database pass: 12345

Change these for more security

 

Step 3.

It is necessary to install RoundCube manually, because if you use the RoundCube installer, will report an php version error and will not continue with the installation. Edit the file db.inc.php, we seek the following line and edit it with our data (the database we have created in ISPConfig).

vi db.inc.php

Change the line:

[...]
$rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
[...]

to:

[...]
$rcmail_config['db_dsnw'] = 'mysql://roundcubeuser:12345@localhost/roundcubedb'; 
[...]

 

Also change these settings in the file main.inc.php:

vi main.inc.php

Change the lines:

[...]
$rcmail_config['message_cache_lifetime'] = '10d';
[...]
$rcmail_config['default_host'] = '';
[...]
$rcmail_config['smtp_server'] = '';
[...]
$rcmail_config['session_lifetime'] = 10;
[...]
$rcmail_config['create_default_folders'] = FALSE;
[...]

to:

[...]
$rcmail_config['message_cache_lifetime'] = '30m'; 
[...]
$rcmail_config['default_host'] = 'localhost';
[...]
$rcmail_config['smtp_server'] = '%h'; 
[...]
$rcmail_config['session_lifetime'] = 30; 
[...]
$rcmail_config['create_default_folders'] = TRUE;
[...]

 

Step 4.

Now we have to create manually the tables in our RoundCube database. Search mysql.initial.sql file in roundcubemail-0.3.1/SQL/ folder and copy its contents:

-- RoundCube Webmail initial database structure
/*!40014  SET FOREIGN_KEY_CHECKS=0 */;
-- Table structure for table `session`
CREATE TABLE `session` (
 `sess_id` varchar(40) NOT NULL,
 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `ip` varchar(40) NOT NULL,
 `vars` mediumtext NOT NULL,
 PRIMARY KEY(`sess_id`),
 INDEX `changed_index` (`changed`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `users`
CREATE TABLE `users` (
 `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 `username` varchar(128) NOT NULL,
 `mail_host` varchar(128) NOT NULL,
 `alias` varchar(128) NOT NULL,
 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `last_login` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `language` varchar(5),
 `preferences` text,
 PRIMARY KEY(`user_id`),
 INDEX `username_index` (`username`),
 INDEX `alias_index` (`alias`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `messages`
CREATE TABLE `messages` (
 `message_id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
 `del` tinyint(1) NOT NULL DEFAULT '0',
 `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL,
 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `idx` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `uid` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `subject` varchar(255) NOT NULL,
 `from` varchar(255) NOT NULL,
 `to` varchar(255) NOT NULL,
 `cc` varchar(255) NOT NULL,
 `date` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `size` int(11) UNSIGNED NOT NULL DEFAULT '0',
 `headers` text NOT NULL,
 `structure` text,
 PRIMARY KEY(`message_id`),
 INDEX `created_index` (`created`),
 INDEX `index_index` (`user_id`, `cache_key`, `idx`),
 UNIQUE `uniqueness` (`user_id`, `cache_key`, `uid`),
 CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
   REFERENCES `users`(`user_id`)
   /*!40008
     ON DELETE CASCADE
     ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `cache`
CREATE TABLE `cache` (
 `cache_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 `cache_key` varchar(128) /*!40101 CHARACTER SET ascii COLLATE ascii_general_ci */ NOT NULL ,
 `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `data` longtext NOT NULL,
 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
 PRIMARY KEY(`cache_id`),
 INDEX `created_index` (`created`),
 INDEX `user_cache_index` (`user_id`,`cache_key`),
 CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
   REFERENCES `users`(`user_id`)
   /*!40008
     ON DELETE CASCADE
     ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `contacts`
CREATE TABLE `contacts` (
 `contact_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
 `del` tinyint(1) NOT NULL DEFAULT '0',
 `name` varchar(128) NOT NULL,
 `email` varchar(128) NOT NULL,
 `firstname` varchar(128) NOT NULL,
 `surname` varchar(128) NOT NULL,
 `vcard` text NULL,
 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
 PRIMARY KEY(`contact_id`),
 INDEX `user_contacts_index` (`user_id`,`email`),
 CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
   REFERENCES `users`(`user_id`)
   /*!40008
     ON DELETE CASCADE
     ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-- Table structure for table `identities`
CREATE TABLE `identities` (
 `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
 `del` tinyint(1) NOT NULL DEFAULT '0',
 `standard` tinyint(1) NOT NULL DEFAULT '0',
 `name` varchar(128) NOT NULL,
 `organization` varchar(128) NOT NULL DEFAULT '',
 `email` varchar(128) NOT NULL,
 `reply-to` varchar(128) NOT NULL DEFAULT '',
 `bcc` varchar(128) NOT NULL DEFAULT '',
 `signature` text,
 `html_signature` tinyint(1) NOT NULL DEFAULT '0',
 `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
 PRIMARY KEY(`identity_id`),
 CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
   REFERENCES `users`(`user_id`)
   /*!40008
     ON DELETE CASCADE
     ON UPDATE CASCADE */
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
/*!40014 SET FOREIGN_KEY_CHECKS=1 */;

Now go to http://www.yourdomain.tld:8080/phpmyadmin, enter your MySQL username and password. Select our RoundCube database “roundcubedb” and go to SQL tab, into the textbox, paste the text you’ve copied mysql.initial.sql and execute the query. We successfully installed RoundCube Webmail.

Step 5.

We want RoundCube as our default Webmail. SquirrelMail will not be used, nor do we want our clients to suffer any alteration. We proceed like this: This step each one can adapt to their needs. SquirrelMail can be kept, creating a new alias for RoundCube.

cd /usr/share
mv squirrelmail squirrelmail.bak
mv roundcubemail-0.3.1 squirrelmail

 

Step 6.

Finally go to http://www.yourdomain.tld:8080/webmail and sign in to enjoy this cute Webmail.

 

Information:

– More information about RoundCube: http://www.roundcube.net
– Falko´s Howto The Perfect Server – CentOS 5.4 x86_64 [ISPConfig 3]

 

Special Thanks to:

– Falko. Your Perfect Server Howtos helped me a lot in my initiation with Linux servers.
– My girlfriend Naty. She did the translation of the text.
– The Kreationnext Team for your excellent work.

Comments

comments