歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

linux配置mail server

linux配置mail server   一、配置yum安裝工具 ①  進入yum目錄   [root@bj ~]# cd /etc/yum.repos.d   ②  配置yum.repo   [root@bj yum.repos.d]# cprhel-debuginfo.repo yum.repo   將yum.repo修改成以下內容   [root@bj yum.repos.d]# cat yum.repo   [Base]   name=Red Hat Enterprise Linux   baseurl=file:///media/Server   enabled=1   gpgcheck=0   gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release   ③  把光盤掛載到/media目錄上   [root@bj ~]# mount /dev/cdrom /media/   二、通過yum安裝sendmail、dovecot [root@bj ~]# yum install -y sendmail*   ----sendmail 負責發送郵件(smtp 協議 ,port 25)   [root@bj ~]# yum install -y dovecot*   ----dovecot 負責接收郵件(pop3 協議,port 110,imap 協議 ,port 143)   三、配置sendmail ①   cd /etc/mail       m4  sendmail.cf > sendmail.mc   ②  vi sendmail.mc     ----查找127.0.0.1,將其改為0.0.0.0(默認sendmail只負責發送本地郵件,0.0.0.0將監聽任何地址的郵件)   ③  啟動sendmail服務   1、修改/etc/hosts   192.168.6.130   bj.siqian.com (主機名設為主機名.域名的方式,否則收不到郵件)   2、修改/etc/sysconfig/network      hostname=bj.siqian.com   3、然後再執行      hostname  bj.siqian.com   4、啟動sendmail        service sendmail start   5、查看smtp   [root@bj ~]# netstat -an | grep :25   tcp       0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN   ④  配置郵件接收   [root@bj ~]# vi /etc/dovecot.conf   把其中的:       #protocols = imap pop3 lmtp       ----取消注釋,改為       protocols = imap pop3 lmtp   ⑤  啟動dovecot服務   service  dovecotstart   -----查看 pop3,imap   [root@bj ~]# netstat -an | grep :110   tcp        0     0 :::110                   :::*                        LISTEN   四、收發郵件 ①寫郵件,發送郵件   [root@bj ~]# mail -s "oracle"oracle   test mail for oracle!!!   Cc: root   抄送功能為快捷鍵ctl+d   ②接收郵件   [root@bj ~]# mail   Mail version 8.1 6/6/93.  Type ? for help.   "/var/spool/mail/root": 5messages 5 new   >N 1 [email protected]  Thu Feb 2119:21  43/1563  "Logwatch for node1 (Linux)"    N  [email protected]  Fri Feb 2213:08  93/2804  "Logwatch for node1 (Linux)"    N  [email protected]  Mon Jul 1515:08  95/2901  "Logwatch for bj (Linux)"    N  [email protected]  Mon Jul 1515:32  54/1936  "Logwatch for bj.siqian.com(Linux)"    N  [email protected]      Mon Jul 1516:21  17/557   "oracle"   & 5   Message 5:   From [email protected]  Mon Jul 15 16:21:14 2013   Date: Mon, 15 Jul 2013 16:21:14 +0800   From: root <[email protected]>   To: [email protected]   Subject: oracle   Cc: [email protected]       test mail for oracle!!!   再換oracle用戶查看郵件   [root@bj mqueue]# su - oracle   [oracle@bj ~]$ mail   Mail version 8.1 6/6/93.  Type ? for help.   "/var/spool/mail/oracle": 1message 1 new   >N 1 [email protected]      Mon Jul15 16:21  17/557   "oracle"   & 1   Message 1:   From [email protected]  Mon Jul 15 16:21:14 2013   Date: Mon, 15 Jul 2013 16:21:14 +0800   From: root <[email protected]>   To: [email protected]   Subject: oracle   Cc: [email protected]   test mail for oracle!!!
Copyright © Linux教程網 All Rights Reserved