linux cobbler and chrony use

1. Configure chrony service to realize automatic synchronization of server time.

1. Install chrony on the server and set it to boot.

[root@centos76 ~]#yum install -y chrony

[root@centos76 ~]#systemctl enable --now chronyd

2. Modify /etc/chrony.conf

​ Modify the server to a domestic NTP server, such as Alibaba Cloud, etc., you can set multiple to prevent a single point of failure.

server ntp.aliyun.com  iburst

server ntp1.s1c.time.edu.cn  iburst

​ Domestic NTP server: ntp.aliyun.com, ntp1-7.aliyun.com

​ s1a.time.edu.cn Beijing University of Posts and Telecommunications

​ s1b.time.edu.cn Tsinghua University

​ s1c.time.edu.cn Peking University

​ 210.72.145.44 National Time Service Center Server

​ Remove the # in front of #local stratum 10, if the server cannot connect to the Internet, NTP can also provide services within the LAN.

​ Remove the # before #allow 192.168.0.0/16, and modify the allowed ip address segment, all allowed can be set to allow 0.0.0.0/0.

3. Restart the chrony service.

[root@centos76 ~]#systemctl restart chronyd

4. The client also needs to install chrony, and set the server in /etc/chrony.conf as the server address, and other places do not need to be modified.

5. Test it. After the client sets the wrong time, restart the chrony service to immediately synchronize the time.

[root@centos8 ~]#date -s '1 year'
Fri Dec 24 16:32:54 CST 2021

[root@centos8 ~]#systemctl restart chronyd

[root@centos8 ~]#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               

^* 10.0.0.77                     3   6     7     1    -12us[ +8760h] +/-   29ms

[root@centos8 ~]#date
Thu Dec 24 16:33:13 CST 2020

6. Chrony will automatically synchronize the time every few minutes to ensure that the server time is correct.

[root@centos8 ~]#date
Fri Dec 24 16:43:31 CST 2021
[root@centos8 ~]#date
Fri Dec 24 16:43:33 CST 2021
[root@centos8 ~]#date
Thu Dec 24 16:43:33 CST 2020

2. Realize the automatic installation of cobbler+pxe.

1. Install cobbler and related software, and start the service. Cobbler does not support centos8.

[root@centos7 ~]#yum install dhcp cobbler cobbler-web pykickstart
[root@centos7 ~]#systemctl enable --now cobblerd httpd tftp

2. Run cobbler check and follow the prompts to solve the problems.

1)更改/etc/xinetd.d/tftp配置文件。
[root@centos7 ~]#vim /etc/xinetd.d/tftp
修改disable = yes --> disable = no
[root@centos7 ~]#systemctl restart xinetd
2)联网下载boot引导程序文件。
[root@centos7 ~]#cobbler get-loaders
3)更改/etc/cobbler/settings配置文件的server项为提供cobblerd服务的主机地址,也就是本机地址。
sed -nri 's#server:127.0.0.1#server:10.0.0.77#' /etc/cobbler/settings
4)更改/etc/cobbler/settings配置文件的next_server项,指明tftp服务器地址,使得客户端能够找到TFTP服务器。
[root@centos7 ~]#sed -i.bak 's/next_server: 127.0.0.1/next_server: 10.0.0.77/'
5)更改/etc/cobbler/settings配置文件的选项来使用cobbler管理dhcp服务和tftp服务。
manage_dhcp:1
manage_tftpd:1
配置完成后重启cobbler服务
systemctl restart cobblerd

3. Change the configuration template file of the dhcp service and start the dhcp service.

​ First turn off the dhcp that comes with vmware and all dhcp of other virtual machines to avoid conflicts.

#修改dhcp的模版文件下面的行,用来生成dhcp的配置文件,ip地址段要根据自己实际网段进行设置。
[root@centos7 ~]#vim /etc/cobbler/dhcp.template
subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 10.0.0.2;
option domain-name-servers 10.0.0.2,114.114.114.114;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.0.0.200 10.0.0.240;
[root@centos7 ~]#cobbler sync
[root@centos7 ~]#systemctl start dhcpd

4. Modify the boot menu prompt information (optional) to make the boot menu display personalized information.

[root@centos7 ~]#vim /etc/cobbler/pxe/pxedefault.template

[root@centos7 ~]#cobbler sync

5. Import the installation file of the CentOS system and generate the corresponding YUM source.

​ The iso file of the installation CD must be prepared first.

[root@centos7 ~]#cobbler import --name=centos-7.6-x86_64 --path=/misc/cd --
arch=x86_64

​ After the import is complete, cobbler has generated a minimal installation configuration file. The system root password installed by this file is cobbler.

6. Prepare to install the automatic answer file and associate it with the specified YUM source.

​ Prepare your own kickstart file, you can use system-config-kickstart to generate, this tool centos8 is not provided.

​ There may be Chinese in the generated file, so it must be deleted, otherwise it cannot be used in cobbler.

​ Modify the installation source address line url --url=$tree in the file.

7. Configure the Linux distribution and associate the corresponding ks file.

​ The ks file prepared in advance must be copied to the /var/lib/cobbler/kickstarts directory.

​ The installation content of the configuration file should not exceed the scope of the imported installation file. For example, if only the minimal installation CD is imported, no other software packages should be selected in the configuration file.

[root@centos7 ~]#cobbler profile add --name=wang7 --distro=centos-7.6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks7.cfg
[root@centos7 ~]#systemctl restart cobblerd
[root@centos7 ~]#cobbler sync

8. If you need to start in UEFI mode, you need to modify the configuration file.

[root@centos7 ~]#vim /etc/cobbler/pxe/efidefault.template
修改timeout=0为timeout=20
[root@centos7 ~]#cobbler sync

8. Create a new virtual machine to test.

​ The memory of the new virtual machine is at least 2G, and the size of the hard disk must be larger than the sum of the hard disk partitions in the ks file. The new virtual machine automatically starts from the network card. If you have an existing system, you can quickly press the Esc key when booting, and then choose to start from the network card to start the automatic installation.

linux cobbler and chrony use
linux cobbler and chrony uselinux cobbler and chrony uselinux cobbler and chrony use

Guess you like

Origin blog.51cto.com/15013111/2572354