#norelated

postfixのこと

基本的に備忘録として使います。 ほとんど更新はありませんのでご了承ください。

ソースからインストール(のメモ)

postfixのサイトのサイトからたどってソースを頂きます。 今回頂いたのは、postfix-2.5.1.tar.gz です。

  • groupの追加
    postfix:*:10000:
    postdrop:*:10001:
    
  • ユーザの追加 /etc/passwd
    postfix:*:10000:10000:Postfix owner:/nonexistent:/sbin/nologin
    
  • 展開
    # tar zxvf postfix-2.5.1.tar.gz
    
  • postfixのインストール インストールする際にいろいろ聞かれます。 インストール先を変更する場合などは適宜変更します。
    # cd postfix-2.5.1
    # make
    # make install
    
  • スケルトンディレクトリへの追加(Maildir対応時のみ) ディレクトリの作成
    # mkdir -p /etc/skel/Maildir/{new,cur,tmp}
    # chmod -R 700 /etc/skel/Maildir/
    
  • エイリアス追加
    # vi /etc/aliases
    postfix:        root
    
  • エイリアス反映
    # newaliases
    
  • 設定ファイルの変更
    デフォルトインストールの場合は、/etc/postfix/ 配下に設定ファイルが格納されています。 make installの際にインストール先を変更した場合は変更した先の設定ファイルを変更します。
    # vi /etc/postfix/main.cf
    
  • 起動スクリプト
    起動スクリプトを作成します。(/etc/init.d/postfix)
    インストール先を変更した場合は、スクリプトを適宜変更します。
#!/bin/bash
#
# postfix      This shell script takes care of starting and stopping
#              postfix.
#
# chkconfig: 2345 80 30
# description: Postfix is a Mail Transport Agent, which is the program \
#              that moves mail from one machine to another.
# processname: postfix
# config: /etc/postfix/main.cf
# pidfile: /var/run/postfix.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0


RETVAL=0
LOCKFILE=/var/lock/subsys/postfix
prog="postfix"

start() {
        # Start 

        echo -n $"Starting $prog: "
        /usr/sbin/postfix start
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch $LOCKFILE
        return $RETVAL
}

stop() {
        # Stop .
        echo -n $"Shutting down $prog: "
        /usr/sbin/postfix stop
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
        return $RETVAL
}

status() {
        # Status
        echo -n $"Status $prog: "
        /usr/sbin/postfix status
        RETVAL=$?
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        start
        RETVAL=$?
        ;;
  status)
        status
        RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|status}"
        exit 1
esac

exit $RETVAL
  • サービス登録
    # chkconfig --add postfix
    # chkconfig postfix on
    # chkconfig --list postfix
    
  • サービス起動停止確認
    # chmod 755 /etc/init.d/postfix 
    # service postfix start
    # netstat -ln
    # service postfix stop
    # netstat -ln
    # tail /var/log/maillog
    

アンチウィルスソフト導入(のメモ)

アンチウィルスソフトとしてClam AntiVirusを導入します。

最終更新:2009年04月21日 23:33