邮件服务器、自定义Yum仓库、NTP时间服务器

一、邮件服务器

1、电子邮件服务器的基本功能

为用户提供电子邮箱存储空间(用户名@邮件域名)
处理用户发出的邮件 —— 传递给收件服务器
处理用户收到的邮件 —— 投递到邮箱

在这里插入图片描述

2、安装与配置

虚拟机A:DNS服务器,添加邮件解析功能

1.修改主配置文件

[root@svr7 /]# vim /etc/named.conf
options {
        directory       "/var/named";
};
zone  "qq.com"   IN   {
         type   master;
         file   "qq.com.zone";
};

2.建立地址库文件

[root@svr7 /]# cd    /var/named/
[root@svr7 named]# cp  -p  named.localhost   qq.com.zone
[root@svr7 named]# vim   qq.com.zone
此处省略一万字……..
qq.com.   NS           svr7
svr7         A              192.168.4.7
www        A              1.2.3.4
[root@svr7 named]# systemctl   restart   named   

]# echo  nameserver  192.168.4.7  >  /etc/resolv.conf
]# nslookup    www.qq.com

3.修改地址库文件(指定邮件服务器的解析记录)

[root@svr7 named]# vim   /var/named/qq.com.zone
此处省略一万字……..                    
qq.com.   NS           svr7
qq.com.   MX   10   mail          #数字10为优先级,越小越优先
svr7         A             192.168.4.7
mail         A             192.168.4.7
www        A             192.168.4.200 
]# systemctl   restart   named        
]# echo  nameserver 192.168.4.7   >   /etc/resolv.conf
]# host  -t  MX  qq.com         #测试qq.com区域邮件交换记录
qq.com mail is handled by 10 mail.qq.com.
]# host mail.qq.com              #测试域名完整解析
mail.qq.com has address 192.168.4.7

虚拟机A:邮件服务器
1.安装软件包

[root@svr7 /]# rpm -q postfix
postfix-2.10.1-6.el7.x86_64

2.修改配置文件

[root@svr7 /]# vim  /etc/postfix/main.cf
99  myorigin = qq.com     #默认补全的域名后缀
116 inet_interfaces =  all #本机所有IP地址均提供邮件收发功能
164 mydestination = qq.com    #判断是否为本域邮件的依据

3.重启邮件服务

[root@svr7 /]# systemctl  restart  postfix

4.测试

mail 发信操作: mail -s ‘邮件标题’ -r 发件人 收件人

[root@svr7 /]# useradd    yg
[root@svr7 /]# useradd    xln
[root@svr7 /]# mail   -s    'test01'    -r   yg    xln
hahaxixiehehelele
.                #一行只有一个点表示提交
EOT

mail 收信操作: mail [-u 用户名]

[root@svr7 /]# mail   -u    xln
>N  1  yg@qq.com             Fri Sep 18 17:24  18/510
&  1            #输入邮件编号
&  quit       #退出

]# echo 123456   |   mail   -s   'test02'  -r  yg  xln
]# mail  -u  xln  

二、自定义Yum仓库

将自己下载的RPM包构建为仓库
完美的软件包仓库
1.众多的软件包 2.仓库数据文件(仓库清单)

[root@svr7 ~]# ls  /root
[root@svr7 ~]# tar -xf   /root/tools.tar.gz  -C   /
[root@svr7 ~]# ls  /
[root@svr7 ~]# ls  /tools/
[root@svr7 ~]# ls  /tools/other/

[root@svr7 ~]# createrepo /tools/other/ #生成仓库数据文件
[root@svr7 ~]# ls /tools/other/ 


[root@svr7 ~]# vim /etc/yum.repos.d/mydvd.repo 
[mydvd]
name=centos7
baseurl=file:///mydvd        
enabled=1
gpgcheck=0
[rpm]          #唯一标识 
name=myrpm
baseurl=file:///tools/other #指定Yum仓库的路径
enabled=1
gpgcheck=0
[root@svr7 ~]# yum repolist
[root@svr7 ~]# yum -y install sl
[root@svr7 ~]# yum -y install cmatrix

三、NTP时间服务器

作用:提供标准时间
•Network Time Protocol(网络时间协议)
•它用来同步网络中各个计算机的时间的协议
•210.72.145.39 (国家授时中心服务器IP地址)

•Stratum(分层设计)
•Stratum层的总数限制在15以内(包括15)

虚拟机A:时间服务器

1.安装软件包chrony

[root@svr7 /]# yum  -y  install   chrony
[root@svr7 /]# rpm  -q  chrony

2.修改配置文件

[root@svr7 /]# vim   /etc/chrony.conf      
#server   0.centos.pool.ntp.org   iburst    #与谁同步时间
#server   1.centos.pool.ntp.org   iburst    #iburst表示快速同步
#server   2.centos.pool.ntp.org   iburst
#server   3.centos.pool.ntp.org   iburst
26行  allow   all           #开头的#去掉,修改为允许所有客户端
29行  local  stratum  10     #设置本机为第10层的时间服务器

3.重启时间服务

[root@svr7 /]# systemctl    restart    chronyd

虚拟机B:客户端

1.安装软件包chrony

[root@pc207 /]# yum  -y  install   chrony

2.修改配置文件

[root@pc207 /]# vim   /etc/chrony.conf      
server  192.168.4.7   iburst      #与192.168.4.7同步时间
#server  1.centos.pool.ntp.org  iburst #iburst表示快速同步
#server  2.centos.pool.ntp.org  iburst
#server  3.centos.pool.ntp.org  iburst

3.重启时间服务

[root@pc207 /]# systemctl  restart  chronyd

4.测试

[root@pc207 /]# date   -s   "2008-1-1"      #修改时间
[root@pc207 /]# date
[root@pc207 /]# systemctl   restart   chronyd 
[root@pc207 /]# date
[root@pc207 /]# date
[root@pc207 /]#
[root@pc207 /]# chronyc  sources  -v    #列出时间服务器信息
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是在CentOS 7上搭建NTP时间服务器的步骤: 1.安装NTP软件包 ```shell yum install ntp -y ``` 2.配置NTP服务器 编辑`/etc/ntp.conf`文件,添加如下内容: ```shell # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst # Allow LAN traffic. restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap ``` 其中,`server`行指定了NTP服务器使用的公共时间服务器,`restrict`行指定了允许访问NTP服务器的IP地址范围。 3.启动NTP服务 ```shell systemctl start ntpd ``` 4.设置NTP服务开机自启动 ```shell systemctl enable ntpd ``` 5.检查NTP服务状态 ```shell systemctl status ntpd ``` 如果NTP服务正在运行,则输出类似以下内容: ```shell ● ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-08-10 14:20:20 CST; 1h 5min ago Main PID: 1234 (ntpd) CGroup: /system.slice/ntpd.service └─1234 /usr/sbin/ntpd -u ntp:ntp -g ``` 6.检查NTP服务器是否正常工作 ```shell ntpq -p ``` 如果NTP服务器正常工作,则输出类似以下内容: ```shell remote refid st t when poll reach delay offset jitter ============================================================================== *0.centos.pool. .POOL. 16 p - 64 0 0.000 0.000 0.000 +1.centos.pool. .POOL. 16 p - 64 0 0.000 0.000 0.000 +2.centos.pool. .POOL. 16 p - 64 0 0.000 0.000 0.000 +3.centos.pool. .POOL. 16 p - 64 0 0.000 0.000 0.000 ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值