Multiserver Setup With Dedicated Web, Email, DNS & MySQL Database Servers On Debian Squeeze With ISPConfig 3 - Page 6

3 Installing The Mail Server

Edit the hosts file and add the IP addresses and hostnames for all servers. The hostnames and IP addresses have to be adjusted to match your setup.

vi /etc/hosts

127.0.0.1       localhost
192.168.0.105   web.example.tld
192.168.0.106   mail.example.tld
192.168.0.107   db.example.tld
192.168.0.108   ns1.example.tld
192.168.0.109   ns2.example.tld
 
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Set the hostname of the server:

echo mail.example.tld > /etc/hostname
echo mail.example.tld > /etc/mailname
/etc/init.d/hostname.sh start

Run...

apt-get update

... to update the apt package database; then run...

apt-get upgrade

... to install the latest updates (if there are any).

It is a good idea to synchronize the system clock with an NTP (network time protocol) server over the Internet. Simply run...

apt-get -y install ntp ntpdate

... and your system time will always be in sync.

Install postfix, dovecot and MySQL with one single command:

apt-get -y install postfix postfix-mysql postfix-doc mysql-client mysql-server openssl getmail4 rkhunter binutils dovecot-imapd dovecot-pop3d

Enter the new password for mysql when requested by the installer and answer the next questions as decsribed below:

General type of configuration? <-- Internet site
Mail name?
<-- mail.mydomain.tld

To install amavisd-new, SpamAssassin, and ClamAV, we run:

apt-get -y install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl

If you want to use mailinglists on your server, then install mailman. This step is optional. mailman requires a apache webserver, so if you dont want to run a apache instance on your mailserver, then dont install mailman.

apt-get -y install mailman

The apt installer for mailman will ask you then to select the languages for the mailing list. Enable all languages that you want to use for mailman. Next create the "mailman" mailinglist.

newlist mailman

and enter the email address and new password for the mailinglist administrator. Thats the last step of the mailman install. The next command to install php has to be executed on every server, independently if you installed mailman or not.

Then install install the commandline version of PHP to be able to run PHP-based shell scripts for ISPConfig:

apt-get -y install php5-cli php5-mysql php5-mcrypt mcrypt

Install fail2ban: This is optional but recommended, because the ISPConfig monitor tries to show the log:

apt-get install fail2ban

To make fail2ban monitor PureFTPd and Dovecot, create the file /etc/fail2ban/jail.local:

vi /etc/fail2ban/jail.local

[dovecot-pop3imap]

enabled = true
filter = dovecot-pop3imap
action = iptables-multiport[name=dovecot-pop3imap, port="pop3,pop3s,imap,imaps", protocol=tcp]
logpath = /var/log/mail.log
maxretry = 5

Then create the following filter file:

vi /etc/fail2ban/filter.d/dovecot-pop3imap.conf

[Definition]
failregex = (?: pop3-login|imap-login): .*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed|Aborted login \(\d+ authentication attempts).*rip=(?P<host>\S*),.*
ignoreregex =

Restart fail2ban afterwards:

/etc/init.d/fail2ban restart

Now I will install ISPConfig 3 on this server. To get the download URL of the latest ISPConfig 3 stable release, please visit the ISPConfig website: http://www.ispconfig.org/ispconfig-3/download/

Download the latest ISPConfig 3 stable release:

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

Then start the install script:

php -q install.php

Select language (en,de) [en]: <-- en
Installation mode (standard,expert) [standard]: <-- expert
Full qualified hostname (FQDN) of the server, eg server1.domain.tld [mail.example.tld]: <-- mail.example.tld
MySQL server hostname [localhost]: <-- localhost
MySQL root username [root]: <-- root
MySQL root password []: <-- Enter your MySQL root password here
MySQL database to create [dbispconfig]: <-- dbispconfig
MySQL charset [utf8]: <-- utf8
Shall this server join an existing ISPConfig multiserver setup (y,n) [n]: <-- y
MySQL master server hostname []: <-- web.example.tld
MySQL master server root username [root]: <-- root
MySQL master server root password []: <-- Enter the root password of the master server here
MySQL master server database name [dbispconfig]: <-- dbispconfig
Configure Mail (y,n) [y]: <-- y

Country Name (2 letter code) [AU]: <-- DE (Enter the ISO country code where you live here)
State or Province Name (full name) [Some-State]: <-- Niedersachsen (Enter the state where you live here)
Locality Name (eg, city) []: <-- Lueneburg (Enter the city here)
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- ENTER
Organizational Unit Name (eg, section) []: <-- ENTER
Common Name (eg, YOUR name) []: <-- ENTER
Email Address []: <-- ENTER

Configure Jailkit (y,n) [y]: <-- n
Configure FTP Server (y,n) [y]: <-- n
Configure DNS Server (y,n) [y]: <-- n
Configure Apache Server (y,n) [y]: <-- n
Configure Firewall Server (y,n) [y]: <--y
Install ISPConfig Web-Interface (y,n) [y]: <--n

Run...

rm -f /var/www/ispconfig

... to remove the ISPConfig interface link in the /var/www directory.

Clean up the install directories:

rm -rf /tmp/ispconfig3_install/install
rm -f /tmp/ISPConfig-3-stable.tar.gz

Share this page:

