0

0

Linux简明系统维护手册(二)

php中文网

php中文网

发布时间:2016-06-21 09:08:34

|

1587人浏览过

|

来源于php中文网

原创

四、主要的软件安装

  前面说过,我的习惯是,装系统的时候就安装一个内核和编译系统,得到了一个干净的系统后,再安装其他的软件就比较清晰。另一点,除非搞不到源代码版本,一般情况下我都会下载官方版本的源代码文件,来重新编译之。同样的,选择软件版本要根据该软件的Release Note来决定,并非越新越好。这就是为什么很多软件都是几个版本齐头并进的发展之原因。这些软件不同版本之间的安装方法会有少许不同,安装前一定要仔细阅读目录中的README文件和INSTALL文件,否则这些少许不同会造成不少得麻烦。下面描述的安装过程都核版本号紧密相关。另外,所有的软件都把程序文件的包拷贝到/usr/local/src目录中再解压缩,这是习惯。因为在Linux中习惯于把后来的软件装在/usr/local中。

  (1)安装DNS服务器

  1、从www.isc.org下载bind 域名服务器软件。我们这里用的是bind8.3.0,bind8分支和bind9分支是并行发展的。根据自己的实际情况选择合适的bind版本。

  2、mkdir /usr/src/bind83

  3、下载的文件叫bind-src.tar.gz,复制到/usr/local/src/bind83目录下。

  4、cd /usr/local/src/bind83

  5、tar zxvf bind-src.tar.gz

  6、cd src

  7、make stdlinks

  8、make clean

  9、make depend

  10、make all

  11、make install

  12、编辑配置文件:/etc/named.conf内容如下,需要更改的部分用黑体标出:


  /*
   * This is a worthless, nonrunnable example of a named.conf file that has
   * every conceivable syntax element in use. We use it to test the parser.
   * It could also be used as a conceptual template for users of new features.
   */

  /*
   * C-style comments are OK
   */

  // So are C++-style comments

  # So are shell-style comments

  // watch out for ";" -- it's important!

  options {
directory "/var/named";
      // use current directory
named-xfer "/usr/libexec/named-xfer";
      // _PATH_XFER
dump-file "named_dump.db";
      // _PATH_DUMPFILE
pid-file "/var/run/named.pid";
      // _PATH_PIDFILE
statistics-file "named.stats";
      // _PATH_STATS
memstatistics-file "named.memstats";
      // _PATH_MEMSTATS
check-names master fail;
check-names slave warn;
check-names response ignore;
host-statistics no;
deallocate-on-exit no;
      // Painstakingly deallocate all
      // objects when exiting instead of
      // letting the OS clean up for us.
      // Useful a memory leak is suspected.
// Final statistics are written to the
// memstatistics-file.
datasize default;
stacksize default;
coresize default;
files unlimited;
recursion yes;
fetch-glue yes;
fake-iquery no;
notify yes;
     // send NOTIFY messages. You can set
// notify on a zone-by-zone
// basis in the "zone" statement
// see (below)
serial-queries 4;
     // number of parallel SOA queries
// we can have outstanding for master
// zone change testing purposes
auth-nxdomain yes;
// always set AA on NXDOMAIN.
// don't set this to 'no' unless
// you know what you're doing -- older
// servers won't like it.
multiple-cnames no;
   // if yes, then a name my have more
// than one CNAME RR. This use
// is non-standard and is not
// recommended, but it is available
// because previous releases supported
// it and it was used by large sites
// for load balancing.
allow-query { any; };
allow-transfer { any; };
transfers-in 10;
     // DEFAULT_XFERS_RUNNING, cannot be
   // set > than MAX_XFERS_RUNNING (20)
transfers-per-ns 2;
// DEFAULT_XFERS_PER_NS
transfers-out 0;
// not implemented
max-transfer-time-in 120;
// MAX_XFER_TIME; the default number
// of minutes an inbound zone transfer
// may run. May be set on a per-zone
// basis.
transfer-format one-answer;
query-source address * port *;
  /*
* The "forward" option is only meaningful if you've defined
* forwarders. "first" gives the normal BIND
* forwarding behavior, i.e. ask the forwarders first, and if that
* doesn't work then do the full lookup. You can also say
* "forward only;" which is what used to be specified with
* "slave" or "options forward-only". "only" will never attempt
   * a full lookup; only the forwarders will be used.
   */
forward first;
forwarders { };
    // default is no forwarders
topology { localhost; localnets; };
    // prefer local nameservers
listen-on port 53 { any; };
    // listen for queries on port 53 on
   // any interface on the system
   // (i.e. all interfaces). The
   // "port 53" is optional; if you
   // don't specify a port, port 53
   // is assumed.
/*
* Interval Timers
*/
cleaning-interval 60;
    // clean the cache of expired RRs
   // every 'cleaning-interval' minutes
interface-interval 60;
    // scan for new or deleted interfaces
   // every 'interface-interval' minutes
statistics-interval 60;
    // log statistics every
   // 'statistics-interval' minutes
maintain-ixfr-base no;
    // If yes, keep transaction log file for IXFR
max-ixfr-log-size 20;
    // Not implemented, maximum size the
   // IXFR transaction log file to grow
  };

  /*
   * Control listeners, for "ndc". Every nameserver needs at least one.
   */
  controls {
inet * port 52 allow { any; };
// a bad idea
unix "/var/run/ndc" perm 0600 owner 0 group 0;
       // the default
  };

  zone "rd.xxx.com" in {
type master;
      // what used to be called "primary"
file "rd.xxx.com.db";
check-names fail;
allow-update { none; };
allow-transfer { any; };
allow-query { any; };
// notify yes;
      // send NOTIFY messages for this
// zone? The global option is used
// if "notify" is not specified
// here.
also-notify { };
      // don't notify any nameservers other
// than those on the NS list for this
// zone
  };

  zone "223.99.211.in-addr.arpa" in {
type master;
// what used to be called "secondary"
file "21.9.22.db";
};

  zone "0.0.127.in-addr.arpa" in {
type master;
file "127.0.0.db";
  };

  zone "." in {
type hint;
       // used to be specified w/ "cache"
file "named.root";
  };

  logging {
/*
* All log output goes to one or more "channels"; you can make as
* many of them as you want.
*/

channel syslog_errors {
      // this channel will send errors or
syslog user;
      // or worse to syslog (user facility)
severity error;
};

category parser {
syslog_errors;
// you can log to as many channels
default_syslog;
     // as you want
};

category lame-servers { null; };
     // don't log these at all

channel moderate_debug {
severity debug 3;
     // level 3 debugging to file
file "foo";
     // foo
print-time yes;
    // timestamp log entries
print-category yes;
     // print category name
print-severity yes;
     // print severity level
/*
* Note that debugging must have been turned on either
* on the command line or with a signal to get debugging
* output (non-debugging output will still be written to
* this channel).
*/
};

/*
* If you don't want to see "zone XXXX loaded" messages but do
* want to see any problems, you could do the following.
*/

channel no_info_messages {
syslog;
severity notice;
};

category load { no_info_messages; };

/*
* You can also define category "default"; it gets used when no
* "category" statement has been given for a category.
*/

category default {
default_syslog;
moderate_debug;
};

};



  13、在/var/named/中生成/etc/named.conf中标记的文件:rd.xxx.com.db,内容如下,需要修改和调整相应部分:
  ;Authoriative data for rd.xxx.com
  ;
  $TTL 3600
  @ IN SOA compaq.rd.xxx.com. tandongyu.rd.xxx.com. (
    20020101 ;Serial
    3600 ;Refresh 1 hour
    900 ;Retry 15 mins
    604800 ;Expire 7 days
    86400) ;Mini 24 hours
  ;Name server NS records
  @ IN NS compaq.rd.xxx.com.
  ;Mail Exchange (MX) records
  rd.xxx.com. IN MX 0 compaq
  ;Address (A) records.
  localhost IN A 127.0.0.1
  compaq IN A 21.9.22.9
  tls65 IN A 21.9.22.8
  fbsd IN A 21.9.22.7




  14、在/var/named/中生成/etc/named.conf中标记的文件:21.9.22.db,内容如下,你需要修改相应部分:


  ;
  ;
  $TTL 3600
  @ IN SOA compaq.rd.xxx.com. tandongyu.rd.xxx.com. (
    20020101 ;Serial
    3600 ;Refresh
    900 ;Retry 15 mins
    604800 ;Expire 7 days
    86400) ;Mini 24 hours
  ;NameServer (NS) records
  @ IN NS compaq.rd.xxx.com.
  ;Address Point to Name (PTR) records
  9 IN PTR compaq.rd.xxx.com.
  8 IN PTR tls65.rd.xxx.com.
  7 IN PTR fbsd.rd.xxx.com.



  15、在/var/named/中生成/etc/named.conf中标记的文件:127.0.0.db,内容如下,你需要修改相应部分:


  ; 0.0.127.in-addr.arpa
  $TTL 3600
  @ IN SOA compaq.rd.xxx.com. tandongyu.rd.xxx.com. (
     20020101;serial
3600 ;refresh
1800 ;retry
604800 ;expiration
3600 ) ;minimum
IN NS compaq.rd.xxx.com.
  1 IN PTR localhost.



  16、在/var/named/中生成/etc/named.conf中标记的文件:named.root,内容大致如下。该文件标记了14个域名服务器。可以从ftp.rs.internic.net获得该文件的最新样本:named.hosts,然后改名成你需要的名字,比如:named.root


  ; This file holds the information on root name servers needed to
  ; initialize cache of Internet domain name servers
  ; (e.g. reference this file in the "cache . "
  ; configuration file of BIND domain name servers).
  ;
  ; This file is made available by InterNIC registration services
  ; under anonymous FTP as
  ; file /domain/named.root
  ; on server FTP.RS.INTERNIC.NET
  ; -OR- under Gopher at RS.INTERNIC.NET
  ; under menu InterNIC Registration Services (NSI)
  ; submenu InterNIC Registration Archives
  ; file named.root
  ;
  ; last update: Aug 22, 1997
  ; related version of root zone: 1997082200
  ;
  ;
  ; formerly NS.INTERNIC.NET
  ;
    . 3600000 IN NS A.ROOT-SERVERS.NET.
    A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
  ;
  ; formerly NS1.ISI.EDU
  ;
    . 3600000 NS B.ROOT-SERVERS.NET.
    B.ROOT-SERVERS.NET. 3600000 A 128.9.0.107
  ;
  ; formerly C.PSI.NET
  ;
    . 3600000 NS C.ROOT-SERVERS.NET.
    C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
  ;
  ; formerly TERP.UMD.EDU
  ;
    . 3600000 NS D.ROOT-SERVERS.NET.
    D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
  ;
  ; formerly NS.NASA.GOV
  ;
    . 3600000 NS E.ROOT-SERVERS.NET.
    E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
  ;
  ; formerly NS.ISC.ORG
  ;
    . 3600000 NS F.ROOT-SERVERS.NET.
    F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
  ;
  ; formerly NS.NIC.DDN.MIL
  ;
    . 3600000 NS G.ROOT-SERVERS.NET.
    G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
  ;
  ; formerly AOS.ARL.ARMY.MIL
  ;
    . 3600000 NS H.ROOT-SERVERS.NET.
    H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
  ;
  ; formerly NIC.NORDU.NET
  ;
    . 3600000 NS I.ROOT-SERVERS.NET.
    I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
  ;
  ; temporarily housed at NSI (InterNIC)
  ;
    . 3600000 NS J.ROOT-SERVERS.NET.
    J.ROOT-SERVERS.NET. 3600000 A 198.41.0.10
  ;
  ; housed in LINX, operated by RIPE NCC
  ;
    . 3600000 NS K.ROOT-SERVERS.NET.
    K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
  ;
  ; temporarily housed at ISI (IANA)
  ;
    . 3600000 NS L.ROOT-SERVERS.NET.
    L.ROOT-SERVERS.NET. 3600000 A 198.32.64.12
  ;
  ; housed in Japan, operated by WIDE
  ;
    . 3600000 NS M.ROOT-SERVERS.NET.
    M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33
  ; End of File



  17、我们还需要配置/etc/resolv.conf、/etc/hosts、/etc/hosts.conf文件以适应新的状况。

  18、一切都结束后,用/usr/sbin/ndc start命令启动bind,同样的可用stop、restart、reload等命令参数操作。

  19、启动后用nslookup命令(有的系统推荐使用dig命令)检验是否正确。如果出现错误,该命令将不能启动。一般的错误都是数据库文件或配置文件笔误所至。比如少个“.”或者文件明不正确等等。

  (2) 安装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)
     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
  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宏编译工具,因为有些带有安全漏洞或过时的宏在编译的时候会有提示,这样以免造成相关安全问题。



