だいぶ久しぶりに postfix の install. (postfixの設定は気が向いたら後日)
参考url
- The Postfix Home Page
- GitHub - vdukhovni/postfix: Postfix MTA by Wietse Venema
- ソースからPostfixをインストールする - noknow
- CentOS 7にPostfix 3.5をソースから躓きながらインストールする - Qiita
- ふかふかの部屋 - Install Memo - Postfix
- ソースコードからのPostfixインストール
step1: download postfix
$ wget http://mirror.postfix.jp/postfix-release/official/postfix-3.5.2.tar.gz or $ wget https://github.com/vdukhovni/postfix/archive/v3.5.2.tar.gz $ tar -xvf postfix-3.5.2.tar.gz $ cd postfix-3.5.2 $ less INSTALL
step2: required software
Oracle Berkeley DB and Cyrus SASL は、次の以前のエントリを参照。
install openldap 2.4.48 from src to centos8 for openam - end0tknr's kipple - 新web写経開発
ICU は、やはり次の以前のエントリを参照。
install php ver.7.3.15 and wordpress ver.5.3.2 - end0tknr's kipple - 新web写経開発
step3: add user and group
$ sudo useradd -c "Postfix User" -M -s /sbin/nologin postfix $ id postfix uid=1006(postfix) gid=1008(postfix) groups=1008(postfix) $ sudo groupadd postdrop $ cat /etc/group | grep post postgres:x:1005: postfix:x:1008: postdrop:x:1009:
step4: make
$ make makefiles \ CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -DUSE_TLS -DHAS_MYSQL -I/usr/local/include \ -I/usr/local/BerkeleyDB.5.1/include \ -I/usr/local/cyrus_sasl/include \ -I/usr/local/openssl_1_1_1/include \ -I/usr/local/mysql/include" \ AUXLIBS="-L/usr/local/lib \ -L/usr/local/BerkeleyDB.5.1/lib \ -L/usr/local/cyrus_sasl/lib \ -L/usr/local/mysql/lib \ -lsasl2 -lssl -lcrypto -lmysqlclient -lz -lm" : No <db.h> include file found. Install the appropriate db*-devel package first. make: *** [Makefile.in:33: Makefiles] Error 1 make: *** [Makefile:22: makefiles] Error 2
上記のようなerrorが表示される為、DB_README に従い、makedefs を編集後、 改めて make makefiles ~ 実行。
$ less REAAME_FILES/DB_README : Warning: some Linux system libraries use Berkeley DB. If you compile Postfix with a non-default Berkeley DB implementation, then every Postfix program will dump core because either the system library or Postfix itself ends up using the wrong version. On Linux, you need to edit the makedefs script in order to specify a non- default DB library. The reason is that the location of the default db.h include file changes randomly between vendors and between versions, so that Postfix has to choose the file for you.
$ vi makedefs Linux.[345].*) SYSTYPE=LINUX$RELEASE_MAJOR case "$CCARGS" in *-DNO_DB*) ;; *-DHAS_DB*) ;; *) if [ -f /usr/include/db.h ] then : we are all set elif [ -f /usr/include/db/db.h ] then CCARGS="$CCARGS -I/usr/include/db" elif [ -f /usr/local/BerkeleyDB.5.1/include/db.h ] ## ADD then ## ADD CCARGS="$CCARGS -I/usr/local/BerkeleyDB.5.1/include/db.h" ## ADD else # On a properly installed system, Postfix builds # by including <db.h> and by linking with -ldb echo "No <db.h> include file found." 1>&2 echo "Install the appropriate db*-devel package first." 1>&2 exit 1 fi $ make makefiles \ CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -DUSE_TLS -DHAS_MYSQL \ -I/usr/local/include -I/usr/local/BerkeleyDB.5.1/include \ -I/usr/local/cyrus_sasl/include/sasl \ -I/usr/local/openssl_1_1_1/include -I/usr/local/mysql/include" \ AUXLIBS="-L/usr/local/lib -L/usr/local/BerkeleyDB.5.1/lib \ -L/usr/local/cyrus_sasl/lib -L/usr/local/mysql/lib \ -lsasl2 -lssl -lcrypto -lmysqlclient -lz -lm" \ shared=yes\ dynamicmaps=yes\ install_root=/\ config_directory=/usr/local/postfix/etc/postfix\ command_directory=/usr/local/postfix/sbin\ daemon_directory=/usr/local/postfix/libexec\ data_directory=/usr/local/postfix/var/lib\ html_directory=no\ mail_owner=postfix\ mailq_path=/usr/local/postfix/bin/mailq\ manpage_directory=/usr/local/postfix/man\ newaliases_path=/usr/local/postfix/bin/newaliases\ queue_directory=/var/spool/postfix\ readme_directory=no\ sendmail_path=/usr/local/postfix/sbin/sendmail\ setgid_group=postdrop\ shlib_directory=/usr/local/postfix/lib\ meta_directory=/usr/local/postfix/etc/postfix ※視認性の為、CCARGS や AUXLIBS の引数には改行を入れていますが make時に失敗しますので、実際には、半角スペース1コで各値を区切って下さい $ make : Wformat -Wno-comment -fcommon -fPIC -g -O -I. -DLINUX4 -c dict_nis.c cc1: warning: /usr/local/BerkeleyDB.5.1/include/db.h: not a directory dict_nis.c:42:10: fatal error: rpcsvc/ypclnt.h: No such file or directory #include <rpcsvc/ypclnt.h> ^~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:206: dict_nis.o] Error 1 make: *** [Makefile:109: update] Error 1 ## centos8 glibc には rpcsvc/ypclnt.h (libnsl)が付属しない為 ## 「sudo yum install libnsl2-devel 」を実行. ## (--enablerepo=PowerTools オプションも必要かも) ## refer to https://centosfaq.org/centos/compiling-latest-postfix-fails-on-c8/ $ sudo yum install libnsl2-devel $ make install bin/postconf: error while loading shared libraries: libmysqlclient.so.21: cannot open shared object file: No such file or directory make installでerrorとなった為、以下を実施 $ sudo ln -s /usr/local/mysql/lib/libmysqlclient.so.21 /usr/lib64/ ## postfix の make install は対話式で ## 様々なパラメータを入力する必要がありますが、詳細は次のurlが分かりやすいです。 ## https://qiita.com/kotazuck/items/f13b59771f6241fde39d