Resources‎ > ‎How To's‎ > ‎Sendmail‎ > ‎

Sendmail Howto 2: Installation

Downloading and Verifying the Package

Download Sendmail Server

The sendmail software and its signatures has to be downloaded from Sendmail ftp server. The version described here is "sendmail-8.12.9". Download the compressed tar archive to the /opt directory. This directory is usually used to store the downloaded softwares/installers. The extension can be tar.gz/tar.Z. 

wget -P /opt/ ftp://ftp.sendmail.org/pub/sendmail/past-releases/sendmail.8.12.9.tar.gz
wget -P /opt/ ftp://ftp.sendmail.org/pub/sendmail/past-releases/sendmail.8.12.9.tar.gz.sig

Once downloaded, extract them to the /usr/local directory. This directory is usually used to install the binary version of the softwares. 

cd /usr/local
tar -xzvf /opt/sendmail.8.12.9.tar.gz
kjvfnvjfdvfdv

Source Structure

    Sendmail not only works as an MTA, but it has certain additional functionalities. Hence it becomes important to know what needs to be installed and from which directories. In this section we'll discover some of the major directories of sendmail and its contents.

Build
cf
contrib
devtools
doc
editmap
FAQ
include
INSTALL
KNOWNBUGS
libmilter
libsm
libsmdb
libsmutil
LICENSE
mail.local
mailstats
Makefile
makemap
obj.Linux.2.6.18-128.el5.x86_64
PGPKEYS
praliases
README
RELEASE_NOTES
rmail
sendmail
smrsh
test
vacation

Building Sendmail

    The sendmail MTA can installed by building and compiling the code user the sendmail directory of the source. Again to build we need the gcc compiler which provides the executable gcc and cc (cc is a symbolic link to gcc compiler).

[root@sendmail1 sendmail-8.12.9]# yum -y install gcc
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.1.2-44.el5 set to be updated
--> Processing Dependency: libgomp >= 4.1.2-44.el5 for package: gcc
--> Running transaction check
---> Package libgomp.x86_64 0:4.3.2-7.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                                  Arch                                    Version                                          Repository                              Size
====================================================================================================
Installing:
 gcc                                      x86_64                                  4.1.2-44.el5                                     local                                  5.3 M
Installing for dependencies:
 libgomp                                  x86_64                                  4.3.2-7.el5                                      local                                   65 k

Transaction Summary
====================================================================================================
Install      2 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        

Total download size: 5.4 M
Downloading Packages:
----------------------------------------------------------------------------------------------------
Total                                                                                                                                           1.8 GB/s | 5.4 MB     00:00    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : libgomp                                           [1/2]
  Installing     : gcc                                               [2/2]

Installed: gcc.x86_64 0:4.1.2-44.el5
Dependency Installed: libgomp.x86_64 0:4.3.2-7.el5
Complete!


   
Now you start the build operation!
[root@sendmail1 ~]# cd /usr/local/sendmail-8.12.9/sendmail
[root@sendmail1 sendmail]# ./Build
Configuration: pfx=, os=Linux, rel=2.6.18-128.el5, rbase=2, rroot=2.6.18-128, arch=x86_64, sfx=, variant=optimized
Making in /srv/sendmail-8.12.9/obj.Linux.2.6.18-128.el5.x86_64/sendmail
cc -O2 -I. -I../../include       -c -o main.o main.c
cc -O2 -I. -I../../include       -c -o alias.o alias.c
cc -O2 -I. -I../../include       -c -o arpadate.o arpadate.c
cc -O2 -I. -I../../include       -c -o bf.o bf.c
cc -O2 -I. -I../../include       -c -o collect.o collect.c
cc -O2 -I. -I../../include       -c -o conf.o conf.c
cc -O2 -I. -I../../include       -c -o control.o control.c
cc -O2 -I. -I../../include       -c -o convtime.o convtime.c
cc -O2 -I. -I../../include       -c -o daemon.o daemon.c
cc -O2 -I. -I../../include       -c -o deliver.o deliver.c
cc -O2 -I. -I../../include       -c -o domain.o domain.c
cc -O2 -I. -I../../include       -c -o envelope.o envelope.c
cc -O2 -I. -I../../include       -c -o err.o err.c
cc -O2 -I. -I../../include       -c -o headers.o headers.c
cc -O2 -I. -I../../include       -c -o macro.o macro.c
cc -O2 -I. -I../../include       -c -o map.o map.c
cc -O2 -I. -I../../include       -c -o mci.o mci.c
cc -O2 -I. -I../../include       -c -o milter.o milter.c
cc -O2 -I. -I../../include       -c -o mime.o mime.c
cc -O2 -I. -I../../include       -c -o parseaddr.o parseaddr.c
cc -O2 -I. -I../../include       -c -o queue.o queue.c
cc -O2 -I. -I../../include       -c -o readcf.o readcf.c
cc -O2 -I. -I../../include       -c -o recipient.o recipient.c
cc -O2 -I. -I../../include       -c -o sasl.o sasl.c
cc -O2 -I. -I../../include       -c -o savemail.o savemail.c
cc -O2 -I. -I../../include       -c -o sfsasl.o sfsasl.c
cc -O2 -I. -I../../include       -c -o shmticklib.o shmticklib.c
cc -O2 -I. -I../../include       -c -o sm_resolve.o sm_resolve.c
cc -O2 -I. -I../../include       -c -o srvrsmtp.o srvrsmtp.c
cc -O2 -I. -I../../include       -c -o stab.o stab.c
cc -O2 -I. -I../../include       -c -o stats.o stats.c
cc -O2 -I. -I../../include       -c -o sysexits.o sysexits.c
cc -O2 -I. -I../../include       -c -o timers.o timers.c
cc -O2 -I. -I../../include       -c -o tls.o tls.c
cc -O2 -I. -I../../include       -c -o trace.o trace.c
cc -O2 -I. -I../../include       -c -o udb.o udb.c
cc -O2 -I. -I../../include       -c -o usersmtp.o usersmtp.c
cc -O2 -I. -I../../include       -c -o util.o util.c
cc -O2 -I. -I../../include       -c -o version.o version.c
cc -o sendmail   main.o alias.o arpadate.o bf.o collect.o conf.o control.o convtime.o daemon.o deliver.o domain.o envelope.o err.o headers.o macro.o map.o mci.o milter.o mime.o parseaddr.o queue.o readcf.o recipient.o sasl.o savemail.o sfsasl.o shmticklib.o sm_resolve.o srvrsmtp.o stab.o stats.o sysexits.o timers.o tls.o trace.o udb.o usersmtp.o util.o version.o      /srv/sendmail-8.12.9/obj.Linux.2.6.18-128.el5.x86_64/libsmutil/libsmutil.a /srv/sendmail-8.12.9/obj.Linux.2.6.18-128.el5.x86_64/libsm/libsm.a  -ldl  -lresolv
groff -Tascii -man sendmail.8 > sendmail.0 || cp sendmail.0.dist sendmail.0
groff -Tascii -man aliases.5 > aliases.0 || cp aliases.0.dist aliases.0
groff -Tascii -man mailq.1 > mailq.0 || cp mailq.0.dist mailq.0
groff -Tascii -man newaliases.1 > newaliases.0 || cp newaliases.0.dist newaliases.0


    After building verify whether the sendmail binary has been created in the object directory.