本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
全国统一发票查询平台入口合集
全国统一发票查询平台入口合集

本专题整合了全国统一发票查询入口地址合集,阅读专题下面的文章了解更多详细入口。

19

2026.02.03

短剧入口地址汇总
短剧入口地址汇总

本专题整合了短剧app推荐平台,阅读专题下面的文章了解更多详细入口。

27

2026.02.03

植物大战僵尸版本入口地址汇总
植物大战僵尸版本入口地址汇总

本专题整合了植物大战僵尸版本入口地址汇总,前往文章中寻找想要的答案。

15

2026.02.03

c语言中/相关合集
c语言中/相关合集

本专题整合了c语言中/的用法、含义解释。阅读专题下面的文章了解更多详细内容。

3

2026.02.03

漫蛙漫画网页版入口与正版在线阅读 漫蛙MANWA官网访问专题
漫蛙漫画网页版入口与正版在线阅读 漫蛙MANWA官网访问专题

本专题围绕漫蛙漫画(Manwa / Manwa2)官网网页版入口进行整理,涵盖漫蛙漫画官方主页访问方式、网页版在线阅读入口、台版正版漫画浏览说明及基础使用指引,帮助用户快速进入漫蛙漫画官网,稳定在线阅读正版漫画内容,避免误入非官方页面。

