Install and set-up Roundcube webmail interface


Install and set-up Roundcube webmail interfaceThe following article is about how to install and set-up the Roundcube webmail interface on a CentOS VPS.

It is actually part 2 of our mailserver with virtual users and domains using Postfix and Dovecot on a CentOS 6 VPS series.

What is Roundcube?

Roundcube is a web-based IMAP email client written in PHP. Roundcube’s most prominent feature is the pervasive use of Ajax technology to present a more fluid and responsive user interface than the one of traditional webmail clients. It provides full functionality you expect from an email client, including MIME support, address book, folder manipulation, message searching, spell checking etc…

As usual, before proceeding any further, SSH to your CentOS 6 VPS, fire-up a screen session and make sure your system is fully up-to-date by running:

## screen -U -S roundcube-screen
## yum update

Roundcube requires PHP, a webserver and a database server. We are going to use the LAMP stack here, so, if LAMP is not already set-up on your system please check our fine tutorial on how to install LAMP (Linux Apache MySQL and PHP) on CentOS 6.

Ok, next step is to set-up a database for Roundcube using the following commands:

## mysql -u root -p
mysql> CREATE DATABASE IF NOT EXISTS `roundcube`;
mysql> GRANT ALL PRIVILEGES ON `roundcube` . * TO 'roundcube'@'localhost' IDENTIFIED BY 'mySecretPassword';
mysql> FLUSH PRIVILEGES;
mysql> quit

make sure you change ‘mySecretPassword‘ with your own one.

Before downloading and installing Roundcube, let’s first create Roundcube’s Apache configuration file in /etc/httpd/conf.d/90-roundcube.conf by using an editor:

## vim  /etc/httpd/conf.d/90-roundcube.conf

and paste the following:

Alias /webmail /var/www/html/roundcube

<Directory /var/www/html/roundcube>
    Options -Indexes
    AllowOverride All
</Directory>

<Directory /var/www/html/roundcube/config>
    Order Deny,Allow
    Deny from All
</Directory>

<Directory /var/www/html/roundcube/temp>
    Order Deny,Allow
    Deny from All
</Directory>

<Directory /var/www/html/roundcube/logs>
    Order Deny,Allow
    Deny from All
</Directory>

So far so good. Now, download and set-up the latest version of Roundcube to /var/www/html/roundcube using:

## curl -L "http://sourceforge.net/projects/roundcubemail/files/latest/download?source=files" > /tmp/roundcube-latest.tar.gz
## tar -zxf /tmp/roundcube-latest.tar.gz -C /var/www/html
## rm -f /tmp/roundcube-latest.tar.gz
## cd /var/www/html
## mv roundcubemail-* roundcube
## chown root: -R roundcube/
## chown apache: -R roundcube/temp/
## chown apache: -R roundcube/logs/

Next thing to do, is to set-up Roundcube’s main.inc.php configuration file. But, before setting it up, let’s first create all the necessary database tables for Roundcube using:

## mysql -u roundcube -p"mySecretPassword" roundcube < roundcube/SQL/mysql.initial.sql

again, make sure you use the correct MySQL user/password combination

with tables in place, proceed with copying the main.inc.php.dist sample configuration file and editing main.inc.php:

## cp roundcube/config/main.inc.php.dist roundcube/config/main.inc.php
## vim roundcube/config/main.inc.php
change:
  $rcmail_config['default_host'] = '';
to
  $rcmail_config['default_host'] = 'localhost';

change:
  $rcmail_config['smtp_server'] = '';
to
  $rcmail_config['smtp_server'] = 'localhost';

change:
  $rcmail_config['smtp_user'] = '';
to
  $rcmail_config['smtp_user'] = '%u';

change:
  $rcmail_config['smtp_pass'] = '';
to
  $rcmail_config['smtp_pass'] = '%p';

change:
  $rcmail_config['quota_zero_as_unlimited'] = false;
to
  $rcmail_config['quota_zero_as_unlimited'] = true;

change:
  $rcmail_config['preview_pane'] = false;
to
  $rcmail_config['preview_pane'] = true;

change:
  $rcmail_config['read_when_deleted'] = true;
to
  $rcmail_config['read_when_deleted'] = false;

change:
  $rcmail_config['check_all_folders'] = false;
to
  $rcmail_config['check_all_folders'] = true;

save and close the configuration file and proceed with setting up Roundcube’s database configuration file:

## cp roundcube/config/db.inc.php.dist roundcube/config/db.inc.php
## vim roundcube/config/db.inc.php
change:
  $rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';
to
  $rcmail_config['db_dsnw'] = 'mysqli://roundcube:mySecretPassword@localhost/roundcube';

save and close the configuration file and remove the installer directory using:

## rm -rf roundcube/installer/

finally, restart Apache using:

## service httpd restart

and login to your webmail at http://yourdomain.com/webmail


Adding Roundcube Webmail to the mailserver set-up with virtual users and domains using Postfix and Dovecot on a CentOS VPS provides you with a web-based email client solution for managing your user’s emails.