[root@sendmail1 sendmail]# ll ../obj.Linux.2.6.18-128.el5.x86_64/sendmail/sendmail
-rwxr-xr-x 1 root root 600656 Feb 24 13:32 ../obj.Linux.2.6.18-128.el5.x86_64/sendmail/sendmail

vvdsv

xvdvdsc
dcdscdscdscdscd
cdscdscdcd


Troubleshooting

"domain.o: In function `dns_getcanonname'"

    The above error is usually found when the sendmail compilation does not find the resolv.h header file. The text of the error is attached below. This file provides the routine known as res_query. So we have to force the sendmail installation to rather take the system resolver routine which may not be installed in the path /usr/include. To do so we just need to modify the variable "LIBS" in Makefile which is under the sendmail object directory. A pattern "-lresolv" has to be appended to the line containing "LIBS" variable. 

cc -o sendmail   main.o alias.o arpadate.o bf.o collect.o conf.o control.o convtime.o daemon.o deliver.o domain.o envelope.o err.o headers.o macro.o map.o mci.o milter.o mime.o parseaddr.o queue.o readcf.o recipient.o sasl.o savemail.o sfsasl.o shmticklib.o sm_resolve.o srvrsmtp.o stab.o stats.o sysexits.o timers.o tls.o trace.o udb.o usersmtp.o util.o version.o      /srv/sendmail-8.12.9/obj.Linux.2.6.18-128.el5.x86_64/libsmutil/libsmutil.a /srv/sendmail-8.12.9/obj.Linux.2.6.18-128.el5.x86_64/libsm/libsm.a  -ldldomain.o: In function `dns_getcanonname':
domain.c:(.text+0x258): undefined reference to `__res_querydomain'
domain.c:(.text+0x2d0): undefined reference to `__dn_skipname'
domain.c:(.text+0x4ac): undefined reference to `__dn_expand'
domain.c:(.text+0x53e): undefined reference to `__dn_expand'
domain.o: In function `getmxrr':
domain.c:(.text+0xbfc): undefined reference to `__res_search'
domain.c:(.text+0xc7a): undefined reference to `__dn_skipname'
domain.c:(.text+0xc8f): undefined reference to `__res_query'
domain.c:(.text+0xfdf): undefined reference to `__dn_expand'
domain.c:(.text+0x1165): undefined reference to `__dn_expand'
sm_resolve.o: In function `dns_lookup_int':
sm_resolve.c:(.text+0x18f): undefined reference to `__res_search'
sm_resolve.c:(.text+0x30e): undefined reference to `__dn_expand'
sm_resolve.c:(.text+0x3a6): undefined reference to `__dn_expand'
sm_resolve.c:(.text+0x55f): undefined reference to `__dn_expand'
sm_resolve.c:(.text+0x606): undefined reference to `__dn_expand'
sm_resolve.c:(.text+0x6d4): undefined reference to `__dn_expand'
collect2: ld returned 1 exit status
make: *** [sendmail] Error 1