Postfix with mysql support in yellowdog 4.0

Howard Shere hshere at greendragon.com
Wed May 18 14:57:40 MDT 2005


On May 18, 2005, at 3:47 PM, C.J. Harris wrote:

> Hello, All I'm new to yellow dog, And my company needs
> a isp class mail server, so I installed yellow dog 4.0
> on one of our Apple G5 64bit servers. The problem is
> that I need to host virtual email accounts preferably
> using postfix, courier-imap/pop, and mysql to store
> the information so it can easily be changed. But the
> problems I seems like the postfix rpm does not have
> the mysql support built into it. So I'm stuck. I can
> compile postfix from the source but in order to
> compile in the mysql support it needs the location of
> mysql headers and  the mysql client library, but since
> mysql on yellowdog 4.0 is only available from the rpms
> i don't think it has the needed header files and
> libraries. Is there a postfix rpm some where that i
> can use that has mysql support?  Does any one have any
> suggestions?
>

Yeah. i got this to work using these instuctions:

http://www.faqs.org/docs/Linux-HOWTO/Postfix-Cyrus-Web-cyradm-HOWTO.html

with some work. I had to remcompile several things (includning PHP) to 
make it all work, but I did finally get it to work. here are some notes 
I made along the way:


This document contains notes about getting the linux mail server for 
mutantegg.com and greendragon.com to work.

I tried several howto docs I found online and finally settled on this 
one:

http://www.faqs.org/docs/Linux-HOWTO/Postfix-Cyrus-Web-cyradm-HOWTO.html

This gets postfix (for SMTP), cyrus (for IMAP and POP3), sasl and pam 
(for authentication), mysql for the authentication database and 
web-cyradm for web based admin of the mail accounts.

We also end up with a system which does not require unix accounts on 
the server for each mail account.

While the instructions on the above page are good, they did not work 
exactly as listed and I am going to try to comment on the things that 
were different for me using yellow dog linux. The numbers (like 3.1.2) 
are the sections in the above web page.

I still have not updated the kernel on this machine. Doing so probably 
would not change any of the comments here.

As I went through things I made sure to open ports in the firewall.

3.1.2

I ended up using mysql-4.1.10a instead of the version listed. This was 
because I started with a different set of instructions which used the 
newew mysql and I didn’t want to try backing the new version of mysql 
out and installing the old one. I used yum to remove the older version 
before I compiled this and installed it. Because mysql was previously 
on the system I didn’t have to create the mysql user. It already 
existed.

To get the init.d stuff to work I am pretty sure (not positive) that I 
had to use the scripts that came with the mysql-4.1.10a package instead 
of the ones that were already there.

3.2.1

This is really db4 and not bdb. I got it with yum instead of building 
it.

3.3.1

I also got this from yum.

3.4.1

I got both cyrus-imap and cyrus-sasl from yum.

3.5.1

I compiled postfix. I had to alter the paths passed in to point at the 
place where mysql was as well as use db4 instead of bdb. Later, after I 
had the mail server working, I wanted to use PCRE in one of the postfix 
configuration files so I went back and rebuilt postfix with PCRE 
support. This command builds postfix with PCRE support:

make makefiles 'CCARGS=-DHAS_MYSQL -DHAS_PCRE \
-I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH \
-I/usr/include/sasl -I/usr/include/pcre -I/usr/include/db4' \
'AUXLIBS=-L/usr/local/mysql/lib/mysql \
-lmysqlclient -lz -lm -lpcre -L/usr/local/lib -lsasl2'

And this one is before I turned on PCRE support:

make makefiles 'CCARGS=-DHAS_MYSQL \
-I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH \
-I/usr/include/sasl -I/usr/include/db4' \
'AUXLIBS=-L/usr/local/mysql/lib/mysql \
-lmysqlclient -lz -lm -L/usr/local/lib -lsasl2'

I just pressed return for all the questions that “make install” asks to 
install postfix.

3.7.2

The paths in the command to build pam needs to point to the mysql 
install location.

3.8.2

When I installed the web-cyradm it didn’t work. It turned out that php 
was not compiled with mysql support enabled. Also, it used some modules 
which were not installed (like pear) so I had to use yum to get most of 
the things and then compile php myself with the following configure 
command:

  './configure' '--host=powerpc-yellowdog-linux-gnu' 
'--build=powerpc-yellowdog-linux-gnu' 
'--target=ppc-yellowdog-linux-gnu' '--program-prefix=' '--prefix=/usr' 
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' 
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' 
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' 
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man' 
'--infodir=/usr/share/info' '--cache-file=../config.cache' 
'--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' 
'--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' 
'--disable-rpath' '--enable-inline-optimization' '--with-bz2' 
'--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' 
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' 
'--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' 
'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' 
'--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' 
'--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' 
'--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' 
'--with-pcre-regex' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' 
'--enable-exif' '--enable-ftp' '--enable-magic-quotes' 
'--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' 
'--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' 
'--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' 
'--with-imap=shared' '--with-imap-ssl' '--with-kerberos' 
'--with-ldap=shared' '--with-mysql=/usr/local/mysql' 
'--with-snmp=shared,/usr'  '--enable-ucd-snmp-hack'  
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop' 
'--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' 
'--enable-mbstring=shared' '--enable-mbstr-enc-trans' 
'--enable-mbregex' '--with-apxs2=/usr/sbin/apxs'

For the apxs stuff to work I had to make sure I had the httpd-devel 
stuff installed using yum.

-----

Other comments:

I also got an IMAP module for webmin for adding users, but I am pretty 
sure it won’t work with the cyrus/sasl/virtual domain setup so it isn’t 
really needed.

php can now talk to mysql - the different was removing "shared" from 
the --with-mysql option for the ./configure when rebuilding php

I did manage to get apache to use the new php. I had to install the 
-devel package with the apxs tool in it. Then I could build the shared 
lib for apache.

OK, the final issue was that the data in /etc/pam.d/imap (and the pop, 
smtp and sieve files there):

It needed to have this in it:

auth sufficient pam_mysql.so user=mailadmin passwd= THEPASSWD 
host=localhost db=mail table=accountuser usercolumn=usern
ame passwdcolumn=password crypt=1 logtable=log logmsgcolumn=msg 
logusercolumn=user loghostcolumn=host logpidcolumn=pid l
ogtimecolumn=time

account required pam_mysql.so user=mailadmin passwd=THEPASSWD 
host=localhost db=mail table=accountuser usercolumn=user
name passwdcolumn=password crypt=1 logtable=log logmsgcolumn=msg 
logusercolumn=user loghostcolumn=host logpidcolumn=pid
logtimecolumn=time

The original instructions I followed either had something slightly 
different in there or I created them wrong. After doing that I got it 
to work....

....with this setup:

When a user sets up mail on the mail client, the account name they need 
to use is username.domain.tld, so my zzzzz at mutantegg.com email address 
account is zzzzz.mutantegg.com

I added a .htaccess file to the folder with the web-cyradm stuff in it 
so there are two layers of security to add or change email addresses.


Howard Shere
http://blogs.greendragon.com/index.php/gdc
Altair 8800a to Mac OS X so far...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 8078 bytes
Desc: not available
Url : http://lists.terrasoftsolutions.com/pipermail/yellowdog-general/attachments/20050518/5d5f560b/attachment.bin


More information about the yellowdog-general mailing list