There are still other parts missing such as SSL encrypted connection, anti-spam service, digital signatures using opendkim, filter rules etc for a full-featured mail server. In the next few related articles, we will be adding additional features to the set-up so stay tuned.

Update: Part 3 – Set-up SSL encrypted connection in Postfix, Dovecot and Apache

Update: Part 4 – How to install and integrate SpamAssassin with Postfix on a CentOS 6 VPS

Update: Part 5 – How to install and integrate OpenDKIM with Postfix on a CentOS 6 VPS

Update: Part 6 – How to set-up server-side email filtering with Dovecot Sieve and Roundcube on a CentOS 6 VPS


Of course, if you are one of our Linux VPS Hosting customers, you don’t have to do any of this, simply ask our admins, sit back and relax. Our admins will set this up for you immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Tutorials
How to install eGroupware on an Ubuntu 14.04 VPS
Tutorials
Install Plone with Nginx on a Debian 8 VPS
Tutorials
Install PHP-Fusion 7 on a CentOS 7 VPS
  • Timothy

    TimothyTimothy

    Author Reply

    Thanks for setting up the guide however I am stuck at where it says to type “## mysql -u roundcube -p”mySecretPassword” roundcube and I have to ctrl c to quit because nothing else happens.

    Am I stuck now…..please respond with help asap. thanks


    • admin

      adminadmin

      Author Reply

      You need to be inside your ‘/var/www/html/’ directory and execute the command, but without the two ‘##’ at the beginning. The command should be:

      mysql -u roundcube -p”mySecretPassword” roundcube < roundcube/SQL/mysql.initial.sql Where 'mySecretPassword' is the password you chose when creating the database. Please clarify your question further if this answer was not clear enough or maybe misleading.


  • Timothy

    TimothyTimothy

    Author Reply

    Thanks for the reply, I forgot the l in sql when copying the command silly me. I tried it and works, great thanks to you!!!!!!


    • admin

      adminadmin

      Author Reply

      You are welcome.


  • Nauman

    NaumanNauman

    Author Reply

    SIr,

    Please tell me whats the default username and password for login in webmail ?

    i complete the whole istallation, as you described… but i need login credentials,,,, it is giving me error “connection to storage server failed”


    • admin

      adminadmin

      Author Reply

      You should login with your email and password. Please refer to the previous article in this series.


  • Renuka

    RenukaRenuka

    Author Reply

    I am not able to login into round cube webmail


    • admin

      adminadmin

      Author Reply

      What error do you get ?


  • Seyma

    SeymaSeyma

    Author Reply

    Hi,

    I’ve just followed the above steps, but I got one error at the end. When I access via a web browser, it say that “DATABASE ERROR: CONNECTION FAILED!” Unable to connect to the database!
    I tried to check and reconfigured it again, but the problem still exist.

    Please advise what should I do to solve this.
    Thanks


    • admin

      adminadmin

      Author Reply

      You should check if the mysql user credentials and privileges are OK.


  • Laxmikant Gudipaty

    Can anyone help out in setting up a LAN based mail server using Roundcube?
    I’m a newbie,so dont be too hard on me. I need well defined instructions to set up a local mail server that works only within LAN and my machine being the mail server. I havent had much luck in finding out documentation on how to go on about this. Thanks


  • YohMz

    YohMzYohMz

    Author Reply

    is this guide applicable to “Debian Squeeze (old stable)” version?.. or i’m at the wrong page, i really like the guides here at rosehosting that why i stick to this site.

    Thanks in advance! hope i can get a response


    • admin

      adminadmin

      Author Reply

      This is for CentOS 6 but can be used as a guide to setup Roundcube in a Debian Squeeze based virtual server.

      Everything should be the same except Roundcube’s apache configuration and document root. They are differently setup in Debian. (location, paths etc)


  • Supriyo

    SupriyoSupriyo

    Author Reply

    Hi People,

    I have just completed the second part of the article. installed and configured Roundcube in my Centos6 VBox. I can open xxx.xxx.xxx.xxx:webmail from my host machine running Windows7. My problems are:
    1> cannot login to roundcube webmail portal
    2> cannot configure the account in Outlook as its showing error in POP3 and SMTP erro.
    (as the article mentioned in the first part to configure the mail in any preferred client, so i tried to do that, but its not working. But i can connect to pop3 and smtp through when im connected to my centos6 Vbox using putty).

    Please Help.


    • admin

      adminadmin

      Author Reply

      1. Did you check your Roundcube log files for errors?

      2. How did you configure your Outlook email account?
      If you want to create and use POP3 email accounts, use the following settings:
      Incoming mail server:
      Port: 110 (POP3) or 995 (POP3S)
      Outgoing (SMTP) server:

      Port: 25 or 587
      If you want to create an IMAP email account, use the following settings:
      Incoming mail server:

      Port: 143 (IMAP) or 993 (IMAPS)
      Outgoing (SMTP) server:

      Port: 25 or 587


  • Supriyo

    SupriyoSupriyo

    Author Reply

    Sorry, the link should be
    xxx.xxx.xxx.xxx:webmail ..
    I mistyped


  • Supriyo

    SupriyoSupriyo

    Author Reply

    Hey Admin,

    I resolved it…. it was damn SElinux… :)
    Just made some rules over there, added IPtables rules and now it is working just fine……

    But again stuck on secure pop3 and SMTP part :(


    • admin

      adminadmin

      Author Reply

      Did you check your mail server log files?


  • anton

    antonanton

    Author Reply

    Hello! Your guide is awesome! But i cant find main.inc.php.dist file in /var/www/html/roundcube/config What i do wrong?


    • Jon

      JonJon

      Author Reply

      I couldn’t find this file either … what ever you did wrong, I did wrong too!


      • incubus

        incubusincubus

        Author Reply

        ok this is strange mr admin that you dont have answer for this problem where is this main.inc.php.dst file??? after following your all steps.


        • admin

          adminadmin

          Author Reply

          In the new version of Roundcube the configuration file named ‘main.inc.php’ is deprecated and it is replaced with ‘config.inc.php’.


  • Shuvro

    ShuvroShuvro

    Author Reply

    Anyone..!!! Please help me in Roundcube Change Password plugin.
    I’m using exim MTA and SQL driver in password plugin.
    I’m stuck with the following error output:
    DB Error in /var/www/html/roundcube/program/include/rcube_mdb2.php (727): MDB2 Error: not found Query: _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT update_passwd(‘$1$uTS6.XKG$F0muyKExdd877wDgRSfMD1′, ’roundtest’)] [Native code: 1305] [Native message: FUNCTION roundcube.update_passwd does not exist]


    • admin

      adminadmin

      Author Reply

      Please sync plugin password config file. It’s config file should be /var/www/html/roundcube/program/plugins/password/config.inc.php


  • Shuvro

    ShuvroShuvro

    Author Reply

    Please help…
    I’m getting following output in roundcube change password plugin.

    DB Error in /var/www/html/roundcube/program/include/rcube_mdb2.php (727): MDB2 Error: not found Query: _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT update_passwd(‘$1$uTS6.XKG$F0muyKExdd877wDgRSfMD1′, ’roundtest’)] [Native code: 1305] [Native message: FUNCTION roundcube.update_passwd does not exist]

    My MTA is exim….


    • admin

      adminadmin

      Author Reply

      Please sync plugin password config file. It’s config file should be /var/www/html/roundcube/program/plugins/password/config.inc.php


  • Angshu

    AngshuAngshu

    Author Reply

    I want to change password of email id from roundcube plugins. I am using roundcube 1.1.1.
    To activate password plugins:- open /var/www/html/roundcube/config/config.inc.php and change $config[‘plugins’] =arrary() to $config[‘plugins’] =arrary(password);

    Then rename /var/www/html/roundcube/program/plugins/password/config.inc.php.dist. to config.inc.php. Then password option shown in the roundcube webmail. But it is not work.

    There are lots of driver available . But which driver is suitable for this kind mail configuration and configuration process. I want , mail user should able to change password himself. If it is not possible, then please suggest alternative good solution.
    Please help me to solve this problem.


  • Anup

    AnupAnup

    Author Reply

    I am using roundcube 1.1.1. I want to activate password in roundcube.
    I have change in /var/www/html/roundcube/config/config.inc.php
    #$config[‘plugins’] = array ();
    $config[‘plugins’] = array (password);
    Then go to # cd /var/www/html/roundcube/plugins/password
    #rm config.inc.php.dist config.inc.php
    After that I have checked that password option is activated in roundcube webmail.
    But it is not working. I also configure SSL, it works fine.
    But in the plugging, there are several drivers for change password.
    In the part I, this website configure mail passwd /etc/dovecot/password file.
    And also use # doveadm pw -s sha1 | cut -d ‘}’ -f2 for password creation form centos os.
    But which drive is best for change passwod In roundcube and how I can do it. I don’t understand.
    Please help me,,, If anyone help me , I will grateful.


  • Kevin Roggeman

    I want to acces my mail server everywhere
    How do I access r roundcube with ex http://www.mail.com/webmail and not with my ip adrress ?


    • admin

      adminadmin

      Author Reply

      Create a new virtual host in Apache, for example:

      <VirtualHost *:80>
      ServerAdmin admin@mail.com
      ServerName mail.com
      ServerAlias www.mail.com
      DocumentRoot /var/www/html/roundcube
      <Directory /var/www/html/roundcube>
      Options -Indexes
      AllowOverride All
      </Directory>
      </VirtualHost>

      Do not forget to restart your Apache service for the changes to take effect.


  • Mil0tche

    Mil0tcheMil0tche

    Author Reply

    I’m trying to use the “password” plugin. It do updates a password field in my mysql db but the Roundcube still log in at the remote webmail server. What I’m a doing wrong


  • Anand

    AnandAnand

    Author Reply

    thanks for this tutorial….. i tried its working for me.