The Perfect Server - CentOS 5.5 x86_64 [ISPConfig 3] - Page 4

10 Install Dovecot

There's a Dovecot package in the CentOS repository, but unfortunately it doesn't support MySQL. Therefore we must remove the existing Dovecot and install another Dovecot package (from ATrpms) which comes with MySQL support.

yum remove dovecot

Create a new file /etc/yum.repos.d/atrpms.repo...

vi /etc/yum.repos.d/atrpms.repo

... and insert the following lines into the the file:

[atrpms]
name=Red Hat Enterprise Linux 5 - x86_64 - ATrpms
baseurl=http://dl.atrpms.net/el5-x86_64/atrpms/stable
failovermethod=priority
exclude=dovecot-2*
includepkgs=dovecot dovecot-sieve

#
# requires stable
#
[atrpms-testing]
name=Red Hat Enterprise Linux 5 - x86_64 - ATrpms testing
baseurl=http://dl.atrpms.net/el5-x86_64/atrpms/testing
failovermethod=priority
enabled=1
exclude=dovecot-2*
includepkgs=dovecot dovecot-sieve

#
# requires stable and testing
#
[atrpms-bleeding]
name=Red Hat Enterprise Linux 5 - x86_64 - ATrpms bleeding
baseurl=http://dl.atrpms.net/el5-x86_64/atrpms/bleeding
failovermethod=priority
enabled=0

Then import tge gpg key of the atrpm repository...

wget http://ATrpms.net/RPM-GPG-KEY.atrpms
rpm --import RPM-GPG-KEY.atrpms

...and install Dovecot:

yum install dovecot dovecot-sieve

rm -fr /usr/lib/dovecot/
ln -s /usr/lib64/dovecot/ /usr/lib/dovecot

Now we create the system startup links for Dovecot:

chkconfig --levels 235 dovecot on
/etc/init.d/dovecot start

 

11 Install Postfix With MySQL Support

The "normal" Postfix package from the CentOS repository doesn't have MySQL, but the Postfix package from the CentOS Plus repository does. Therefore we remove Postfix...

yum remove postfix

... and install it again, this time from the CentOS Plus repository:

yum install postfix   

Then turn off Sendmail and start Postfix and MySQL:

chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start

chkconfig --levels 235 sendmail off
chkconfig --levels 235 postfix on
/etc/init.d/sendmail stop
/etc/init.d/postfix start

 

12 Install Getmail

Getmail can be installed as follows:

yum install getmail

 

13 Set MySQL Passwords And Configure phpMyAdmin

Set passwords for the MySQL root account:

mysql_secure_installation

[[email protected] tmp]# mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]
 <-- ENTER
New password: <-- yourrootsqlpassword
Re-enter new password: <-- yourrootsqlpassword
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 <-- ENTER
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 <-- ENTER
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 <-- ENTER
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 <-- ENTER
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


[[email protected] tmp]#

Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <Directory "/usr/share/phpmyadmin"> stanza):

vi /etc/httpd/conf.d/phpmyadmin.conf
#
#  Web application to manage MySQL
#
#<Directory "/usr/share/phpmyadmin">
#  Order Deny,Allow
#  Deny from all
#  Allow from 127.0.0.1
#</Directory>
Alias /phpmyadmin /usr/share/phpmyadmin
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /mysqladmin /usr/share/phpmyadmin

Next we change the authentication in phpMyAdmin from cookie to http:

vi /usr/share/phpmyadmin/config.inc.php
[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]

Then we create the system startup links for Apache and start it:

chkconfig --levels 235 httpd on
/etc/init.d/httpd start

Now you can direct your browser to http://server1.example.com/phpmyadmin/ or http://192.168.0.100/phpmyadmin/ and log in with the user name root and your new root MySQL password.

 

14 Install Amavisd-new, SpamAssassin And ClamAV

To install amavisd-new, spamassassin and clamav, run the following command:

yum install amavisd-new spamassassin clamav clamd unzip bzip2 unrar perl-DBD-mysql

Open /etc/sysconfig/amavisd...

vi /etc/sysconfig/amavisd

... and add the line CONFIG_FILE="/etc/amavisd/amavisd.conf":

### Uncomment this if you want to use amavis with sendmail milter interface.
### See README.milter for details.
#
#MILTER_SOCKET="local:/var/amavis/amavis-milter.sock"
#MILTER_SOCKET="[email protected]"
### These are other defaults.
#AMAVIS_ACCOUNT="amavis"
#CONFIG_FILE="/etc/amavisd.conf"
#MILTER_FLAGS=""
CONFIG_FILE="/etc/amavisd/amavisd.conf"

Then we start freshclam, amavisd, and clamd...

sa-update
chkconfig --levels 235 amavisd on
chkconfig --levels 235 clamd on
/usr/bin/freshclam
/etc/init.d/amavisd start
/etc/init.d/clamd start

(it is ok if you see this error: Starting Mail Virus Scanner (amavisd): Config file "/etc/amavisd/amavisd.conf" does not exist, at /usr/sbin/amavisd line 1795. - the missing configuration file /etc/amavisd/amavisd.conf will be created by the ISPConfig installer.)

