▲就业班和全程班的小伙伴看这里:(学习老王视频的作业第23-24节)
1、配置chrony服务,实现服务器时间自动同步
1.1 确认chrony服务是否安装
[root@centos7 ~]#rpm -q chrony || yum install -y chrony
chrony-3.2-2.el7.x86_64
1.2 服务器端配置
#vim /etc/chrony.conf
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
#allow 192.168.0.0/16
allow 0.0.0.0/0
……
# Serve time even if not synchronized to a time source.
local stratum 10
:wq
1.3 启动chrony服务并标准时间
#systemctl start chronyd
#systemctl enable chronyd
#chronyc sources -v
1.4 客户端配置
#vim /etc/chrony.conf
server 192.168.253.10 iburst
:wq
#systemctl start chronyd
#systemctl enable chronyd
1.5 客户端校准时间
[root@106 ~]# date +%F_%T
2020-04-10_09:28:57
[root@106 ~]# date -s "+2days"
[root@106 ~]# date +%F_%T
2020-04-12_09:29:13
[root@106 ~]# chronyc sources -v
210 Number of sources = 1
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
==================================================================
^* 192.168.253.10 3 6 377 42 +397us[ +551us] +/- 41ms
[root@106 ~]# date +%F_%T
2020-04-12_09:31:40
2、实现cobbler+pxe自动化装机
一 实验环境:
① 一台DHCP,HTTPD,TFTP服务器(一个网卡,仅主机)
② 一台测试机(一个网卡,仅主机)
③ 关闭仅主机的vmware中dhcp服务
二 实验步骤:
2.1、安装软件
#yum install cobbler dhcp
#systemctl start cobblerd httpd tftp
2.2、编辑cobbler文件
#cobbler check
#vim /etc/cobbler/settings
default_password_crypted: "$1$RFO.hOYF$g79MJdrxFJMgpggQlhjev/"
next_server: 192.168.37.17
manage_dhcp: 1
server: 192.168.37.17
#systemctl restart cobblerd
2.3、配置dhcp服务
#vim /etc/cobbler/dhcp.template
subnet 192.168.37.0 netmask 255.255.255.0 {
option routers 192.168.37.2;
option domain-name-servers 192.168.37.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.37.100 192.168.37.254;
}
#cobbler sync
#systemctl start dhcpd
2.4、下载boot loader 连外网
#cobbler get-loaders
#cobbler sync
2.5、创建yum 源
#cobbler import --path=/misc/cd --name=CentOS7.6-x86_64 --arch=x86_64
#cobbler profile list
#cobbler distro list
2.6、准备ks文件
#cp ks7_mini.cfg /var/lib/cobbler/kickstarts/
#vim /var/lib/cobbler/kickstarts/ks7_mini.cfg
url --url=$tree
#cobbler profile add --name CentOS7.6-x86_64_mini --distro=CentOS7.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks7_mini.cfg
#cobbler profiles remove --name=CentOS7.6-x86_64
2.7、测试安装
2.8、实现web cobbler管理
#yum install cobbler-web (sohu EPEL)sys
#systemctl restart httpd
2.9 Windows系统中 https://192.168.37.17/cobbler_web 登录