首页 > 系统 > Linux > 正文

如何在Linux下安装Sendmail服务器软件的方法

2020-06-13 12:33:17
字体:
来源:转载
供稿:网友
Sendmail现在是最流行的邮件服务器,那我们来看看如何在Linux下安装Sendmail服务器
 
 

1、从www.sendmail.org下载最新的版本(这个snedmail倒是有必要升级为最新的版本,因为它的升级主要是安全漏洞问题)。这里说明的是用的sendmail-8.12.2.tar.gz 
  2、cd /usr/local/src/ 
  3、把文件下载到:/usr/local/src中 
  4、tar zxvf sendmail-8.12.2.tar.gz 
  5、cd /usr/local/src/sendmail-8.12.2 
  6、chmod go-w / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue 
  7、chown root / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue 
  8、cd /usr/local/src/sendmail-8.12.2/sendmail 
  9、sh Build 
  10、cd /usr/local/src/sendmail-8.12.2/cf/cf 
  11、建立文件sendmail.mc内容如下,你可根据需要修改相应部分。 
  divert(-1) 
  dnl This is the macro config file used to generate the /etc/sendmail.cf 
  dnl file. If you modify thei file you will have to regenerate the 
  dnl /etc/sendmail.cf by running this macro config through the m4 
  dnl preprocessor: 
  dnl m4 /etc/sendmail.mc > /etc/sendmail.cf 
  dnl You will need to have the Sendmail-cf pacage installed for this to work. 
  include(`/usr/local/src/sendmail-8.12.2/cf') 
  define(`confDEF_USER_ID',`8:12') 
  OSTYPE(`linux') 
  undefine(`UUCP_RELAY') 
  undefine(`BITNET_RELAY') 
  define(`confTO_CONNECT', `1m') 
  define(`confTRY_NULL_MX_LIST',true) 
  define(`confDONT_PROBE_INTERFACES',true) 
  define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail') 
  define(`SMART_HOST',compaq.rd.xxx.com) 
  <---这条用于(非HUB)缺省使用HUB发送邮件 
  MASQUERADE_AS(`rd.xxx.com') 
  <------------------------- 
  FEATURE(`masquerade_entire_domain') 
  <---这三条用于邮件地址伪装 
  FEATURE(`masquerade_envelope') 
  <------------------------- 
  FEATURE(`smrsh',`/usr/sbin/smrsh') 
  FEATURE(`mailertable',`hash -o /etc/mail/mailertable') 
  FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable') 
  FEATURE(redirect) 
  FEATURE(always_add_domain) 
  FEATURE(use_cw_file) 
  FEATURE(local_procmail) 
  FEATURE(`access_db') 
  FEATURE(`blacklist_recipients') 
  FEATURE(`accept_unresolvable_domains') 
  MAILER(smtp) 
  MAILER(procmail) 
  dnl We strongly recommend to comment this one out if you want to protect 
  dnl yourself from spam. However, the laptop and users on computers that do 
  dnl not hav 24x7 DNS do need this. 
  dnl FEATURE(`relay_based_on_MX') 
  12、sh Build install-cf 
  13、groupadd smmsp 
  14、useradd smmsp 
  15、cd cd /usr/local/src/sendmail-8.12.2/sendmail 
  16、sh Build install 
  17、cd /usr/local/src/sendmail-8.12.2/makemap 
  18、sh Build clean 
  19、sh Build all 
  20、sh Build install 
  21、cd /usr/local/src/sendmail-8.12.2/ 
  22、在本域DNS主数据库文件中增加MX纪录: 
  rd.xxx.com. IN MX 0 compaq 
  注意修改相应部分。那个0是有几个邮件集中器的时候用于标记先后顺序的。当有好几个MX的时候,建议顺序写为10、20、30… 
  23、在/etc/mail目录下创建access文件,内容类似如下: 
  127.0.0.1 RELAY 
  21.9.22 RELAY 
  211.99.221.238 RELAY 
  然后:makemap hash access.db < access 
  24、创建文件/etc/mail/local-host-names,其内容为本机的拥有的域名信息。 
  rd.xxx.com 
  compaq.rd.xxx.com 
  25、创建文件/etc/mail/aliases,内容类似: 
  MAILER-DAEMON: postmaster 
  postmaster: root 
  bin: root 
  daemon: root 
  nobody: root 
  运行newaliases创建数据库。 
  创建别名文件的意义之一在于当邮件发往域中其他邮件服务器的用户而不是mail HUB用户的时候用。 
  比如增加一条: 
  atan: atan@fbsd 
  则导致邮件发往mail HUB的时候自动转发到atan@fbsd.rd.xxx.com 
  26、启动sendmail: /usr/sbin/sendmail -bd -q30m 
  排错:如果有问题导致启动不了,大部分问题和DNS配置有关,可以使用nslookup检查DNS是否正常。挨个检查/etc/mail中的文件内容也是排错的好办法。另外,修改配置,不建议直接编辑sendmail.cf文件,建议使用m4宏编译工具,因为有些带有安全漏洞或过时的宏在编译的时候会有提示,这样以免造成相关安全问题。 

  通过上面文章,我们应该了解了在Linux下安装Sendmail服务器的方法,希望对你们有帮助!



发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表