Here’s a recipe for how to install Postfix on Solaris 11. During the process we build Postfix from scratch from source code. Even if you have not previously build any software yourself it should not scare you. It is a matter of following the instructions and it shouldn’t take more than 20 minutes all together.
The starting point is a completely fresh install of Solaris 11 using the so called Text Install ISO disk. This is the image I would personally use for a server install – as opposed to a workstation install.
root@myhost:~# cat /etc/release Oracle Solaris 11 11/11 X86 Copyright (c) 1983, 2011, Oracle and/or its affiliates. All rights reserved. Assembled 18 October 2011
Furthermore – as most Solaris SysAdmins tend to work inside a zone -I’ve created the simplest possible zone and will work from within that.
The zone has been created as follows:
root@myhost:~# zonecfg -z pftest create set zonepath=/export/zones/pftest commit exit root@myhost:~# zoneadm -z pftest install root@myhost:~# zoneadm -z pftest boot
This about the zone is important as many Solaris folks doesn’t realize that the default template for a zone contains a quite minimalistic set of packages. In other words it may be a package is part of the default Solaris install but that is not the same as the package is also in your zone (which you have created with the default template).
You can read more about zones and what is available in this blog posting. Here you can also see what packages I’ve installed in addition to the default packages.
I’ve downloaded latest Postfix (v2.9.4 at the time of writing) and unpacked it. Remember that when dealing with tarballs which have possibly not been created on Solaris it is always a good idea to use
gtar (GNU tar) rather than
tar to unpack. (This is why you should always have GNU tar package installed on any Solaris host).
We will compile using the GCC compiler. Make sure you have the required GCC related packages installed.
Ihsan Dogan has published some nice material concerning how to build Postfix for Solaris 10 (look at the bottom of the page). This gave me some hints albeit things are a little different on our target platform: Solaris 11. Also – unlike Ihsan – I’m compiling using GCC compiler.
Here we go: Start by entering into the root of the directory where you have unpacked the source code tarball. Then do the build by doing:
gmake clean gmake makefiles MAKE=gmake CCARGS='-DNO_NIS -DUSE_TLS -lssl -lcrypto \ -DDEF_COMMAND_DIR=\"/opt/postfix/bin\" \ -DDEF_DAEMON_DIR=\"/opt/postfix/libexec\" \ -DDEF_MAILQ_PATH=\"/opt/postfix/bin/mailq\" \ -DDEF_MANPAGE_DIR=\"/opt/postfix/man\" \ -DDEF_NEWALIAS_PATH=\"/opt/postfix/bin/newaliases\" \ -DDEF_SENDMAIL_PATH=\"/opt/postfix/bin/sendmail\" \ -DDEF_README_DIR=\"/opt/postfix/readme\" \ -DDEF_HTML_DIR=\"/opt/postfix/html\"' gmake
Notes to the above:
- Observe that I consistently use
gmake(GNU make) rather than
make. This is simply to avoid surprises. Most open source packages have only been tested and verified with GNU make. The are very small differences between GNU make and the Solaris equivalent and the chance that you will ever encounter the difference is 0.001% … but why take a chance ?
- I start by doing
gmake clean. This is obviously not necessary the first time you attempt a build but if you want to repeat the process then you are better off doing a ‘clean’ first. Then you know your starting point.
NO_NISdirective is absolutely required. The build will fail without it. Nobody uses NIS or NIS+ anymore so I’m quite sure you will not need it.
USE_TLSdirective is required if you need STARTTLS support. If for example you want to hook up your Postfix server to a SMTP server on the Internet then chances are you will need STARTTLS support.
- All of the
DEF*directives are because I wanted to install Postfix into
/opt/postfixand not in anyway be intermingled with the rest of the system and certainly not replace any existing sendmail binaries. You can leave them out if you like but then things will get installed into places like
/usr/binand that was not what I wanted.
From this point onwards you can just follow the official Postfix installation instructions. (see Section 6 of that document: “Installing the software after successful compilation”)