Thursday, April 5, 2012

Installing Roundcube on Plesk

If you are looking at this post, i would recommend upgrading to Plesk 12 instead.



What i use to install roundcube on plesk 10.X/11
I have successfully installed this same setup on all versions of plesk 8.x-11.x
This has also been tested with roundcube 8.0 to 9.0(beta/RC)


This does not update/conflict or change any of plesks default configurations!


You can almost copy past all commands and it'll work, its really easy to setup

# mkdir /var/www/roundcube
# cd /var/www/roundcube
# wget roundcube install from http://roundcube.net/download
# tar -xvzf roundcubemail-version.tar.gz
# mv /var/www/roundcube/roundcubemail-version/* /var/www/roundcube/
# chown -R apache.apache logs temp
# chmod 777 logs temp

You can create any database name/username you want
# mysql -uadmin -p`cat /etc/psa/.psa.shadow`
mysql> create database roundcubedb;
mysql> grant all privileges on roundcubedb.* to roundcubeuser@localhost identified by 'PASSWORD';
mysql> FLUSH PRIVILEGES;
mysql> exit
# mysql roundcubedb < SQL/mysql.initial.sql  -uadmin -p`cat /etc/psa/.psa.shadow`
# cp config/db.inc.php.dist config/db.inc.php
# cp config/main.inc.php.dist config/main.inc.php

Connecting roundcube to its database
# vi config/db.inc.php
:/db_dsnw
Change the below to the password you created above
$rcmail_config['db_dsnw'] = 'mysql://roundcubeuser:PASSWORD@localhost/roundcubedb';

Create the below httpd.conf
# vi /etc/httpd/conf.d/roundcube.conf (or /etc/apache2/conf.d/roundcube.conf)
<VirtualHost SERVER_IP:80>
ServerName webmail
ServerAlias webmail.*
DocumentRoot /var/www/roundcube
    <Directory "/var/www/roundcube">
</Directory>
</VirtualHost>

Restart apache.

This will load over the top of Atmail and horde, if not disable both horde and AtMail


You need to change the below otherwise you have to type in the domain each time you login

# vi config/main.inc.php
$rcmail_config['default_host'] = NULL; to $rcmail_config['default_host'] = 'localhost';
I also change the following as i noticed some issues with folders not working properly on IMAP
 //$rcmail_config['create_default_folders'] = false;
$rcmail_config['create_default_folders'] = true;


If you want to run the installer to test everything works you can change the following, i dont bother though
# vi config/main.inc.php
:/enable_installer
$rcmail_config['enable_installer'] = true;

Enabling password change

# cp plugins/password/config.inc.php.dist plugins/password/config.inc.php
# vi plugins/password/config.inc.php
Change first line to $rcmail_config['password_driver'] = 'poppassd';
:wq
# vi config/main.inc.php
(find plugin):/'plugins'
Change it to $rcmail_config['plugins'] = array('password')
Now when you login, go to settings. You can now update the password!

Other settings that can help!


I also set the following so emails always used Html not plain text
# vi config/main.inc.php
:/htmleditor
// 0 - never, 1 - always, 2 - on reply to HTML message only
$rcmail_config['htmleditor'] = 1;


Some common install bugs


Log in issue (instantly fails) Change the line main.inc.php the following Line from "null" to "plain"
# vi main.inc.php
:/imap_auth_type
$rcmail_config['imap_auth_type'] = plain;

Issue with Roundcube, settings page displays white.
# vi /etc/php.ini
:/date.timezone
I updated mine to date.timezone = "Australia/Sydney"
Settings page now works

If you find you are having issues with moving items to other folders/deleting/emails aren't displaying in sent, they the following

//$rcmail_config['drafts_mbox'] = 'Drafts';
$rcmail_config['drafts_mbox'] = 'INBOX.Drafts';

//$rcmail_config['junk_mbox'] = 'Junk';
$rcmail_config['drafts_mbox'] = 'INBOX.Junk';

//$rcmail_config['sent_mbox'] = 'Sent';
$rcmail_config['drafts_mbox'] = 'INBOX.Sent';

//$rcmail_config['trash_mbox'] = 'Trash';
$rcmail_config['drafts_mbox'] = 'INBOX.Trash';

