Changing From SquirrelMail To RoundCube On Your ISPConfig3 Server

Want to support HowtoForge? Become a subscriber!
 
Submitted by /<2 (Contact Author) (Forums) on Fri, 2010-02-26 17:58. :: ISPConfig | Control Panels | Email

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 HowtoForge Team for your excellent work.


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by emrahbil (registered user) on Sun, 2013-04-21 13:07.

hello , it worked new version of roundcube 0.9.0 on centos6.3 x86_64 thanks a lot,

greeting from turkey...

Submitted by Rogério (not registered) on Mon, 2011-06-20 18:42.

Thanks man! Thanks to you I have a nice webmail running in my server!

 

Submitted by koslibpro (not registered) on Sun, 2012-02-26 12:59.
man,how can you add new users though if you run it locally?i can log in only with system users..
Submitted by enrique (not registered) on Tue, 2011-02-22 21:37.

 very good post thanks, gretings from Paraguay

Submitted by rogeriosjr (registered user) on Mon, 2010-10-18 03:08.

Hi!

I installed roudcube as you instructed on my CentOS 5.5 x64 OS with ISPConfig 3.0.3.

Everything is fine (MySQL, Apache etc) but when I access RoudCube index.php http://[server_ip_address]/webmail I receive a blank page instead the login page.

Can you help me?

Regards,

RogerioSJr.

Submitted by all (registered user) on Fri, 2011-02-25 17:49.

Damn blank page after install, NO error nothing.

 

Cannot use it. Strange no one find out solution yet?

Submitted by strength (registered user) on Tue, 2010-06-08 11:34.
it was like a walk in a park to follow this great tutorial, thank you very much
Submitted by Horfic (registered user) on Mon, 2010-03-01 07:38.

I just want to add, that there is a migration plugin from Squirrelmail to Roundcube.

http://trac.roundcube.net/browser/trunk/roundcubemail/plugins/squirrelmail_usercopy

It copys the user settings.

Submitted by BorderAmigos (not registered) on Fri, 2010-02-26 22:59.

I did a similar set up in Debian.  But I kept SquirrelMail and also added Horde.  Then put a menu page at /var/www/webmail so the user can pick which of the 3 clients they'd like to use.

 

Submitted by Anonymous (not registered) on Mon, 2010-07-19 12:41.
Please give me the steps to keep all squirrelmail,horde and roundcube
Submitted by dclardy (not registered) on Sat, 2010-03-06 02:26.
Can you share the coding of your homepage? I would like to implement something similar on my servers. Since you have already done it, it would make it much easier on my end.