LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   building POSTFIX rpm package for Redhat (https://www.linuxquestions.org/questions/linux-newbie-8/building-postfix-rpm-package-for-redhat-192565/)

hct224 06-11-2004 11:05 PM

building POSTFIX rpm package for Redhat
 
I download postfix source file from postfix.com site and want to know what command should I use to build a rpm package which has MySQL support. How am I going to do that?

thank you

ps. I want to build Postfix RPM package which has MySQL support because the RPM package which come with Redhat does NOT have this feature.

mascdman 06-13-2004 09:46 PM

(Disclaimer: I'm running Mandrake 10.0, but I've altered these steps so that they should work for Redhat distros)
I'd suggest skipping the postfix tarball from postfix.org and get the SRPM packageCreate the needed directories by running
Code:

mkdir -p ~/rpm/{BUILD,RPMS/i386,RPMS/noarch,SOURCES,SRPMS,SPECS,tmp}
And place the following two files in your home directory:

.rpmrc
Code:

buildarchtranslate: i386: i386
buildarchtranslate: i486: i386
buildarchtranslate: i586: i386
buildarchtranslate: i686: i386

.rpmmacros
Code:

%_topdir              YOUR_HOME_DIR/rpm
%_tmppath              YOUR_HOME_DIR/rpm/tmp

This lets you build RPMs as a regular user (a good thing). Once you've downloaded the source RPM, run
Code:

rpm -i /path/to/package/postfix-blah-blah-blah.src.rpm
cd ~/rpm/SPECS
ls

with your regular user (not as root). You should see a postfix .spec file listed. Open up the spec file in your favourite editor and look for a MYSQL option. I grabbed the Fedora Core 1 SRPM and it had the following in the spec file:
Code:

%define LDAP 2
%define MYSQL 0
%define PCRE 1
%define SASL 2
%define TLS 1
%define POSTDROP_GID 90

...(snip)...

%if %{MYSQL}
Requires: mysql, mysqlclient9
BuildRequires: mysql, mysqlclient9, mysql-devel
%endif

So changing the %define MYSQL 0 to %define MYSQL 1 should enable MYSQL support. Save the changed spec file and run
Code:

rpmbuild -ba postfix.spec
Note: Make sure you have the needed BuildRequires packages installed (in this case: mysql, mysqlclient9, mysql-devel). If everything goes well, you should wind up with a new RPM in ~/rpm/RPMS/i386.

Let me know if you have any problems.

--mascdman

hct224 06-14-2004 12:26 AM

Thank you. I'm going to try tomorrow and will post here the result.

hct224 06-14-2004 06:57 PM

It works. I can send mail out but postfix mail server deny to receive mail(it said: Remote host said: 554 <mailme@mydomain(edited).com>: Relay access denied. I think I need to look closer the main.cf file


Thank you

mascdman 06-14-2004 09:21 PM

Try adding mydomain.com to the mydestination line in main.cf. This should make Postfix receive mail for mydomain.com and deliver it locally.

--mascdman

hct224 06-16-2004 01:14 AM

Actualy, I did setup Postfix before but NEVER done with MySQL. :D

I just look through all my setup and NOW it's working OK. The last thing I have to do is setting up Pop-Before-SMTP to send mail out(I did before so I don't thing I will have trouble with it). :)


Thank you

mascdman 06-16-2004 01:32 AM

:) You're welcome

--mascdman


All times are GMT -5. The time now is 07:45 PM.