... and create some necessary directories:

mkdir /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db
chown amavis /var/run/amavisd /var/spool/amavisd /var/spool/amavisd/tmp /var/spool/amavisd/db
ln -s /var/run/clamav/clamd.sock /var/spool/amavisd/clamd.sock

Share this page:

26 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Anonymous

Why is it that there is no some more up-to-date postfix with mysql form centos?

I know that centos provide what red hat does, but is it that hard to compile postfix with mysql on centos? I do not know how to do this, but I would use this system for sure if postfix would be updated to newer one.

IMO dovecot and sieve are great change for better in ISPconfig. With amavis, SA and clam, latest postfix would round up an excelent email server part of it.

By: Tim

That's exactly what I was looking to do. I built Postfix v2.6.5 and Dovecot  v1.2 all from source with the sieve plugin also from source. The key is to build Postfix with mysql support. Download the source for Postfix, extract the package and run this from the source directory for Postfix:

Note:

Be sure you have installed the dev package for mysql ( mysql-devel )  and added a postfix and postdrop user and group ( read the INSTALL file in the source dir )

 make makefiles CCARGS='-DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DUSE_TLS -DHAS_MYSQL -I/usr/include/mysql' \
 AUXLIBS="-lssl -lcrypto  -L/usr/lib/mysql -lmysqlclient -lz -lm -lsasl2"

make install

then follow the rest of the ispconfig 3 How-To

By:

Dovecot version in step 10 is out of date.  I had to use the following while doing the install today.

rpm -ivh http://dl.atrpms.net/all/dovecot-1.2.12-1_109.el5.x86_64.rpm
rpm -ivh http://dl.atrpms.net/all/dovecot-sieve-0.1.17-5.el5.x86_64.rpm

 I hope this does not affect later parts of this setup.

By:

Again out? Anyone has updated links?

By: Ken

Instructing readers to download and install RPM files manually from a repo such as ATRPMS.net or even RPMFORGE is irresponsible.  Instead, teach them the correct way to use a repo.  Download the release/repo RPM then use "yum".  In the case of ATRPMS and CentOS5, download atrpms-repo from http://atrpms.net/dist/el5/.  Edit

/etc/yum.repos.d/atrpms.repo

and add the line (in this instance) to limit ATRPMS packages only to dovecot.  Otherwise you may make your system unstable.

includepkgs=dovecot dovecot-sieve

Then run "yum install dovecot dovecot-sieve" and you're done.

This also eliminates the need to manually download newer versions of dovecot.  Just run "yum update" and they get updated with the rest of the RHEL/CentOS packages.

By: Anonymous

Thank you for that info.

By: Adam

Don't use this method! You will end up with dovecot 2.0 which doesn't work with ISPConfig.

By: Anonymous

you will NOT!!

as far as you add in addition:

exclude=dovecot-2*

btw. I used the testrepo not the default one

 

cheers

By: Mike

For those who are copy/pasting, install using

yum install dovecot dovecot-sieve

by using the following in your /etc/yum.repos.d/atrpms.repo.  As of the date of this comment, dovecot is not listed in stable, it is listed in testing.

[atrpms]
name=Red Hat Enterprise Linux 5 - x86_64 - ATrpms
baseurl=http://dl.atrpms.net/el5-x86_64/atrpms/stable
failovermethod=priority
exclude=dovecot-2*
includepkgs=dovecot dovecot-sieve

#
# requires stable
#
[atrpms-testing]
name=Red Hat Enterprise Linux 5 - x86_64 - ATrpms testing
baseurl=http://dl.atrpms.net/el5-x86_64/atrpms/testing
failovermethod=priority
enabled=1
exclude=dovecot-2*
includepkgs=dovecot dovecot-sieve

#
# requires stable and testing
#
[atrpms-bleeding]
name=Red Hat Enterprise Linux 5 - x86_64 - ATrpms bleeding
baseurl=http://dl.atrpms.net/el5-x86_64/atrpms/bleeding
failovermethod=priority
enabled=0

By: Ash

The following worked for me...

 

[atrpms]
name=Red Hat Enterprise Linux 5 - i386 - ATrpms
baseurl=http://dl.atrpms.net/el5-i386/atrpms/stable
failovermethod=priority
exclude=dovecot-2*
includepkgs=dovecot dovecot-sieve

#
# requires stable
#
[atrpms-testing]
name=Red Hat Enterprise Linux 5 - i386 - ATrpms testing
baseurl=http://dl.atrpms.net/el5-i386/atrpms/testing
failovermethod=priority
enabled=1
exclude=dovecot-2*
includepkgs=dovecot dovecot-sieve

#
# requires stable and testing
#
[atrpms-bleeding]
name=Red Hat Enterprise Linux 5 - i386 - ATrpms bleeding
"/etc/yum.repos.d/atrpms.repo" 26L, 620C

By: bkraul