//$rcmail_config['default_imap_folders'] = array('INBOX', 'Drafts', 'Sent', 'Junk', 'Trash');
$rcmail_config['default_imap_folders'] = array('INBOX', 'INBOX.Drafts', 'INBOX.Sent', 'INBOX.Junk', 'INBOX.Trash');



You need a httpd restart for this to take affect

If you want to add dns records to all the domains on your hosting you can run this script
mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e "select name from domains" | xargs -I {} /usr/local/psa/bin/./dns --add {} -a roundcube -ip SERVER_IP
Also add an entry into your plesk DNS template, so any newly added domains will have this dns record automatically 
Now you should be able to using roundcube on any domain with the "http://roundcube.domain.com"

Also i have setup, when this wasnt setup any resolving/wildcard dns would display roundcube
vi /etc/httpd/conf.d/default.conf
<VirtualHost SERVER_IP:80>

ServerName default
ServerAlias default.*
DocumentRoot /var/www/vhosts/default/htdocs
        <Directory "/var/www/vhosts/default/htdocs">
        </Directory>
</VirtualHost>

9 comments:

  1. Hi there,

    I did every step of your tutorial (wich is very clear to me) but at the moment i go to webmail.domain.com i get the default parallels plesk page. So i'm guessing my virtualhost file doesn't seem to work. I did make it at the httpd directory since i don't have the apach2 directory. It's saved and i'm 100% sure it's as way you described it in the tutorial. I did restart apache but not nginx. What can be wrong or what should i do to make it work?

    ReplyDelete
    Replies
    1. Hi.
      happened to me the same as you indicate,i apply the following settings, restart apache and it worked properly. I hope it works for you.

      < VirtualHost IP_SERVER:7080 \
      127.0.0.1:7080>
      ServerName roundcube.webmail
      ServerAlias roundcube.webmail.*
      DocumentRoot /var/www/roundcube/
      < Directory "/var/www/roundcube/" >

      < / VirtualHost >
      IP_SERVER = your server's public IP, exam : 200.20.20.20

      Delete
  2. This has been a huge help...but, I have found Dedicated IP sites do NOT work with this setup.

    I have tried variations on the VirtualHost setup, but to no avail. I can get the site to show up if I use the shared IP for webmail., but all CSS and visuals are broken.

    Great tutorial...and will be deprecated upon the release of Plesk 11.5, which introduces Roundcube as the default webmail.

    Cheers

    ReplyDelete
    Replies
    1. Yea i have installed 11.5 on one of my server, but waiting a little before i do it on all of them.. big updates scare me with plesk!

      Not sure how you have installed it, but i have had it running with no issues on all of my dedicated IP addresses.

      If vhosts work, and its an issue with the CSS try checking the logs or something.
      See why the CSS is breaking or if it isnt able to access images?

      Delete
  3. Hello dear friends:

    I have installed Plesk 11.5 that has the possibility to use RoundCube as webmail. Right now the installed version is 0.8.6 but the last version published by roundcube.net is 0.9.2.

    Could you be so kind to help me to upgrade the installed version in Plesk 11.5 to the last version ??

    Thank you very much in advance for your support.

    Alfonso Fernandez

    ReplyDelete
    Replies
    1. I wouldn't recommend doing it, but you could download and dump the files in /usr/share/psa-roundcube/

      copy the config/db files to keep things consistent.
      you'd most likely need to keep the plugins directory as well.

      I think it would be alot of messing around for update.

      In theory just running the upgrade script may work, but im not sure how Parallels have set everything up with the database etc.

      Delete
  4. Hello. I have a question: I've installed two RCs on the same server (both are working fine, 2nd one was because one client wanted hosting with us and its own customized layout). However, everything is fine, just one thing:
    - when i enter clean server hostname like "myserverhostame.com" I end up on this second RC? Why? Why plesk default page is not shown or why I am not redirected to the plesk panel? That second RC is also on different IP address and servername is webmail.newclientdomainname,com, document root, new one, its own.

    ReplyDelete
  5. RoundcubeSkins.Com COLORFUL skins for Roundcube Webmail Client !!! Roundcube our skins are compatible for 0.8.x, 0.9.0 and Soon we will be coming up with all our roundcubeskins compatible with 1.0 beta release of roundcube webmail. So keep visiting our site for updates!!

    ReplyDelete
  6. Awesome! It worked like a charm. Thanks!

    ReplyDelete