第13周

题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

安装测试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

okman312

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值