1, 配置 chrony 服务, 实现服务器时间自动同步
chrony 服务: 192.168.43.127
其他主机: 192.168.43.106
1, 配置 chrony 服务:
(1)yum 安装 chrony 程序包: yum -y install chrony
(2) 编辑 chrony 配置文件, 添加以下配置;
- VIM /etc/chrony.conf
- server 210.72.145.44 iburst
- allow all
- local stratum 10
启动 chronyd 服务: systemctl start chronyd
设置开机启动服务: systemctl enable chronyd
2, 其他主机向 192.168.43.127 同步时间配置:
安装 chrony:Yum -y install chrony
编辑配置文件, 添加以下配置:
- VIM /etc/chrony.conf
- server 192.168.43.127 iburst
启动 chronyd 服务: systemctl start chronyd
将 chronyd 服置开机启动: systemctl enable chronyd
3, 效果验证:
192.168.43.127 上:
192.168.43.106 上:
2, 实现 cobbler+pxe 自动化装机
1, 安装 cobbler 和 dhcp, 安装 cobbler 同时会将 http 和 tftp 安装, 启动 cobblerd, httpd ,tftp 服务
- [[email protected] ~]#yum -y install cobbler dhcp
- [[email protected] ~]#systemctl start cobblerd httpd tftp
2, 核对 cobbler 当前设置
- [[email protected] ~]#cobbler check
- The following are potential configuration items that you may want to fix:
- 1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
- 2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settingsmust be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
- 3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
- 4 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a recent version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
- 5 : enable and start rsyncd.service with systemctl
- 6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
- 7 : The default password used by the sample templates for newly installed machines (default_password_crypted in/etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt'random-phrase-here''your-password-here'" to generate new one
- 8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
- Restart cobblerd and then run 'cobbler sync' to apply changes.
1, 哪个机器提供 cobbler 配置 cobbler 地址;
2, 配置 tftp 服务器地址;
3,centos7 里第 3 项不设置;
4, 从互联网下载 BootLoader 等启动相关文件;
5, 不启动 ,rsyncd 启动的目的时同步速度快 rsyncd ;
6, 不需要, debian 系列需要;
7, 设置密码, 最小化应答文件中 root 的默认口令,(默认生成的应答文件);
8, 集群使用 (淘汰) fencing;
**3, 修改配置文件:
- VIM /etc/cobbler/settings
- next_server: 192.168.43.147
- server: 192.168.43.147
- default_password_crypted: "$1$Ku5rhKCL$65q7pGIClD.PnJ8MTjsG11"
- ---->
加密口令生成方法:
- [[email protected] ~]#openssl passwd -1
- Password:
- Verifying - Password:
- $1$Ku5rhKCL$65q7pGIClD.PnJ8MTjsG11
- <----
4, 连互联网下载相关文件:
- [[email protected] ~]#cobbler get-loaders
- task started: 2020-03-11_131051_get_loaders
- task started (id=Download Bootloader Content, time=Wed Mar 11 13:10:51 2020)
- downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
- downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
- downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
- downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
- downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
- 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
- *** TASK COMPLETE ***
5, 配置 dhcp:
编辑 cobbler 自己的 dhcp 模板:
- [[email protected] ~]#VIM /etc/cobbler/dhcp.template
- subnet 192.168.43.0 netmask 255.255.255.0 {
- option routers 192.168.43.2;
- option domain-name-servers 192.168.43.2;
- option subnet-mask 255.255.255.0;
- range dynamic-bootp 192.168.43.100 192.168.43.254;
- default-lease-time 21600;
- max-lease-time 43200;
- next-server $next_server;
- class "pxeclients" {
- match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
- if option pxe-system-type = 00:02 {
- filename "ia64/elilo.efi";
- } else if option pxe-system-type = 00:06 {
- filename "grub/grub-x86.efi";
- } else if option pxe-system-type = 00:07 {
- filename "grub/grub-x86_64.efi";
- } else if option pxe-system-type = 00:09 {
- filename "grub/grub-x86_64.efi";
- } else {
- filename "pxelinux.0";
- }
- }
- }
6, 同步文件:
[[email protected] ~]#cobbler sync
此步骤将从互联网下载的文件, 同步到 /var/lib/tftpboot / 下, 文件同步成功:
- [[email protected] ~]#tree /var/lib/tftpboot/
- /var/lib/tftpboot/
├── boot
│?? └── grub
│?? └── menu.lst
├── etc
├── grub
│?? ├── efidefault
│?? ├── grub-x8664.efi
│?? ├── grub-x86.efi
│?? └── images -> ../images
├── images
├── images2
├── memdisk
├── menu.c32
├── ppc
├── pxelinux.0
├── pxelinux.cfg
│?? └── default
├── s390x
│?? └── profilelist
└── yaboot
- [[email protected] mnt]#mount /dev/sr0 /mnt/
- [[email protected] mnt]#cobbler import --path=/mnt --name=cnetos6.10-x86_64 --arch=x86_64
- [[email protected] cobbler]#tree /var/www/cobbler/ -d
- /var/www/cobbler/
- [[email protected] cobbler]#cat /var/lib/tftpboot/pxelinux.cfg/default
- DEFAULT menu
- PROMPT 0
- MENU TITLE Cobbler | http://cobbler.github.io/ https://cobbler.github.io/
- TIMEOUT 200
- TOTALTIMEOUT 6000
- ONTIMEOUT local
- LABEL local
- MENU LABEL (local)
- MENU DEFAULT
- LOCALBOOT -1
- LABEL cnetos6.10-x86_64
- kernel /images/cnetos6.10-x86_64/vmlinuz
- MENU LABEL cnetos6.10-x86_64
- append initrd=/images/cnetos6.10-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.43.147/cblr/svc/op/ks/profile/cnetos6.10-x86_64
- ipappend 2
- MENU end
- [[email protected] kickstarts]#cobbler profile list
- cnetos6.10-x86_64
- [[email protected] kickstarts]#cobbler distro list
- cnetos6.10-x86_64
- [[email protected] ~]#cat /var/lib/tftpboot/pxelinux.cfg/default
- DEFAULT menu
- PROMPT 0
- MENU TITLE Cobbler | http://cobbler.github.io/ https://cobbler.github.io/
- TIMEOUT 200
- TOTALTIMEOUT 6000
- ONTIMEOUT local
- LABEL local
- MENU LABEL (local)
- MENU DEFAULT
- LOCALBOOT -1
- LABEL NeoKylin-x89_64-x86_64
- kernel /images/NeoKylin-x89_64-x86_64/vmlinuz
- MENU LABEL NeoKylin-x89_64-x86_64
- append initrd=/images/NeoKylin-x89_64-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=
- ipappend 2
- > LABEL centos6.10-86_64_mini
- kernel /images/cnetos6.10-x86_64/vmlinuz
- MENU LABEL centos6.10-86_64_mini
- append initrd=/images/cnetos6.10-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.43.147/cblr/svc/op/ks/profile/centos6.10-86_64_mini
- ipappend 2
- LABEL centos7.6-x86_64
- kernel /images/centos7.6-x86_64/vmlinuz
- MENU LABEL centos7.6-x86_64
- append initrd=/images/centos7.6-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=
- ipappend 2
来源: http://www.bubuko.com/infodetail-3459459.html