13

2026.02.03

Yandex官网入口与俄罗斯搜索引擎访问指南 Yandex中文登录与网页版入口
Yandex官网入口与俄罗斯搜索引擎访问指南 Yandex中文登录与网页版入口

本专题汇总了俄罗斯知名搜索引擎 Yandex 的官网入口、免登录访问地址、中文登录方法与网页版使用指南,帮助用户稳定访问 Yandex 官网,并提供一站式入口汇总。无论是登录入口还是在线搜索,用户都能快速获取最新稳定的访问链接与使用指南。

114

2026.02.03

Java 设计模式与重构实践
Java 设计模式与重构实践

本专题专注讲解 Java 中常用的设计模式,包括单例模式、工厂模式、观察者模式、策略模式等,并结合代码重构实践,帮助学习者掌握 如何运用设计模式优化代码结构,提高代码的可读性、可维护性和扩展性。通过具体示例,展示设计模式如何解决实际开发中的复杂问题。

3

2026.02.03

C# 并发与异步编程
C# 并发与异步编程

本专题系统讲解 C# 异步编程与并发控制,重点介绍 async 和 await 关键字、Task 类、线程池管理、并发数据结构、死锁与线程安全问题。通过多个实战项目,帮助学习者掌握 如何在 C# 中编写高效的异步代码,提升应用的并发性能与响应速度。

2

2026.02.03

Python 强化学习与深度Q网络(DQN)
Python 强化学习与深度Q网络(DQN)

本专题深入讲解 Python 在强化学习(Reinforcement Learning)中的应用,重点介绍 深度Q网络(DQN) 及其实现方法,涵盖 Q-learning 算法、深度学习与神经网络的结合、环境模拟与奖励机制设计、探索与利用的平衡等。通过构建一个简单的游戏AI,帮助学习者掌握 如何使用 Python 训练智能体在动态环境中作出决策。

3

2026.02.03

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
Excel 教程
Excel 教程

共162课时 | 15.3万人学习

Pandas 教程
Pandas 教程

共15课时 | 1万人学习

C# 教程
C# 教程

共94课时 | 8.4万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号