2013年11月28日木曜日

Ubuntu 12.x Postfixとmailコマンドのインストール

Postfixのインストール

下記の例では、apt-getコマンドを使用してPostfixをインストールしています。

root@Ubuntu12:~# apt-get install postfix
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  ssl-cert
Suggested packages:
  procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre sasl2-bin dovecot-common postfix-cdb mail-reader postfix-doc openssl-blacklist
The following NEW packages will be installed:
  postfix ssl-cert
0 upgraded, 2 newly installed, 0 to remove and 65 not upgraded.
Need to get 1,287 kB of archives.
After this operation, 3,278 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://jp.archive.ubuntu.com/ubuntu/ precise-updates/main ssl-cert all 1.0.28ubuntu0.1 [12.3 kB]
Get:2 http://jp.archive.ubuntu.com/ubuntu/ precise-updates/main postfix i386 2.9.6-1~12.04.1 [1,274 kB]
Fetched 1,287 kB in 1s (1,021 kB/s)
Preconfiguring packages ...
~中略~
/etc/aliases does not exist, creating it.
WARNING: /etc/aliases exists, but does not have a root alias.

Postfix is now set up with a default configuration.  If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
 * Stopping Postfix Mail Transport Agent postfix   [ OK ]
 * Starting Postfix Mail Transport Agent postfix   [ OK ]
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
root@Ubuntu12:~# /etc/init.d/postfix status
 * postfix is running

mailコマンドのインストール (mailutils)

root@Ubuntu12:~# mail -s "Mail Testing" user@ubuntu.xxx
The program 'mail' is currently not installed.  You can install it by typing:
apt-get install mailutils

標準では、mailコマンドが存在しないのでインストールします。
mailコマンドは、mailutilsから取得出来ます。
apt-getまたはaptitudeコマンドでインストールして下さい。

root@Ubuntu12:~# apt-get install mailutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  guile-1.8-libs libgsasl7 libltdl7 libmailutils2 libmysqlclient18 libntlm0 mysql-common
Suggested packages:
  mailutils-mh
The following NEW packages will be installed:
  guile-1.8-libs libgsasl7 libltdl7 libmailutils2 libmysqlclient18 libntlm0 mailutils mysql-common
0 upgraded, 8 newly installed, 0 to remove and 65 not upgraded.
Need to get 3,153 kB of archives.
After this operation, 11.5 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://jp.archive.ubuntu.com/ubuntu/ precise/main libltdl7 i386 2.4.2-1ubuntu1 [38.1 kB]
Get:2 http://jp.archive.ubuntu.com/ubuntu/ precise-updates/main mysql-common all 5.5.34-0ubuntu0.12.04.1 [13.3 kB]
Get:3 http://jp.archive.ubuntu.com/ubuntu/ precise-updates/main libmysqlclient18 i386 5.5.34-0ubuntu0.12.04.1 [922 kB]
Get:4 http://jp.archive.ubuntu.com/ubuntu/ precise/main guile-1.8-libs i386 1.8.8+1-6ubuntu2 [755 kB]
Get:5 http://jp.archive.ubuntu.com/ubuntu/ precise/universe libntlm0 i386 1.2-1 [18.4 kB]
Get:6 http://jp.archive.ubuntu.com/ubuntu/ precise/universe libgsasl7 i386 1.6.1-1 [133 kB]
Get:7 http://jp.archive.ubuntu.com/ubuntu/ precise/universe libmailutils2 i386 1:2.2+dfsg1-5 [872 kB]
Get:8 http://jp.archive.ubuntu.com/ubuntu/ precise/universe mailutils i386 1:2.2+dfsg1-5 [401 kB]
Fetched 3,153 kB in 2s (1,212 kB/s)
Selecting previously unselected package libltdl7.
(Reading database ... 51954 files and directories currently installed.)
Unpacking libltdl7 (from .../libltdl7_2.4.2-1ubuntu1_i386.deb) ...
Selecting previously unselected package mysql-common.
Unpacking mysql-common (from .../mysql-common_5.5.34-0ubuntu0.12.04.1_all.deb) ...
Selecting previously unselected package libmysqlclient18.
Unpacking libmysqlclient18 (from .../libmysqlclient18_5.5.34-0ubuntu0.12.04.1_i386.deb) ...
Selecting previously unselected package guile-1.8-libs.
Unpacking guile-1.8-libs (from .../guile-1.8-libs_1.8.8+1-6ubuntu2_i386.deb) ...
Selecting previously unselected package libntlm0.
Unpacking libntlm0 (from .../libntlm0_1.2-1_i386.deb) ...
Selecting previously unselected package libgsasl7.
Unpacking libgsasl7 (from .../libgsasl7_1.6.1-1_i386.deb) ...
Selecting previously unselected package libmailutils2.
Unpacking libmailutils2 (from .../libmailutils2_1%3a2.2+dfsg1-5_i386.deb) ...
Selecting previously unselected package mailutils.
Unpacking mailutils (from .../mailutils_1%3a2.2+dfsg1-5_i386.deb) ...
Processing triggers for man-db ...
Setting up libltdl7 (2.4.2-1ubuntu1) ...
Setting up mysql-common (5.5.34-0ubuntu0.12.04.1) ...
Setting up libmysqlclient18 (5.5.34-0ubuntu0.12.04.1) ...
Setting up guile-1.8-libs (1.8.8+1-6ubuntu2) ...
Setting up libntlm0 (1.2-1) ...
Setting up libgsasl7 (1.6.1-1) ...
Setting up libmailutils2 (1:2.2+dfsg1-5) ...
Setting up mailutils (1:2.2+dfsg1-5) ...
update-alternatives: using /usr/bin/frm.mailutils to provide /usr/bin/frm (frm) in auto mode.
update-alternatives: using /usr/bin/from.mailutils to provide /usr/bin/from (from) in auto mode.
update-alternatives: using /usr/bin/messages.mailutils to provide /usr/bin/messages (messages) in auto mode.
update-alternatives: using /usr/bin/movemail.mailutils to provide /usr/bin/movemail (movemail) in auto mode.
update-alternatives: using /usr/bin/readmsg.mailutils to provide /usr/bin/readmsg (readmsg) in auto mode.
update-alternatives: using /usr/bin/dotlock.mailutils to provide /usr/bin/dotlock (dotlock) in auto mode.
update-alternatives: using /usr/bin/mail.mailutils to provide /usr/bin/mailx (mailx) in auto mode.
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
root@Ubuntu12:~# mail -s 'Email Testing' user@ubuntu.xxx
Cc:
Null message body; hope that's ok