This method installs dovecot 1.0. Then dovecot-sieve failse because it has dovecot 1.2 as a dependency. Am I missing something here?

By: Pizzahut

This Link For i386 version

 http://dl.atrpms.net/el5Client-i386/atrpms/testing/dovecot-1.2.14-1_112.el5.i386.rpm
http://dl.atrpms.net/el5Client-i386/atrpms/testing/dovecot-sieve-0.1.17-5.el5.i386.rpm

By:

okay, for step 10, these are updated links:

http://dl.atrpms.net/el5-x86_64/atrpms/testing/dovecot-1.2.13-1_111.el5.x86_64.rpm

http://dl.atrpms.net/el5-x86_64/atrpms/testing/dovecot-sieve-0.1.17-5.el5.x86_64.rpm

By: Pooh

In  /usr/lib/perl5/vendor_perl/5.8.8/Archive/Tar.pm
change
$VERSION                = "1.39_01";
to
$VERSION                = 1.39_01;

By: Anonymous

Step 14

sa-update results in this:

Argument "1.39_01" isn't numeric in subroutine entry at /usr/bin/sa-update line 83

so SpamAssassin is not able to update?

Any fixes?

By:

If dovecot fails to start saying " Fatal: listen(::, 143) failed: Address already in use" then add "listen=*" to your /etc/dovecot.conf file. It's trying to listen for ipv6 addresses which are not enabled by default (on our standard images anyway).

By: MS

Updated links:

rpm -ivh http://dl.atrpms.net/el5-i386/atrpms/testing/dovecot-1.2.15-1_113.el5.i386.rpm
rpm -ivh http://dl.atrpms.net/el5-i386/atrpms/testing/dovecot-sieve-0.1.18-6.el5.i386.rpm

By: Anonymous

While according to PMA themselves (http://wiki.phpmyadmin.net/pma/Auth_types) using cookie vs. http authentication results in about the same security, I prefer using cookie as the login is much nicer.

To enable, generate a blowfish secret (using something like http://www.geektimedesign.com/geek-stuff/tools-blowfish-generator.cfm is helpful) and paste it into the line  $cfg['blowfish_secret'] = '' in /usr/share/phpmyadmin/config.inc.php.

Additionally, while it is mostly "security by obscurity" (and some pretty bad obscurity at that), I prefer to change the default /phpmyadmin alias to /pma, which can be done by changing the appropriate "alias" line in /etc/httpd/conf.d/phpmyadmin.conf. I also deleted the other two aliases (/phpMyAdmin and /mysqladmin).

By: Joseph Mouhanna

Note that clamd is obsoleted by clamav, so replace instances of clamd with clamav.

By: Joseph Mouhanna

In addition to these instructions, you need to install the GPG public key, prior to running yum, else it will fail with a message about the missing key:

wget http://ATrpms.net/RPM-GPG-KEY.atrpms
rpm --import RPM-GPG-KEY.atrpms

By: Anonymous

On my installation I had to correct as follow:

ln -s /var/run/clamav/clamd.sock /var/spool/amavisd/clamd.sock

 to:

ln -s /var/run/clamav/clamd.sock /var/spool/amavisd/clamd.socket

By: rzlines

Hi,

The links on step 10 don't work and this is the latest update that I found working so use the following:

rpm -ivh http://wolfcastle.wu-wien.ac.at/dist/rhel5-x86_64/RPMS.at-testing/dovecot-1.2.14-1_112.el5.x86_64.rpm

rpm -ivh http://wolfcastle.wu-wien.ac.at/dist/rhel5-x86_64/RPMS.at-testing/dovecot-sieve-0.1.17-5.el5.x86_64.rpm

 

 

By: Anonymous

New dovecot links for i386 structure:

 

http://wolfcastle.wu-wien.ac.at/dist/rhel5-i386/RPMS.at-testing/dovecot-1.2.15-1_113.el5.i386.rpm

http://wolfcastle.wu-wien.ac.at/dist/rhel5-i386/RPMS.at-testing/dovecot-sieve-0.1.17-5.el5.i386.rpm

By: CEE

If sendmail is not already in use then you do not need to use the stop command. You can also save the trouble of setting permissions and changing settings for sendmail by simply deleting it with the following command which will remove the application and all dependancies

rpm –e --nodeps sendmail

By: csf

After completing tutorial several times with i386 and _64 OS on several servers to be sure. Dovecot and dovecot-sieve installs, starts but does not Send  Receive email. I have tried both dovecot 1x and 2x packages.

Everything looks fine in ISPConfig monitor. ALL services running.

Also, ISPConfig by default sends an email to client when client creates account. On my systems client doesnt receive email from ISPConfig.My clients are able to log into squirrelmail, but not send/receive emails.

By: Anonymous

For Centos the installer seems to have been updated to put the amavisd.conf file in /etc/amavisd.conf (and not /etc/amavisd/amavisd.conf which I think is the debian place for it). This means that you don't need to change /etc/sysconfig/amavisd (the default conf location is /etc/amavisd.conf)

 I hope that save someone else some time and confusion.