フリーソフトウェアのコンパイル

http://sy2920.s151.xrea.com/solaris/postfix-pkg.html http://sy2920.s151.xrea.com/mail/smtpauth-dovecot_sasl.html

sendmail のパッケージを消す

# cp /etc/aliases /var/tmp
# pkgrm SUNWsndmu
   SUNWsndmu  Sendmail (/usr)
	       (sparc) 11.10.0,REV=2005.01.21.15.53

このパッケージを削除しますか [y,n,?,q] y

## インストール済みパッケージインスタンス <SUNWsndmu> を削除中です。
## 大域ゾーン内でパッケージ <SUNWsndmu> の依存関係を検査しています
## パッケージ情報を処理中です。
## クラス <none> 中のパス名を削除中です。
/usr/sbin/sendmail
/usr/sbin/newaliases
...
/usr <共有パス名は削除されません。>
## システム情報を更新中です。

<SUNWsndmu> の削除に成功しました。

# pkgrm SUNWsndmr
このパッケージを削除しますか [y,n,?,q] y

## インストール済みパッケージインスタンス <SUNWsndmr> を削除中です。

このパッケージには、パッケージの削除の処理中にスーパーユーザーのアクセ
ス権で実行されるスクリプトが含まれています。

このパッケージの削除処理を継続しますか [y,n,?,q] y
## 大域ゾーン内でパッケージ <SUNWsndmr> の依存関係を検査しています
## パッケージ情報を処理中です。
## クラス <manifest> 中のパス名を削除中です。
...
/etc <共有パス名は削除されません。>
## システム情報を更新中です。

<SUNWsndmr> の削除に成功しました。

Postfix

http://www.postfix-jp.info/trans-2.3/jhtml/INSTALL.html

% gtar xvzf ../src/postfix-2.6.2.tar.gz
% cd postfix-2.6.2/

Solaris のコンパイラを使う

% make makefiles CC=/opt/SUNWspro/bin/cc

BerkeleyDB を利用する

% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
    AUXLIBS="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
% make

Dovecot を利用する

% make makefiles CCARGS='-DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\"'

TLS を利用する

% make makefiles CCARGS="-DUSE_TLS -I/usr/local/include" \
   AUXLIBS="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto"

すべて混ぜて

% unset LD_LIBRARY_PATH
% make makefiles CC=/opt/sunstudio12.1/bin/cc \
 CCARGS='-DHAS_DB -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DUSE_TLS -I/usr/local/BerkeleyDB.4.7/include -I/usr/local/ssl/include' \
 AUXLIBS="-R/usr/local/BerkeleyDB.4.7/lib -R/usr/local/ssl/lib -L/usr/local/BerkeleyDB.4.7/lib -L/usr/local/ssl/lib -ldb -lssl -lcrypto" 
% make
# groupadd -g 89 postfix
# groupadd -g 88 postdrop
# useradd -u 89 -g 89 -d /dev/null -s /bin/false postfix
# /usr/ccs/bin/make install
install_root: [/]

Please specify a directory for scratch files while installing Postfix.
You must have write permission in this directory.
tempdir: [/home/tanaka/build/postfix-2.6.2]

lease specify the final destination directory for installed Postfix
configuration files.
config_directory: [/etc/postfix]

Please specify the final destination directory for installed Postfix
administrative commands. This directory should be in the command search
path of adminstrative users.
command_directory: [/usr/sbin]

Please specify the final destination directory for installed Postfix
daemon programs. This directory should not be in the command search
path of any users.
daemon_directory: [/usr/libexec/postfix]

Please specify the final destination directory for Postfix-writable
data files such as caches or random numbers. This directory should not
be shared with non-Postfix software.
data_directory: [/var/lib/postfix

Please specify the destination directory for the Postfix HTML files.
Specify "no" if you do not want to install these files.
html_directory: [no]

Please specify the owner of the Postfix queue. Specify an account with
numerical user ID and group ID values that are not used by any other
accounts on the system.
mail_owner: [postfix]

Please specify the final destination pathname for the installed Postfix
mailq command. This is the Sendmail-compatible mail queue listing
command.
mailq_path: [/usr/bin/mailq]

Please specify the destination directory for the Postfix on-line manual
pages. You can no longer specify "no" here.
manpage_directory: [/usr/local/man]

Please specify the final destination pathname for the installed Postfix
newaliases command. This is the Sendmail-compatible command to build
alias databases for the Postfix local delivery agent.
newaliases_path: [/usr/bin/newaliases]

Please specify the final destination directory for Postfix queues.
queue_directory: [/var/spool/postfix]

Please specify the destination directory for the Postfix README files.
Specify "no" if you do not want to install these files.
readme_directory: [no]

Please specify the final destination pathname for the installed Postfix
sendmail command. This is the Sendmail-compatible mail posting
interface.
sendmail_path: [/usr/lib/sendmail]

Please specify the group for mail submission and for queue management
commands. Specify a group name with a numerical group ID that is not
shared with other accounts, not even with the Postfix mail_owner
account. You can no longer specify "no" here.
setgid_group: [postdrop]

/etc/services に以下の行を追加

ssmtp           465/tcp         smtps           # SMTP over SSL

設定ファイルの編集

起動スクリプト

/lib/svc/method/postfix (実行権つける)

#!/sbin/sh

# rc script for postfix

PROG=/usr/sbin/postfix
SERVICE=`basename $PROG`

ECHO=/usr/ucb/echo

case "$1" in
start)
	$ECHO -n "starting $SERVICE ... "
	$PROG start && $ECHO "[ OK ]" || $ECHO "[ NG ]"
	;;
