Squirrel Mail and RoundCube Webmail on Ubuntu

The webmail portion of the project was started by Nathan and Luke Ehresman in 1999 and is written in PHP. SquirrelMail can be employed in conjunction with a LAMP “stack”, and any other operating systems that support PHP are supported as well. The web server needs access to the IMAP server hosting the email and to an SMTP server to be able to send mails.

 

 Install SquirrelMail

#apt-get install squirrelmail

Then configure SquirrelMail:

#squirrelmail-configure

We must tell SquirrelMail that we are using Dovecot-IMAP/-POP3:

SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Main Menu —
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >> <– D

SquirrelMail Configuration : Read: config.php
———————————————————
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don’t work so
well with others.  If you select your IMAP server, this option will
set some pre-defined settings for that server.

Please note that you will still need to go through and make sure
everything is correct.  This does not change everything.  There are
only a few settings that this will change.

Please select your IMAP server:
bincimap    = Binc IMAP server
courier     = Courier IMAP server
cyrus       = Cyrus IMAP server
dovecot     = Dovecot Secure IMAP server
exchange    = Microsoft Exchange IMAP server
hmailserver = hMailServer
macosx      = Mac OS X Mailserver
mercury32   = Mercury/32
uw          = University of Washington’s IMAP server
gmail       = IMAP access to Google mail (Gmail) accounts

quit        = Do not change anything
Command >> <– dovecot

SquirrelMail Configuration : Read: config.php
———————————————————
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don’t work so
well with others.  If you select your IMAP server, this option will
set some pre-defined settings for that server.

Please note that you will still need to go through and make sure
everything is correct.  This does not change everything.  There are
only a few settings that this will change.

Please select your IMAP server:
bincimap    = Binc IMAP server
courier     = Courier IMAP server
cyrus       = Cyrus IMAP server
dovecot     = Dovecot Secure IMAP server
exchange    = Microsoft Exchange IMAP server
hmailserver = hMailServer
macosx      = Mac OS X Mailserver
mercury32   = Mercury/32
uw          = University of Washington’s IMAP server
gmail       = IMAP access to Google mail (Gmail) accounts

quit        = Do not change anything
Command >> dovecot

imap_server_type = dovecot
default_folder_prefix = <none>
trash_folder = Trash
sent_folder = Sent
draft_folder = Drafts
show_prefix_option = false
default_sub_of_inbox = false
show_contain_subfolders_option = false
optional_delimiter = detect
delete_folder = false

Press any key to continue… <– press a key

SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Main Menu —
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >> <– S

SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Main Menu —
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >> <– Q

Now we will configure SquirrelMail so that you can use it from within your web sites (created through ISPConfig) by using the /squirrelmail or /webmail aliases. So if your website is http://www.example.com, you will be able to access SquirrelMail using http://www.example.com/squirrelmail or http://www.example.com/webmail.

SquirrelMail’s Apache configuration is in the file /etc/squirrelmail/apache.conf, but this file isn’t loaded by Apache because it is not in the /etc/apache2/conf-available/ directory. Therefore we create a symlink called squirrelmail.conf in the /etc/apache2/conf-available/ directory that points to /etc/squirrelmail/apache.conf and reload Apache afterwards:

cd /etc/apache2/conf-available/
ln -s ../../squirrelmail/apache.conf squirrelmail.conf
service apache2 reload

Now open /etc/apache2/conf.d/squirrelmail.conf

 vi /etc/apache2/conf-available/squirrelmail.conf

… and add the following lines to the <Directory /usr/share/squirrelmail></Directory> container that make sure that mod_php is used for accessing SquirrelMail, regardless of what PHP mode you select for your website in ISPConfig:

[...]
<Directory /usr/share/squirrelmail>
  Options FollowSymLinks
  <IfModule mod_php5.c>
    AddType application/x-httpd-php .php
    php_flag magic_quotes_gpc Off
    php_flag track_vars On
    php_admin_flag allow_url_fopen Off
    php_value include_path .
    php_admin_value upload_tmp_dir /var/lib/squirrelmail/tmp
    php_admin_value open_basedir /usr/share/squirrelmail:/etc/squirrelmail:/var/lib/squirrelmail:/etc/hostname:/etc/mailname
    php_flag register_globals off
  </IfModule>
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </IfModule>

  # access to configtest is limited by default to prevent information leak
  <Files configtest.php>
    order deny,allow
    deny from all
    allow from 127.0.0.1
  </Files>
</Directory>
[...]

Create the directory /var/lib/squirrelmail/tmp

#mkdir /var/lib/squirrelmail/tmp

and make it owned by the user www-data:

#chown www-data /var/lib/squirrelmail/tmp

