Roundcube
---------
[root@www ~]# mysql -u root -p
Enter password:
# create [roundcube] database (replace 'password' to your own password you'd like to set)
MariaDB [(none)]> create database roundcube;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on roundcube.* to roundcube@'localhost' identified by 'password';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye
Install and Configure RoundCube
yum install -y php php-json php-mcrypt php-cli php-gd php-curl php-xml php-mysql php-mbstring php-pspell php-imagick php-imap php-pear-DB
yum install -y php56w php56w-json php56w-mcrypt php56w-cli php56w-gd php56w-curl php56w-xml php56w-mysql php56w-mbstring php56w-pspell php56w-imagick php56w-imap php-pear-DB
[root@www ~]# yum --enablerepo=epel -y install roundcubemail php-mysql
[root@www ~]# cd /usr/share/roundcubemail/SQL
[root@www SQL]# mysql -u roundcube -D roundcube -p < mysql.initial.sql
Enter password: MariaDB roundcube password
[root@www SQL]# cd
[root@www ~]# cp -p /etc/roundcubemail/defaults.inc.php /etc/roundcubemail/config.inc.php
[root@www ~]# vi /etc/roundcubemail/config.inc.php
# line 27: change like follows (replace your password for 'password')
$config['db_dsnw'] = 'mysql://roundcube:password@localhost/roundcube';
# line 127: specify IMAP server (STARTTLS setting)
$config['default_host'] = 'tls://mail.worldcm.net';
# line 130: specify IMAP port (STARTTLS setting)
$config['default_port'] = 143;
# line 232: specify SMTP server (STARTTLS setting)
$config['smtp_server'] = 'tls://mail.worldcm.net';
# line 236: specify SMTP port (STARTTLS setting)
$config['smtp_port'] = 587;
# line 240: change (use the same user for SMTP auth and IMAP auth)
$config['smtp_user'] = '%u';
# line 244: change (use the same password for SMTP auth and IMAP auth)
$config['smtp_pass'] = '%p';
# line 248: change (SMTP auth type)
$config['smtp_auth_type'] = 'LOGIN';
# line 260: specify SMTP HELO host
$config['smtp_helo_host'] = 'mail.worldcm.net';
# line 449: specify your domain name
$config['mail_domain'] = 'worldcm.net';
# line 467: change title
$config['product_name'] = 'Server World Webmail';
# line 470: change UserAgent
$config['useragent'] = 'Server World Webmail';
# line 602: change to your language
$config['language'] = ja_JP;
# line 953: change default char-set to your language
$config['default_charset'] = 'iso-2022-jp';
[root@www ~]# vi /etc/httpd/conf.d/roundcubemail.conf
# Round Cube Webmail is a browser-based multilingual IMAP client
#
Alias /roundcubemail /usr/share/roundcubemail
Alias /webmail /usr/share/roundcubemail
# Define who can access the Webmail
# You can enlarge permissions once configured
<Directory /usr/share/roundcubemail/>
Options none
AllowOverride Limit
Require all granted
</Directory>
# Define who can access the installer
# keep this secured once configured
<Directory /usr/share/roundcubemail/installer>
Options none
AllowOverride Limit
Require all granted
</Directory>
# Those directories should not be viewed by Web clients.
<Directory /usr/share/roundcubemail/bin/>
Order Allow,Deny
Deny from all
</Directory>
<Directory /usr/share/roundcubemail/plugins/enigma/home/>
Order Allow,Deny
Deny from all
</Directory>
----------------------------------------------------
root@www ~]# systemctl restart httpd
http://192.168.80.1/webmail
[root@www ~]# cd /usr/share/roundcubemail/SQL
[root@www ~]# cp -p /etc/roundcubemail/defaults.inc.php /etc/roundcubemail/config.inc.php
RoundCubeMail
===
[9]
Access to [https://(your server's hostname or IP address/)/roundcubemail/],
---
https://blog.iandreev.com/?p=2004
In one of my previous posts, I’ve described how to install Roundcube web mail client on a CentOS 6. This time, we’ll do the same for CentOS 7.
There are some prerequisites. First, you need a working LAMP stack (Linux, Apache, MySQL and PHP). Read here how to install this. Then, you need a working mail server. You can also read here how to do this. Once you have that completed and tested, we can install Roundcube from the source. In my case, I’ll use roundcube as a virtual Apache host at mail.domain.com. Go to Roundcube’s web site and download the latest tarball and put it under /var/www or just execute this:
1
2
3
4
5
6
cd /var/www
wget http://iweb.dl.sourceforge.net/project/roundcubemail/roundcubemail/1.1.1/roundcubemail-1.1.1-complete.tar.gz
tar xzvf roundcubemail-1.1.1-complete.tar.gz
rm -f roundcubemail-1.1.1-complete.tar.gz
mv roundcubemail-1.1.1 mail.domain.com
chown -R apache:apache mail.domain.com
This is your DocumentRoot /var/www/mail.domain.com. You can rename or move the directory somewhere else if you want, but you have to change the virtual host config files as well.
First, change the date and time zone in PHP. Just edit /etc/php.ini and change the date.timezone variable. In my case it looks like this (don’t forget to remove the semi-colon in front).
Pick your time zone from here.
Then, install some PHP modules needed fro Roundcube.
1
date.timezone = America/New_York
1
2
yum install php-xml php-mbstring php-intl php-mcrypt php-ldap
apachectl restart
Finally, create the database.
1
2
3
4
5
mysql -u root -p
create database roundcube;
grant all privileges on roundcube.* to 'roundcube'@'localhost' identified by 'password';
flush privileges;
quit
This will create a database called roundcube and a MySQL user called roundcube with password…well password, so replace the values to suit your needs. Now, browse to the DocumentRoot, the directory where you installed Roundcube, by doing http://yourserver.com/roundcube/installer or http://roundcube.yourserver.com/installer. In my case, I’ve placed the files under /var/www/mail.domain.com, so I have to go to http://mail.domain.com/installer.
You should see something like this.
Click Next at the bottom to reach step 2.
Look for the Database setup and enter the database name and the credentials that you’ve created above in MySQL.
For IMAP settings, use ssl://localhost and port 993.
For SMTP settings type tls://localhost and port 587. Check “Use the current IMAP username…“.
Scroll all the way at the bottom and click Create Config. Roundcube will create the config file for you and hopefully it will tell you that everything is OK.
Click Continue.
You will notice that the database is not initialized, so click Initialize database.
Look at the bottom where it says “After completing the installation and the final tests please remove the whole installer folder from the document root of the webserver or make sure that enable_installer option in config.inc.php is disabled.”
Do that:
1
2
cd /var/www/mail.domain.com
mv installer installer.something_here_not_easy_to_remember
Finally, point your browser to the main URL in my case http://mail.domain.com.
##########################################################
----
Install Roundcube webmail
To install the RoundCube webmail client, run...
yum -y install roundcubemail
Change the roundcubemail.conf configuration file as follows:
nano /etc/httpd/conf.d/roundcubemail.conf
# # Round Cube Webmail is a browser-based multilingual IMAP client # Alias /roundcubemail /usr/share/roundcubemail
Alias /webmail /usr/share/roundcubemail # Define who can access the Webmail # You can enlarge permissions once configured #<Directory /usr/share/roundcubemail/> # <IfModule mod_authz_core.c> # # Apache 2.4 # Require local # </IfModule> # <IfModule !mod_authz_core.c> # # Apache 2.2 # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 # Allow from ::1 # </IfModule> #</Directory> <Directory /usr/share/roundcubemail/> Options none AllowOverride Limit Require all granted </Directory> # Define who can access the installer # keep this secured once configured #<Directory /usr/share/roundcubemail/installer/> # <IfModule mod_authz_core.c> # # Apache 2.4 # Require local # </IfModule> # <IfModule !mod_authz_core.c> # # Apache 2.2 # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 # Allow from ::1 # </IfModule> #</Directory> <Directory /usr/share/roundcubemail/installer> Options none AllowOverride Limit Require all granted </Directory> # Those directories should not be viewed by Web clients. <Directory /usr/share/roundcubemail/bin/> Order Allow,Deny Deny from all </Directory> <Directory /usr/share/roundcubemail/plugins/enigma/home/> Order Allow,Deny Deny from all </Directory>
Restart Apache:
systemctl restart httpd.service
Now we need a database for RoundCube mail, we will initialize it as follows:
mysql -u root -p
At MariaDB prompt use:
CREATE DATABASE roundcubedb;
CREATE USER roundcubeuser@localhost IDENTIFIED BY 'roundcubepassword';
GRANT ALL PRIVILEGES on roundcubedb.* to roundcubeuser@localhost ;
FLUSH PRIVILEGES;
exit
I am using the details for the RoundCube database as an example, please replace the values as per your choice for security reasons.
I am using the details for the RoundCube database as an example, please replace the values as per your choice for security reasons.
Now we will install RoundCube in the browser at http://192.168.1.100/roundcubemail/installer
Now fill the entries for the
nano /etc/roundcubemail/config.inc.php
<?php /* Local configuration for Roundcube Webmail */ // ---------------------------------- // SQL DATABASE // ---------------------------------- // Database connection string (DSN) for read+write operations // Format (compatible with PEAR MDB2): db_provider://user:password@host/database // Currently supported db_providers: mysql, pgsql, sqlite, mssql or sqlsrv // For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php // NOTE: for SQLite use absolute path: 'sqlite:////full/path/to/sqlite.db?mode=0646' $config['db_dsnw'] = 'mysql://roundcubeuser:roundcubepassword@localhost/roundcubedb'; // ---------------------------------- // IMAP // ---------------------------------- // The mail host chosen to perform the log-in. // Leave blank to show a textbox at login, give a list of hosts // to display a pulldown menu or set one host as string. // To use SSL/TLS connection, enter hostname with prefix ssl:// or tls:// // Supported replacement variables: // %n - hostname ($_SERVER['SERVER_NAME']) // %t - hostname without the first part // %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part) // %s - domain name after the '@' from e-mail address provided at login screen // For example %n = mail.domain.tld, %t = domain.tld // WARNING: After hostname change update of mail_host column in users table is // required to match old user data records with the new host. $config['default_host'] = 'localhost'; // provide an URL where a user can get support for this Roundcube installation // PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE! $config['support_url'] = ''; // this key is used to encrypt the users imap password which is stored // in the session record (and the client cookie if remember password is enabled). // please provide a string of exactly 24 chars. $config['des_key'] = 'FHgaM7ihtMkM1cBwckOcxPdT'; // ---------------------------------- // PLUGINS // ---------------------------------- // List of active plugins (in plugins/ directory) $config['plugins'] = array(); // Set the spell checking engine. Possible values: // - 'googie' - the default // - 'pspell' - requires the PHP Pspell module and aspell installed // - 'enchant' - requires the PHP Enchant module // - 'atd' - install your own After the Deadline server or check with the people at http://www.afterthedeadline.com before using their API // Since Google shut down their public spell checking service, you need to // connect to a Nox Spell Server when using 'googie' here. Therefore specify the 'spellcheck_uri' $config['spellcheck_engine'] = 'pspell';
Then press on the button "continue" in the web installer. On the following page, press on the button "Initialize database".
Finally, disable the Roundecubemail installer. Change the apache roundcubemail.conf configuration file:
nano /etc/httpd/conf.d/roundcubemail.conf
# # Round Cube Webmail is a browser-based multilingual IMAP client # Alias /roundcubemail /usr/share/roundcubemail
Alias /webmail /usr/share/roundcubemail # Define who can access the Webmail # You can enlarge permissions once configured #<Directory /usr/share/roundcubemail/> # <IfModule mod_authz_core.c> # # Apache 2.4 # Require local # </IfModule> # <IfModule !mod_authz_core.c> # # Apache 2.2 # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 # Allow from ::1 # </IfModule> #</Directory> <Directory /usr/share/roundcubemail/> Options none AllowOverride Limit Require all granted </Directory> # Define who can access the installer # keep this secured once configured <Directory /usr/share/roundcubemail/installer/> <IfModule mod_authz_core.c> # Apache 2.4 Require local </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from all Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory> # Those directories should not be viewed by Web clients. <Directory /usr/share/roundcubemail/bin/> Order Allow,Deny Deny from all </Directory> <Directory /usr/share/roundcubemail/plugins/enigma/home/> Order Allow,Deny Deny from all </Directory>
Restart Apache:
systemctl restart httpd.service
-------------------------------------------------------
Using The Roundcubemail Password Plugin (Optional)
Let your users change their password using roundcubemail instead of postfixadmin.
Edit /etc/roundcubemail/main.inc.php and find the lines and make the changes below:
find:
change to:
$rcmail_config['plugins'] = array('managesieve');
$rcmail_config['plugins'] = array('managesieve','password');
Now lets configure the password plugin.
> cd /usr/share/roundcubemail/plugins/password/
> cp config.inc.php.dist config.inc.php
Edit config.inc.php
find:
change to:
find:
change to:
$rcmail_config['password_db_dsn'] = '';
$rcmail_config['password_db_dsn'] = 'mysql://postfix:your-postfixadmin-password@localhost/postfix';
$rcmail_config['password_query'] = 'SELECT update_passwd(%c, %u)';
$rcmail_config['password_query'] = 'UPDATE mailbox SET password=%c WHERE username=%u limit 1;';
Restart apache.
> service httpd restart
----------
-----------