12 Comment(s)

Add comment

Comments

From: at: 2012-04-17 16:02:46

I've edited the sources.list but getting so many 'no candidate version found' and 'Couldn't find any package whose name or description matched'

I've been copying and pasting so spelling is definately correct.

 root@mail:~# apt-get -y install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libopenssl-ruby libapache2-mod-ruby sudo zip wget

Reading package lists... Done

Building dependency tree

Reading state information... Done

Note, selecting 'libruby' instead of 'libopenssl-ruby'

Package mcrypt is not available, but is referred to by another package.

This may mean that the package is missing, has been obsoleted, or

is only available from another source


Package libapache2-mod-ruby is not available, but is referred to by another package.

This may mean that the package is missing, has been obsoleted, or

is only available from another source


E: Unable to locate package php-auth

E: Package 'mcrypt' has no installation candidate

E: Unable to locate package libapache2-mod-suphp

E: Package 'libapache2-mod-ruby' has no installation candidate


 

From: at: 2012-04-17 18:15:33

I've edited the sources.list but getting so many 'no candidate version found' and 'Couldn't find any package whose name or description matched'

I've been copying and pasting so spelling is definately correct.

 

 

From: at: 2014-03-13 14:48:25

Hello

 thank you for these excellent howto!

think you will do a refresh for debian wheezy? 

 

thank you!

From: Anonymous at: 2014-05-17 01:08:16

Any update on this question?

 Squeeze is about dead.....

From: at: 2014-11-05 18:21:45

Does this setup work behind a nat firewall?

From: admin at: 2014-11-06 07:24:54

Yes, this works behind a NAT Firewall as well.

From: at: 2013-01-26 19:48:01

Hello Till,

 I found this to be a very good how to guide for setting up a multi-server environment.  Most everything went well with the setup, but now I'm to the end and I am having difficulty in setting up DNS records for the servers.

 Website setups are not problem it's with the master servers.  Say my server names are web.myserver.com (1.2.3.4), mail.myserver.com (1.2.3.5), db.myserver.com (1.2.3.6), and I also created a git.myserver.com (1.2.3.7).

 Instead of accessing my web server like https://1.2.3.4:8080, I want to access it this way https://web.myserver.com:8080.

 For the mail server, I would like to know how my users could access their webmail by https://mail.myserver.com.

 I suppose that my system could access my database server via db.myserver.com.  How should I setup the DNS records to make this happen?

Last, I would like to be able to access my git server via SSH like git.myserver.com.  How would I setup this DNS record?

I have spent a significant amount of time reading many of the howto guides, and none that I have found make this clear...  I purchased and read the ISPConfig3 guide, and I'm still not clear on how to make this happen.

If you could please help answer these questions, I would appreciate it!

Regards,

 Darin

From: Anonymous at: 2013-02-06 16:00:28


create a Cname: web.myserverz.com

then a subdomain in ISPconfig.

to :

web 

https://web.myserver.com:8080.

R flag 

same for mail..

 but remember to add the alias in the mail config.

From: Bart Dorlandt at: 2013-05-24 18:16:40

Hi Till,

 i was just installing this on a new server. 

It seems that dovecot-mysql is missing fram the package list on page 2. This is needed if you want to use dovecot to communicate with mysql. 

 Else these errors appear:

 dovecot: auth: Fatal: Unknown database driver 'mysql'

 

 Thanks. Cheers.

From: Mobarak at: 2014-01-10 10:40:41

Hi, I install web ,mail , Database and Ns1 , Ns2 . I Install Squirrelmail in the web server . And I add a domain but I can't receive any email . To sending a email getting error 

Server replied: 554 5.7.1 <mobarak@xyz.com>: Relay access denied . I modified in the mail host server postfix main.cf fiiles . 

#mydomain = domain.tld
mydomain = xyz.com

#inet_interfaces = all
inet_interfaces = all

mynetworks_style = host

#relayhost = $mydomain
relayhost = $xyz.com

Still getting the same error . Please let me know what shoud I do ?

Thanks
Mobarak

From: Lindeni at: 2014-11-21 11:23:03

Hello. I have followed this tutorial, but with three servers. I was trying to consolidate some services. I have the web.example.com - master as in tutorial, dbns1.example.com - database and NS1 host, and emailns2.example.com - email server and NS2. I tried to follow the tutorial as is also on the ISPConfig Manual, when it comes to the dbns1 and emailns2, its just that I have chosen to also configure DNS when running the ISPConfig installer.

Under system>server services I have the following selectios

web.example.com : web server, file server

dbns1.example.com : db server,  dns server

emailns2.example.com : mail server, dns server

Now everything seems to be running well, but maybe I am undermining the problem, when I create a new client, new website, add a email domain everything seems to be Ok, but when I add an actual Email Mailbox, the dropdown to choose a server is empty, and won't allow me to type anything, and if I proceed and save the mailbox, it allows me to.

 And then when I click on the Icon to go to the webmail, I get a page with the error below:

No E-Mail - Server found!

 What does this imply, what went wrong, why does it say no email server found?

Thank you for the great tutorial 

From: alan johnston at: 2015-01-03 10:16:48

the pages seem to be screwed up a little, it goes from page 1 wich is parts 1 & 2 then page 2 which is part 7 which is the ned configs