Next we need to enable the squirrelmail with apache2.

#a2enconf squirrelmail

Reload Apache again:

#service apache2 reload

That’s it already – /etc/apache2/conf-available/squirrelmail.conf defines an alias called /squirrelmail that points to SquirrelMail’s installation directory /usr/share/squirrelmail.

You can now access SquirrelMail from your web site as follows:

http://192.168.0.102/squirrelmail
http://www.example.com/squirrelmail

 

http://server1.example.com:8080/squirrelmail

If you’d like to use the alias /webmail instead of /squirrelmail, simply open /etc/apache2/conf-available/squirrelmail.conf

vi /etc/apache2/conf-available/squirrelmail.conf

… and add the line Alias /webmail /usr/share/squirrelmail:

Alias /squirrelmail /usr/share/squirrelmail
Alias /webmail /usr/share/squirrelmail
[...]

Then reload Apache:

#service apache2 reload

Now you can access Squirrelmail as follows:

http:// 192.168.0.102/webmail

 

squirrelmail

 

 

 

 

 

If you’d like to define a vhost like webmail.example.com where your users can access SquirrelMail, you’d have to add the following vhost configuration to /etc/apache2/conf-available/squirrelmail.conf:

vi /etc/apache2/conf-available/squirrelmail.conf

[...]
<VirtualHost 1.2.3.4:80>
  DocumentRoot /usr/share/squirrelmail
  ServerName webmail.example.com
</VirtualHost>

Make sure you replace 1.2.3.4 with the correct IP address of your server. Of course, there must be a DNS record for webmail.example.com that points to the IP address that you use in the vhost configuration. Also make sure that the vhost webmail.example.com does not exist in ISPConfig (otherwise both vhosts will interfere with each other!).

Now reload Apache…

service apache2 reload

… and you can access SquirrelMail under http://webmail.example.com!

 

 

 

 

 =======================================================

Install RoundCube Webmail on Ubuntu

Step 1 :Install Prerequisites

Before get started install RoundCube Webmail, you need to install a web server on Ubuntu (Apache, PHP, MySQL) called LAMP server, open terminal then running following commands:

sudo apt-get install lamp-server^

After installing  LAMP Server on ubuntu/Linux mint, you can now follow these instructions to install Roundcube Webmail on Ubuntu:

Step 2 : Creating A MySQL Database & User

Open the terminal and run this command to log in to MySQL server (use the MySQL password you have entered during the installation of the LAMP Server):

mysql -u root -p

Create a database for Roundcube Webmail.

create database roundcubedb;

Create MySQL user adminstrator of Roundcube Webmail.

create user adminmail;

Now Give user: admim123 a password

set password for 'adminmail' = password('admin123');

set  privileges usercube to access database roundcubedb using this command:

grant all privileges on roundcubedb.* to adminmail@localhost

Now, Exit from MySQL server,by typing command:

FLUSH PRIVILEGES;
exit

Step 3: Installing Roundcube Webmail

In this case Roundcube Webmail will be installed in the directory /var/www/webmail. Download and extract archieve Roundcube Webmail to directory /var/www/webmail

cd /tmp && wget  http://sourceforge.net/projects/roundcubemail/files/roundcubemail/1.0.5/roundcubemail-1.0.5.tar.gz/download
sudo tar -xzvf roundcubemail-1.0.5.tar.gz -C /var/www
sudo mv /var/www/roundcubemail-1.0.5/ /var/www/webmail

change ownership directory /var/www/webmail/ to user and group www-data ( www-data is user and group web server)

sudo chown -R www-data:www-data /var/www/webmail/*
sudo chown -R www-data:www-data /var/www/webmail/

Import database RoundCube to mysql server, login to mysql server then typing these command

mysql -u root -p roundcubedb < /var/www/webmail/SQL/mysql.initial.sql

To start the installation of Roundcube, open chrome or firefox browser, on address bar type :

http://server-ipaddress/webmail/installer/

This is screenshot page installer Roundcube Webmail

1

If all required modules and extensions are installed, press Continue and go to the next step

2

Enter your own configuration you want to use (SMTP & IMAP settings, etc.). If you want to log into your Gmail account with Roundcube Webmail, you can check this page for Gmail SMTP & IMAP settings. Don’t forget to fill your MySQL database details you have already created:

3

After complete configuration , Press Continue to finish the installation.

4

After Installation Roundcube Webmail complete, remove the directory /var/www/webmail/installer:

sudo rm -rf  /var/www/webmail/installer

roundcube

Roundcube Webmail ready to use, Access Roundcube Webmail via browser (http://localhost/webmail/) then sign in using your email (Gmail, Yahoo, etc.)

Screenshow #01

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s