OpenSolaris uses Sendmail as default Mail Transfer Agent (MTA) which seems to be designed as a admin-hell. I prefer Postfix with it’s easy to read config files.
As the package repository of OpenSolaris doesn’t provide a current Postfix, this HowTo explains a way to build Postfix from source and install it on your OpenSolaris system.
Basics
First step is to install/get a working GCC (preferred version >4.3). One possibility is to follow my Guide about GCC-4 on OpenSolaris or to use the package repository. In addition you will need gnu-make and wget.
root@test:~# pkg install gcc-43 wget nano developer/build/gnu-make
Packages to install: 18
Create boot environment: No
DOWNLOAD PKGS FILES XFER (MB)
Completed 18/18 3121/3121 71.5/71.5
PHASE ACTIONS
Install Phase 4183/4183
PHASE ITEMS
Package State Update Phase 18/18
Image State Update Phase 2/2
root@test:~# PATH=/usr/bin:/usr/gcc/4.3/bin:$PATH
Preparations
Since the build environment is now set up, you can download the current postfix source release.
root@test:~# wget http://de.postfix.org/ftpmirror/official/postfix-2.8.5.tar.gz
--2011-10-04 22:38:09-- http://de.postfix.org/ftpmirror/official/postfix-2.8.5.tar.gz
Resolving de.postfix.org (de.postfix.org)... 141.42.206.35
Connecting to de.postfix.org (de.postfix.org)|141.42.206.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3647010 (3.5M) [application/x-gzip]
Saving to: `postfix-2.8.5.tar.gz'
100%[======================================>] 3,647,010 700K/s in 5.6s =
2011-10-04 22:38:15 (632 KB/s) - `postfix-2.8.5.tar.gz' saved [3647010/3647010]
root@test:~# tar xf postfix-2.8.5.tar.gz
root@test:~# cd postfix-2.8.5
One of the postfix scripts has an error and tries to use NIS and NIS+ with OpenSolaris which will result in a build-fail.
To fix it, remove the lines “#define HAS_NIS” and “#define HAS_NISPLUS” (line 403 and 404) from src/util/sys_defs.h or apply this path:
--- src/util/sys_defs.h.bak Thu Jun 16 00:36:37 2011
+++ src/util/sys_defs.h Tue Oct 4 22:39:49 2011
@@ -400,8 +400,6 @@
#define HAS_DBM
#define DEF_DB_TYPE "dbm"
#define ALIAS_DB_MAP "dbm:/etc/mail/aliases"
-#define HAS_NIS
-#define HAS_NISPLUS
#define USE_SYS_SOCKIO_H /* Solaris 2.5, changed sys/ioctl.h */
#define GETTIMEOFDAY(t) gettimeofday(t)
#define ROOT_PATH "/bin:/usr/bin:/sbin:/usr/sbin:/usr/ucb"
Building
Now you can start building Postfix.
root@test:~/postfix-2.8.5# gmake makefiles CCARGS='-DUSE_TLS \
-lssl -lcrypto -DUSE_SASL_AUTH \
-DUSE_CYRUS_SASL -I/usr/include/sasl' \
AUXLIBS="-L/usr/lib -lsasl -lssl -lcrypto"
(echo "# Do not edit -- this file documents how Postfix was built for your machine.";
>makedefs.tmp
set +e; if cmp makedefs.tmp conf/makedefs.out; then rm makedefs.tmp; \
...
root@test:~/postfix-2.8.5# gmake
gmake -f Makefile.in MAKELEVEL= Makefiles
(echo "# Do not edit -- this file documents how Postfix was built for your machine.";
>makedefs.tmp
...
If you didn’t get an error, you can now check if libsasl was linked correctly:
root@test:~/postfix-2.8.5# ldd ./bin/postconf
libsasl.so.1 => /usr/lib/libsasl.so.1
libssl.so.0.9.8 => /lib/libssl.so.0.9.8
libcrypto.so.0.9.8 => /lib/libcrypto.so.0.9.8
libresolv.so.2 => /lib/libresolv.so.2
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libc.so.1 => /lib/libc.so.1
libmd.so.1 => /lib/libmd.so.1
libmp.so.2 => /lib/libmp.so.2
libm.so.2 => /lib/libm.so.2
Create a OpenSolaris Package
There is a cool script available which takes the compiled Postfix sources and builds a OpenSolaris package with all required settings (e.g. users, service-definitions).
You can find the script on Ihsan Dogan’s website: http://ihsan.dogan.ch/postfix/
Directlink: http://ihsan.dogan.ch/postfix/downloads/makePostfixPkg.sh
root@test:~/postfix-2.8.5# wget http://ihsan.dogan.ch/postfix/downloads/makePostfixPkg.sh
--2011-10-04 22:42:35-- http://ihsan.dogan.ch/postfix/downloads/makePostfixPkg.sh
Resolving ihsan.dogan.ch (ihsan.dogan.ch)... 82.220.5.55
Connecting to ihsan.dogan.ch (ihsan.dogan.ch)|82.220.5.55|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21030 (21K) [application/x-sh]
Saving to: `makePostfixPkg.sh'
100%[======================================>] 21,030 --.-K/s in 0.1s
2011-10-04 22:42:35 (205 KB/s) - `makePostfixPkg.sh' saved [21030/21030]
root@test:~/postfix-2.8.5# chmod +x makePostfixPkg.sh
root@test:~/postfix-2.8.5# ./makePostfixPkg.sh
...
This will result in a file named CNDpostfix-2.8.5,REV=111005-SunOS5.11-i386.pkg
Install Postfix
If you have a installed Sendmail, you need to remove it before the installation of postfix:
root@test:~/postfix-2.8.5# pkg uninstall sendmail
Now you can use pkgadd to install the package:
root@test:~/postfix-2.8.5# pkgadd -d CNDpostfix-2.8.5\,REV\=111005-SunOS5.11-i386.pkg
The following packages are available:
1 CNDpostfix Postfix MTA
(i386) 2.8.5r0.4.0,REV=111005
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: a
Processing package instance from
Postfix MTA(i386) 2.8.5r0.4.0,REV=111005
http://www.postfix.org/ packaged by Ihsan Dogan
...
The final step is to configure your Postfix and activate it afterwards.
root@test:~/postfix-2.8.5# svcadm enable svc:/network/postfix:default
root@test:~/postfix-2.8.5# svcs -vx postfix
svc:/network/postfix:default (Postfix SMTP Server)
State: online since Tue Oct 4 22:46:29 2011
See: man -M /usr/share/man -s 1 postfix
See: http://www.postfix.org/documentation.html
See: /var/svc/log/network-postfix:default.log
Impact: None.
OpenSolaris uses Sendmail as default Mail Transfer Agent (MTA) which seems to be designed as a admin-hell. I prefer Postfix with it's easy to read config files.
As the package repository of OpenSolaris doesn't provide a current Postfix, this HowTo explains a way to build Postfix from source and install it on your OpenSolaris system.
Basics
First ...