The Perfect Server - Debian Wheezy (Apache2, BIND, Dovecot, ISPConfig 3) - Page 5

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Tue, 2013-05-07 12:52. ::

19 Install SquirrelMail

To install the SquirrelMail webmail client, run

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 www.example.com, you will be able to access SquirrelMail using www.example.com/squirrelmail or 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.d/ directory. Therefore we create a symlink called squirrelmail.conf in the /etc/apache2/conf.d/ directory that points to /etc/squirrelmail/apache.conf and reload Apache afterwards:

cd /etc/apache2/conf.d/
ln -s ../../squirrelmail/apache.conf squirrelmail.conf
/etc/init.d/apache2 reload

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

vi /etc/apache2/conf.d/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

Reload Apache again:

/etc/init.d/apache2 reload

That's it already - /etc/apache2/conf.d/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.100/squirrelmail
http://www.example.com/squirrelmail

You can also access it from the ISPConfig control panel vhost (after you have installed ISPConfig, see the next chapter) as follows (this doesn't need any configuration in ISPConfig):

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

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

vi /etc/apache2/conf.d/squirrelmail.conf

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

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

Then reload Apache:

/etc/init.d/apache2 reload

Now you can access Squirrelmail as follows:

http://192.168.0.100/webmail
http://www.example.com/webmail
http://server1.example.com:8080/webmail
(after you have installed ISPConfig, see the next chapter)

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.d/squirrelmail.conf:

vi /etc/apache2/conf.d/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...

/etc/init.d/apache2 reload

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

 

20 Install ISPConfig 3

To install ISPConfig 3 from the latest released version, do this:

cd /tmp
wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
tar xfz ISPConfig-3-stable.tar.gz
cd ispconfig3_install/install/

The next step is to run

php -q install.php

This will start the ISPConfig 3 installer. The installer will configure all services like Postfix, Dovecot, etc. for you. A manual setup as required for ISPConfig 2 (perfect setup guides) is not necessary.

root@server1:/tmp/ispconfig3_install/install# php -q install.php
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0


--------------------------------------------------------------------------------
 _____ ___________   _____              __ _         ____
|_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
  | |  `--. \  __/  | |    / _ \| '_ \|  _| |/ _` |  |_ |
 _| |_/\__/ / |     | \__/\ (_) | | | | | | | (_| | ___\ \
 \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                              __/ |
                                             |___/
--------------------------------------------------------------------------------


>> Initial configuration

Operating System: Debian or compatible, unknown version.

    Following will be a few questions for primary configuration so be careful.
    Default values are in [brackets] and can be accepted with <ENTER>.
    Tap in "quit" (without the quotes) to stop the installer.


Select language (en,de) [en]:
 <-- ENTER

Installation mode (standard,expert) [standard]: <-- ENTER

Full qualified hostname (FQDN) of the server, eg server1.domain.tld  [server1.example.com]: <-- ENTER

MySQL server hostname [localhost]: <-- ENTER

MySQL root username [root]: <-- ENTER

MySQL root password []: <-- yourrootsqlpassword

MySQL database to create [dbispconfig]: <-- ENTER

MySQL charset [utf8]: <-- ENTER

Generating a 4096 bit RSA private key
.............................................................++
.........................................................................................................................++
writing new private key to 'smtpd.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
 <-- ENTER
State or Province Name (full name) [Some-State]: <-- ENTER
Locality Name (eg, city) []: <-- ENTER
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- ENTER
Organizational Unit Name (eg, section) []: <-- ENTER
Common Name (e.g. server FQDN or YOUR name) []: <-- ENTER
Email Address []: <-- ENTER
Configuring Jailkit
Configuring Dovecot
Configuring Spamassassin
Configuring Amavisd
Configuring Getmail
Configuring Pureftpd
Configuring BIND
Configuring Apache
Configuring Vlogger
Configuring Apps vhost
Configuring Bastille Firewall
Configuring Fail2ban
Installing ISPConfig
ISPConfig Port [8080]:
 <-- ENTER

Do you want a secure (SSL) connection to the ISPConfig web interface (y,n) [y]: <-- ENTER

Generating RSA private key, 4096 bit long modulus
.................................................................................................++
........++
e is 65537 (0x10001)
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
 <-- ENTER
State or Province Name (full name) [Some-State]: <-- ENTER
Locality Name (eg, city) []: <-- ENTER
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- ENTER
Organizational Unit Name (eg, section) []: <-- ENTER
Common Name (e.g. server FQDN or YOUR name) []: <-- ENTER
Email Address []: <-- ENTER

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
 <-- ENTER
An optional company name []: <-- ENTER
writing RSA key
Configuring DBServer
Installing ISPConfig crontab
no crontab for root
no crontab for getmail
Restarting services ...
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld ..
Checking for tables which need an upgrade, are corrupt or were
not closed cleanly..
Stopping Postfix Mail Transport Agent: postfix.
Starting Postfix Mail Transport Agent: postfix.
Stopping amavisd: amavisd-new.
Starting amavisd: amavisd-new.
Stopping ClamAV daemon: clamd.
Starting ClamAV daemon: clamd .
Restarting IMAP/POP3 mail server: dovecot.
[Tue May 07 02:36:22 2013] [warn] NameVirtualHost *:443 has no VirtualHosts
[Tue May 07 02:36:22 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
[Tue May 07 02:36:23 2013] [warn] NameVirtualHost *:443 has no VirtualHosts
[Tue May 07 02:36:23 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
Restarting web server: apache2 ... waiting .
Restarting ftp server: Running: /usr/sbin/pure-ftpd-mysql-virtualchroot -l mysql:/etc/pure-ftpd/db/mysql.conf -l pam -H -O clf:/var/log/pure-ftpd/transfer.log -Y 1 -D -u 1000 -A -E -b -8 UTF-8 -B
Installation completed.
root@server1:/tmp/ispconfig3_install/install#

The installer automatically configures all underlying services, so no manual configuration is needed.

You now also have the possibility to let the installer create an SSL vhost for the ISPConfig control panel, so that ISPConfig can be accessed using https:// instead of http://. To achieve this, just press ENTER when you see this question: Do you want a secure (SSL) connection to the ISPConfig web interface (y,n) [y]:.

Afterwards you can access ISPConfig 3 under http(s)://server1.example.com:8080/ or http(s)://192.168.0.100:8080/ ( http or https depends on what you chose during installation). Log in with the username admin and the password admin (you should change the default password after your first login):

The system is now ready to be used.

 

 

21 Additional Notes

21.1 OpenVZ

If the Debian server that you've just set up in this tutorial is an OpenVZ container (virtual machine), you should do this on the host system (I'm assuming that the ID of the OpenVZ container is 101 - replace it with the correct VPSID on your system):

VPSID=101
for CAP in CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE
do
  vzctl set $VPSID --capability ${CAP}:on --save
done

 

22 Links


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 Mark Ferguson (not registered) on Sun, 2014-11-23 18:55.

I'm not the guy to post comments but here I want to applaud to the instruction. Not only get's it ISPConfig fully installed and working but also the POSTFIX/dovecot crap works like a clockwork.
I got this VPS and tried CentOS first but always got stuck with the Postfix stuff, especially the SMTP and outside world email.
Then I switched to Debian Wheezy and used this installation procedure and all works fine.
Also my CPU usage is very low, the hosted pages rocket fast and the memory usage under 1 GB.
Excellent job and thank you so much - again

 

 

Submitted by Anonymous (not registered) on Sun, 2014-11-09 23:04.
I follow your tutorial and step by step worked but i have VERY HIGH CPU USAGE ... any ideea?
Submitted by Jim (not registered) on Tue, 2014-06-24 21:46.
Hi i configured server in VPS, later on dedicated server (16 GB ram, xeon CPU) - Debian... but if i have any virtualhosts i have big problem... load page speed is realy slow (3s+)... i tested in pingdom and its realy big wait time in first step (load main url)... cpu is idle, ram is free.. any idea? i try deactivate plugin in apache, php.. but no change... sites are o WP (i set W3 total cache - small improvements, but still big time in wait time)... Thanks for idea
 

 

 

Submitted by Michel (not registered) on Sat, 2014-06-14 20:00.
Hello,

I re-installed the debian server but now I have the big problem that I am not able to configurate the mailsettings in ispconfig3.

 When I push the button email, then I get the sidebar of email but I can not do anything with it.

I think that something is changed in debian but I can not figure out what is changed and why I can not setup my mail anymore.

  I followed this manual by the letter and I tried to install the server for 4 times now but still get the same problem.

 I assume that I am not the only person with this problem, Has anybody ideas how to solve this?

 Greetings, Michel

 

 

Submitted by admin (registered user) on Sat, 2014-06-14 20:38.
The guide works fine in latest Debian, I installed it yesterday for a Client and it worked fine. I guess your mistake is that you did not use the alias "webmail" for squirrelmail as described in the guide. If you use "mail" as alias, then the Problem that you describe occurs as your "mail" alias will Redirect requests to the ispconfig mail module to squirrelmail.
Submitted by Michel (not registered) on Mon, 2014-06-16 17:05.

Hello,

 I did use the alias "webmail" for squirrelmail, I also installed this server on a 32 bit machine and there everything works fine, only not on my 64 bit system.

Submitted by vikozo (registered user) on Tue, 2014-04-29 23:06.

Hello
Nice Tutorial, i would apreciate to have Roundcube instand of  SquirrelMail.
have a nice day
vincent

Submitted by Anonymous (not registered) on Wed, 2014-03-26 16:43.

Many thanks for this walk through, i am a total noob when it comes to this and this made it simple and easy to do, Im now all set up and going :)

 

Keep up the great work

Submitted by Ayhan DELÄ° (not registered) on Mon, 2014-03-17 02:40.
thank you very much
Submitted by German (not registered) on Mon, 2013-11-18 18:56.
hello first congratulate you for this wonderful guide. I followed all your steps one by one and at the end I sent an email to a gmail account of mine but I do not get. any advice? thanks
Submitted by Sevage (not registered) on Tue, 2013-10-15 08:01.

Hallo,

 auch ich habe wieder mal dieses geniale Tut durchgearbeitet (gleich auf 2 Servern) und musste heute feststellen, dass ich im Squirrelmail keine Anhänge an Mails anhängen kann. Auf beiden Servern nicht!

Kann jemand diesen Fehler bestätigen?

Submitted by tomnhanni (registered user) on Wed, 2013-11-27 09:44.

Ja, bei mir auch

Solution:

http://www.howtoforge.com/forums/showpost.php?p=267993&postcount=2

Submitted by Gaurav Saluja (not registered) on Fri, 2013-10-11 04:43.

hello i have recently installed ispconfig using this tutorial 

 it was working fine and it is showing 350MB ram consuming 


 then i rebooted the vps , and poof all processess gone and the memory is now 6 MB only

 no process is loading now, so i just want to know the list of services to start as i am new to debian and ispconfig, also how to make sure that each service will start at reboot , will chkconfig httpd on  , similar command will work?

 please mail me at gaurav@saluja.asia

Submitted by Anonymous (not registered) on Mon, 2013-10-07 23:05.

Hallo,

 Hab soweit alles richtig und nach der Anleitung gemacht.

 Jedoch kann ich alles nur unter der Lokalein ip erreichen. Also 192.168.0.100

Wozu macht man das dann mit der example.com Domain? Oder muss die Domain tatsächlich vorhanden sein?

 Danke im Voraus 

 

Submitted by Kenny (not registered) on Sun, 2013-09-22 20:36.
Everything set up nicely on a Debian Wheezy server running on Amazon EC2 with no significant issues.  Thanks for the helpful tutorial.
Submitted by Grefu (not registered) on Thu, 2013-09-12 12:17.
All ok without errors, but panel still doesn't run. I get "connection interrupt while loading". If I navigate on http://x.x.x.x:8080 it loads squirrelmail webpage http://x.x.x.x:8080/src/login.php. If I navigate on https get that error message.
Submitted by Tomek (not registered) on Tue, 2013-07-16 09:25.
Thank you for all of yours tutorials. I'm comming here many times, thank you for your great job :-)
Submitted by Anonymous (not registered) on Sun, 2013-07-07 10:55.
i was able to install everything without a single issue. Thank you,sir!
Submitted by Pavel (not registered) on Thu, 2013-05-23 22:47.
If You have problem with https protocol:
107 (net::ERR_SSL_PROTOCOL_ERROR) or ssl_error_rx_record_too_long
just need to ensite default-ssl vhost in apache2:
a2ensite default-ssl
 
good luck
Submitted by IntnsRed (registered user) on Thu, 2014-08-28 21:57.
Good catch Pavel! This is a great feature which should be done above in the main docs just to allow SquirrelMail to be done with https.
Submitted by Jérémy (not registered) on Tue, 2013-05-21 21:54.
I could successfully install ISP Config, Dovecot and Postfix, but there is one issue with incoming mails... I can't get mails from outside (Gmail, Hotmail, etc.). Could anyone help me to go through?
Submitted by Pavel (not registered) on Thu, 2013-05-23 22:52.

Check Your /etc/postfix/main.cf file for option mydestination. It shouldn't have Your hostname. It should looks like:
...
mydestination = localhost, localhost.localdomain
...

Hope it helps,
Pavel

Submitted by inattendu (not registered) on Tue, 2013-05-21 01:23.
Merci pour ce tutoriel très complet qui m'a permi de réeussir mon installation du premier coup, ce site est génial !

howtoforge... une référence !

inattendu.
Submitted by mariaczi (not registered) on Wed, 2013-05-08 13:35.

Actually, in Debian Wheezy squirrelmail have problem with regional characters (function htmlspecialchars from php v5.4)

Submitted by William Van Hefner (not registered) on Thu, 2013-06-13 12:55.

You might want to try installing some of the optional Squirrelmail plugins. They should be installable directly from the debian wheezy repository. In particular, try:

 apt-get install squirrelmail-compatibility squirrelmail-decode

Some plugins require that you activate them by running squirrelmail-config and choosing option #8. There are also some additional plugins and templates available on the Squirrelmail official website, if those don't help. If you want to get really fancy, there are also some vendors selling enhanced Squirrelmail templates and interfaces as well. They might offer commercial support for more specific problems.

 

 

Submitted by Jan (not registered) on Tue, 2013-07-16 16:25.

just tiny little typo:

squirrelmail-configure
Submitted by Makoa (not registered) on Wed, 2013-10-30 08:44.

Hello everybody.

Thinks for the tutorial.

I have some problems with squirrelmail, I have this message when i connect on it: "ERROR Unknown user or password incorrect".

Please helps me.