题1
设置时间同步服务器
[root@use02 ~]# yum install chrony
[root@use02 ~]# vim /etc/chrony.conf
server ntp.aliyun.com iburst
allow 192.168.247.0/24
[root@use02 ~]# systemctl restart chronyd.service
查看端口,123,323
[root@use02 ~]# ss -nlu
State Recv-Q Send-Q Local Address:Port Peer Address:Port
UNCONN 0 0 *:123 *:*
UNCONN 0 0 127.0.0.1:323 *:*
UNCONN 0 0 ::1:323 :::*
设置同步客户端
[root@use03 ~]# yum install chrony
[root@use03 ~]# vim /etc/chrony.conf
server 192.168.247.12 iburst
[root@use03 ~]# systemctl restart chronyd.service
在时间同步服务器上查看客户端
[root@use02 ~]# chronyc
chrony version 3.4
Copyright (C) 1997-2003, 2007, 2009-2018 Richard P. Curnow and others
chrony comes with ABSOLUTELY NO WARRANTY. This is free software, and
you are welcome to redistribute it under certain conditions. See the
GNU General Public License version 2 for details.
chronyc> clients
Hostname NTP Drop Int IntL Last Cmd Drop Int Last
===============================================================================
192.168.247.13 9 0 4 - 13 0 0 - -
补充
server 指定时间同步服务器
iburst 加快同步速度
allow 允许指定地址、或地址段同步
323 客户端端口,123 服务端端口
题2
安装包
[root@use08 ~]# yum install cobbler dhcp -y
生成密码安装系统时root的密码,这个要写入cobbler的配置文件中
[root@use08 ~]# openssl passwd -1
Password:
Verifying - Password:
$1$vXQXv1U3$8rUqsExwxZupL6Qfo2aey.
修改配置文件
[root@use08 ~]# vim /etc/cobbler/settings
next_server: 192.168.247.18
server: 192.168.247.18
default_password_crypted: "$1$vXQXv1U3$8rUqsExwxZupL6Qfo2aey."
manage_dhcp: 1
添加dhcp配置
[root@use08 ~]# cd /etc/dhcp/
[root@use08 dhcp]# ls
dhclient.d dhclient-exit-hooks.d dhcpd6.conf dhcpd.conf scripts
[root@use08 dhcp]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example dhcpd.conf
cp: overwrite ‘dhcpd.conf’? y
[root@use08 dhcp]# vim dhcpd.conf
subnet 192.168.247.0 netmask 255.255.255.0 {
range 192.168.247.100 192.168.247.200;
option routers 192.168.247.2;
next-server 192.168.247.18;
filename "pxelinux.0";
}
下载安装系统所需文件
[root@use08 ~]# cobbler get-loaders
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
同步系统文件,就是把下载的系统文件放入对应位置
[root@use08 ~]# cobbler sync
导入安装光盘
[root@use08 ~]# mount /dev/sr0 /mnt
[root@use08 ~]# cobbler import --path=/mnt --name=centos7.6 --arch=x86_64
准备kickstart文件,具体格式内容可通过system-config-kickstart工具在图形界面上配置
[root@use08 ~]# cp ks.cfg /var/lib/cobbler/kickstarts/ks7.cfg
关联kickstart文件
[root@use08 ~]# cobbler profile add --name centos7.6 --distro=centos7.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks7.cfg
启动服务
启动服务
```bash
[root@use08 ~]# systemctl start cobblerd.service
[root@use08 ~]# systemctl enable cobblerd.service
[root@use08 ~]# systemctl start tftp
[root@use08 ~]# systemctl enable tftp
[root@use08 ~]# systemctl start httpd.service
[root@use08 ~]# systemctl enable httpd.service
[root@use08 dhcp]# systemctl start dhcpd
[root@use08 dhcp]# systemctl enable dhcpd
安装测试
略