■Postfixのインストールと設定
Postfixがインストールされているかどうか確認する
# rpm -qa | grep postfix
postfix-2.8.10-1vl6.x86_64  インストールされている
もし、インストールされていなければ以下を実行する
# apt-get install postfix

Postfixが起動しているか確認
# ps ax | grep postfix
 2110 ?        Ss     0:00 /usr/lib64/postfix/master  起動している
 2915 pts/0    S+     0:00 grep --color=auto postfix
もし、何も表示されなければPostfixを起動する
# /etc/rc.d/init.d/postfix start

Postfixが自動起動になっているか確認
# chkconfig --list postfix
postfix         0:off   1:off   2:on    3:on    4:on    5:on    6:off       3:onなのでOK
もし、3:offになっていたら
# chkconfig postfix on

●設定ファイルの編集
# vi /etc/postfix/main.cf
myhostname = xxmain1xx.net      自分のドメインに変更する
mydomain = xxmain1xx.net        自分のドメインに変更する

サーバーから送られるメールに付加するドメインを選択する
myorigin = $myhostname  この行頭の#削除

メール受信する範囲選択・・・インターネット使用する
inet_interfaces = all    この行頭の#削除

メールを最終的に受信するドメイン名設定
mydestination = $myhostname, localhost.$mydomain $mydomain

メール中継許可・・・同じサブネットのLAN内だけ許可
mynetworks_style = subnet   この行頭の#削除

POPサーバーとしてCourier-IMAPを使う
home_mailbox = Maildir/    この行頭の#削除

編集完了 保存終了

Postfixを再起動するとメール送受信準備完了する
# /etc/rc.d/init.d/postfix restart
Postfixを停止中:                                                [  OK  ]
Postfixを起動中:                                                [  OK  ]


■POPサーバーCourier-IMAPのインストールと設定
POPメール受信サーバー
Courier-IMAPはインストールされていないのでインストールする
# apt-get install courier-imap

自動起動設定の確認
# chkconfig --list courier-imap
courier-imap    0:off   1:off   2:on    3:on    4:on    5:on    6:off

ランラベル2~5がonならOK
# chkconfig --list courier-imap
courier-authlib 0:off   1:off   2:on    3:on    4:on    5:on    6:off
ランラベル2~5がonならOK

●メールボックスの準備
受信メールの保存ディレクトリ作成
# cd /home/httpd/html      自分のホームディレクトリに移動
Maildirを作成する
下のコマンドを実行するとcur、new、tmpの各ディレクトリがMaildir以下に作成される
# /usr/sbin/maildirmake Maildir

 ------------ 参考 ------------------------------------------------------------------
 ユーザー毎にMaildir作成は面倒なので/etc/skelディレクトリにMaildirを作成しておけば、次回ユーザーを作成すると同時にホームディレクトリにMaildirが作成される
 # /usr/sbin/maildirmake /etc/skel/Maildir
 --------------------------------------------------------------------------------------

●メールアカウントの作成
メールのみのユーザーの場合は以下を実行する
# useradd -s /sbin/nonlogin xxxx    xxxxはユーザー名
/home以下にユーザー/xxxxが作成される
 ------------ 参考 ------------------------------------------------------------------
 標準設定ではLinuxユーザーがそのままPostfixユーザーになる
 ユーザー名@xxmain1xx.net
 になる
 --------------------------------------------------------------------------------------

●Courier-IMAPの起動
courier-imapとcourier-authlibの二つを起動する
# service courier-imap start
Starting Courier-IMAP server: imap generating-SSL-certificate... imap-ssl pop3 generating-SSL-certificate... pop3-ssl

# service courier-authlib start
Starting Courier authentication services: authdaemond

動作確認
# ps ax | grep courier-imap
4918 ?   S   0:00 /usr/sbin/courierlogger -pid=/var/run/imapd.pid -start -name=imapd /usr/libexec/courier-imap/couriertcpd -address=0 -maxprocs=40 -maxperip=4 -nodnslookup -noidentlookup 143 /usr/sbin/imaplogin /usr/sbin/imapd Maildir 
 ・
 ・
 ・
 5157 pts/0 S+ 0:00 grep --color=auto
courier-imap
これでいいの??
起動していない場合は
・・・・・・courier-imap起動していない
となる


# ps ax | grep courier-authlib

 4971 ?        S      0:00 /usr/sbin/courierlogger -pid=/var/spool/authdaemon/pid -start /usr/libexec/courier-authlib/authdaemond
 4972 ?        S      0:00 /usr/libexec/courier-authlib/authdaemond
 4973 ?        S      0:00 /usr/libexec/courier-authlib/authdaemond
 4974 ?        S      0:00 /usr/libexec/courier-authlib/authdaemond
 4975 ?        S      0:00 /usr/libexec/courier-authlib/authdaemond
 4976 ?        S      0:00 /usr/libexec/courier-authlib/authdaemond
 4977 ?        S      0:00 /usr/libexec/courier-authlib/authdaemond
 5108 pts/0    S+     0:00 grep --color=auto
courier-authlib
起動していない場合は
・・・・・・courier-authlib起動していない
となる



この記事はこちらにも記載しています。
こちらの方が見やすいと思います。
logo154_81-kzn-blu







【Vine Linuxで自宅サーバー】様を参考にしてサーバーを構築しています。
Homeserver on Linux – 自宅サーバーを作ろう様を参考にしてサーバーを構築しています。