stop)
	$ECHO -n "stopping $SERVICE ... "
	$PROG stop && $ECHO "[ OK ]" || $ECHO "[ NG ]"
	;;
restart)
	$0 stop
	sleep 3
	$0 start
	;;
reload|refresh)
	$ECHO -n "refreshing $SERVICE ... "
	$PROG reload && $ECHO "[ OK ]" || $ECHO "[ NG ]"
	;;
*)
	echo "Usage: $0 { start | stop | restart | refresh }"
	exit 1
	;;
esac

exit 0

マニフェスト

/var/svc/manifest/network/smtp-postfix.xml

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<!--
	Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
	Use is subject to license terms.
-->

<service_bundle type='manifest' name='postfix'>

<service
	name='network/smtp'
	type='service'
	version='1'>

	<single_instance />

	<dependency
	    name='fs-local'
	    grouping='require_all'
	    restart_on='none'
	    type='service'>
		<service_fmri value='svc:/system/filesystem/local' />
	</dependency>

	<dependency
	    name='network-service'
	    grouping='require_all'
	    restart_on='none'
	    type='service'>
		<service_fmri value='svc:/network/service' />
	</dependency>

	<dependency
	    name='name-services'
	    grouping='require_all'
	    restart_on='refresh'
	    type='service'>
		<service_fmri value='svc:/milestone/name-services' />
	</dependency>

	<dependency
	    name='identity'
	    grouping='optional_all'
	    restart_on='refresh'
	    type='service'>
		<service_fmri value='svc:/system/identity:domain' />
	</dependency>

	<dependency
	    name='system-log'
	    grouping='optional_all'
	    restart_on='none'
	    type='service'>
		<service_fmri value='svc:/system/system-log' />
	</dependency>

	<instance name='postfix' enabled='false'>

		<dependency
		    name='config-file'
		    grouping='require_all'
		    restart_on='refresh'
		    type='path'>
			<service_fmri
			    value='file://localhost/etc/postfix/main.cf' />
		</dependency>

		<dependency
		    name='nsswitch'
		    grouping='require_all'
		    restart_on='refresh'
		    type='path'>
			<service_fmri
			    value='file://localhost/etc/nsswitch.conf' />
		</dependency>

		<!--
		If autofs is enabled, wait for it to get users' home
		directories.
		-->
		<dependency
		    name='autofs'
		    grouping='optional_all'
		    restart_on='none'
		    type='service'>
			<service_fmri value='svc:/system/filesystem/autofs' />
		</dependency>

		<dependent
			name='smtp-sendmail_multi-user'
			grouping='optional_all'
			restart_on='none'>
				<service_fmri
				    value='svc:/milestone/multi-user' />
		</dependent>

		<exec_method
			type='method'
			name='start'
			exec='/lib/svc/method/postfix start'
			timeout_seconds='120' />

		<exec_method
			type='method'
			name='stop'
			exec='/lib/svc/method/postfix stop'
			timeout_seconds='60' />

		<exec_method
			type='method'
			name='refresh'
			exec='/lib/svc/method/postfix reload'
			timeout_seconds='60' />

		<property_group name='startd' type='framework'>
			<propval name='ignore_error' type='astring'
			    value='core,signal' />
		</property_group>

		<property_group name='general' type='framework'>
			<propval name='action_authorization' type='astring'
				value='solaris.smf.manage.postfix' />
		</property_group>

		<template>
			<common_name>
				<loctext xml:lang='C'>
				postfix SMTP mail transfer agent
				</loctext>
			</common_name>
			<documentation>
				<manpage title='postfix' section='1'
				    manpath='/usr/local/man' />
			</documentation>
		</template>

	</instance>

	<stability value='Unstable' />

</service>

</service_bundle>
# svccfg -v import smtp-postfix.xml
# svcadm enable postfix

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2009-10-01 (木) 16:36:57