Postfixのインストール

Postfixとは

Postfix(ポストフィックス)はオープンソースのMTA(メール転送サーバプログラム)。
フリーソフトとして利用が可能。


Postfixのインストール状況確認

コマンド

aptitude show postfix

root@debian:/home/user1# aptitude show postfix
Package: postfix
State: not installed
Version: 2.9.6-2
Priority: extra
Section: mail
Maintainer: LaMont Jones <[email protected]>
Architecture: i386
Uncompressed Size: 3277 k
Depends: libc6 (>= 2.11), libdb5.1, libsasl2-2 (>= 2.1.24), libsqlite3-0 (>=
3.5.9), libssl1.0.0 (>= 1.0.0), debconf (>= 0.5) debconf-2.0,
netbase, adduser (>= 3.48), dpkg (>= 1.8.3), lsb-base (>= 3.0-6),
ssl-cert, cpio
Recommends: python
Suggests: procmail, postfix-mysql, postfix-pgsql, postfix-ldap, postfix-pcre,
sasl2-bin, libsasl2-modules, dovecot-common, resolvconf, postfix-cdb,
mail-reader, ufw, postfix-doc
Conflicts: libnss-db (< 2.2-3), mail-transport-agent, smail
Replaces: mail-transport-agent
Provides: mail-transport-agent
Description: High-performance mail transport agent
Postfix is Wietse Venema's mail transport agent that started life as an
alternative to the widely-used Sendmail program. Postfix attempts to be fast,
easy to administer, and secure, while at the same time being sendmail
compatible enough to not upset existing users. Thus, the outside has a
sendmail-ish flavor, but the inside is completely different.
Homepage: http://www.postfix.org/



Postfixインストール前にやっておくこと

ダウンロードサイトの更新

インストール前に、念のためにダウンロードサイト情報を更新しておきます。

aptitude更新コマンド

aptitude update

Exim4のアンインストール

デフォルトでExim4がインストールされている場合があります。
root@debian:/home/user1#} aptitude show exim4
Package: exim4
State: installed

Exim4と関連パッケージをアンインストールしておきます。
root@debian:/home/user1#} aptitude purge exim4-base exim4-config exim4-daemon-light
The following packages will be REMOVED:
exim4{p}
0 packages upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
Need to get 0 B of archives. After unpacking 45.1 kB will be freed.
Do you want to continue? [Y/n/?] Y(もしくはそのままEnter)



Postfixインストールコマンド

aptitude install postfix

root@debian:/home/user1#} aptitude install postfix






インストール後、正常にインストールされたかどうかを
aptitude show postfix で確認。

root@debian:/home/user1# aptitude show postfix
Package: postfix
State: installed



Postfix設定

設定ファイル:/usr/lib/postfix/main.cf を
/etc/postfix/main.cf にコピーします。
root@debian:/home/user1#} cp /usr/lib/postfix/main.cf /etc/postfix/main.cf

/etc/postfix/main.cf を修正します。
root@debian:/home/user1#} vi /etc/postfix/main.cf


mail_owner = postfix
myhostname = debian.(ドメイン名)
mydomain = (ドメイン名)
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
local_recipient_maps = unix:passwd.byname $alias_maps
smtpd_banner = $myhostname ESMTP $mail_name
mynetworks = 127.0.0.0/8,(ローカルのIPアドレス帯)
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
sendmail_path = /usr/sbin/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop

コメント化
#html_directory =
#manpage_directory =
#sample_directory =
#readme_directory =


root@debian:/home/user1#} /etc/init.d/postfix restart
[ ok ] Stopping Postfix Mail Transport Agent: postfix.
[ ok ] Starting Postfix Mail Transport Agent: postfix.

Postfixアンインストールコマンド

aptitude purge postfix

root@debian:/home/user1# aptitude purge postfix
Do you want to continue? [Y/n/?] Y(もしくはそのままEnter)


Postfix起動コマンド

/etc/init.d/postfix start

root@debian:/home/user1# /etc/init.d/postfix start
[ ok ] Starting Postfix Mail Transport Agent: postfix.


postfix停止コマンド

/etc/init.d/postfix stop

root@debian:/home/user1# /etc/init.d/postfix stop
[ ok ] Stopping Postfix Mail Transport Agent: postfix.


postfix動作確認コマンド

telnet 127.0.0.1 25

root@debian:/home/user1# telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 virtual.domain.tld ESMTP Postfix (@@DISTRO@@)

TCPポート25で接続完了。

quit

ログアウト。
















最終更新:2013年05月16日 11:53