环境准备
[root@cobbler-server ~]
total used free shared buff/cache available
Mem: 2.9G 194M 79M 9.1M 2.7G 2.6G
Swap: 3.0G 0B 3.0G
[root@cobbler-server ~]
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 44
model name : Intel(R) Xeon(R) CPU X5650 @ 2.67GHz
stepping : 2
microcode : 0x1f
cpu MHz : 2660.000
cache size : 12288 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 11
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm ssbd ibrs ibpb stibp tsc_adjust arat spec_ctrl intel_stibp flush_l1d arch_capabilities
bogomips : 5320.00
clflush size : 64
cache_alignment : 64
address sizes : 43 bits physical, 48 bits virtual
power management:
[root@localhost ~]
SELinux status: disabled
[root@localhost ~]
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@localhost ~]
CentOS Linux release 7.7.1908 (Core)
[root@localhost ~]
3.10.0-1062.el7.x86_64
[root@localhost ~]
部署cobbler
[root@cobbler-server ~]
[root@cobbler-server ~]
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@cobbler-server ~]
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
cobbler语法检查以及排错
[root@cobbler-server ~]
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/settings must 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
[root@cobbler-server ~]
问题2
[root@cobbler-server ~]
[root@cobbler-server ~]
问题3
[root@cobbler-server ~]
[root@cobbler-server ~]
[root@cobbler-server ~]
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
问题4
[root@cobbler-server ~]
task started: 2020-07-18_123919_get_loaders
task started (id=Download Bootloader Content, time=Sat Jul 18 12:39:19 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
[root@cobbler-server ~]
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
问题6
问题7
[root@cobbler-server ~]
问题8
[root@cobbler-server ~]
修改dhcp模板
[root@cobbler-server ~]
[root@cobbler-server ~]
subnet 10.11.66.0 netmask 255.255.255.0 {
option routers 10.11.66.1;
option domain-name-servers 210.22.84.3;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.11.66.100 10.11.66.254;
default-lease-time 21600;
max-lease-time 43200;
重启服务,再次检查
[root@cobbler-server ~]
[root@cobbler-server ~]
task started: 2020-07-18_131850_sync
task started (id=Sync, time=Sat Jul 18 13:18:50 2020)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout:
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
[root@cobbler-server ~]
The following are potential configuration items that you may want to fix:
1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
Restart cobblerd and then run 'cobbler sync' to apply changes.
[root@cobbler-server ~]
[root@cobbler-server ~]
[root@cobbler-server ~]
[root@cobbler-server ~]
镜像配置
[root@cobbler-server ~]
anaconda-ks.cfg CentOS-7-x86_64-DVD-1908.iso
[root@cobbler-server ~]
[root@cobbler-server ~]
mount: /dev/loop0 is write-protected, mounting read-only
[root@cobbler-server ~]
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 1.5G 0 1.5G 0% /dev
tmpfs tmpfs 1.5G 0 1.5G 0% /dev/shm
tmpfs tmpfs 1.5G 9.0M 1.5G 1% /run
tmpfs tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 26G 6.4G 20G 25% /
/dev/sda1 xfs 1014M 136M 879M 14% /boot
tmpfs tmpfs 301M 0 301M 0% /run/user/0
/dev/loop0 iso9660 4.4G 4.4G 0 100% /mnt/centos7.7
镜像导入
[root@cobbler-server ~]
task started: 2020-07-18_134526_import
task started (id=Media import, time=Sat Jul 18 13:45:26 2020)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64:
creating new distro: CentOS_7.7_1908-x86_64
trying symlink: /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64 -> /var/www/cobbler/links/CentOS_7.7_1908-x86_64
creating new profile: CentOS_7.7_1908-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64 for CentOS_7.7_1908-x86_64
processing repo at : /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64
looking for /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64/repodata
*** TASK COMPLETE ***
[root@cobbler-server ~]
CentOS_7.7_1908-x86_64
[root@cobbler-server ~]
CentOS_7.7_1908-x86_64 config
[root@cobbler-server ~]
Name : CentOS_7.7_1908-x86_64
Architecture : x86_64
TFTP Boot Files : {}
Breed : redhat
Comment :
Fetchable Files : {}
Initrd : /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64/images/pxeboot/initrd.img
Kernel : /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64/images/pxeboot/vmlinuz
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS_7.7_1908-x86_64'}
Management Classes : []
OS Version : rhel7
Owners : ['admin']
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Template Files : {}
kickstarts 文件配置
[root@cobbler-server ~]
[root@cobbler-server kickstarts]
default.ks legacy.ks sample_esx4.ks sample.ks
esxi4-ks.cfg pxerescue.ks sample_esxi4.ks sample_old.seed
esxi5-ks.cfg sample_autoyast.xml sample_esxi5.ks sample.seed
install_profiles sample_end.ks sample_esxi6.ks sample.seed.28
[root@cobbler-server kickstarts]
最小化安装
[root@cobbler-server kickstarts]
lang en_US
keyboard us
timezone Asia/Shanghai
rootpw --iscrypted $default_password_crypted
text
install
url --url=$tree
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part /boot --fstype xfs --size 1024 --ondisk sda
part swap --fstype="swap" --size 2048 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda
auth --useshadow --enablemd5
$SNIPPET('network_config')
reboot
firewall --disabled
selinux --disabled
skipx
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
$SNIPPET('pre_anamon')
%end
%packages
@ base
@ core
sysstat
iptraf
ntp
lrzsz
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
mysql
nmap
screen
%end
%post
systemctl disable postfix.service
%end
图形化安装
install
keyboard 'us'
rootpw --iscrypted $1$m1pE0DG6$vALBphGGynqvUzfJaWZ6U1
url --url="$tree"
lang en_US
firewall --disabled
auth --useshadow --passalgo=sha512
graphical
firstboot --disable
selinux --disabled
network --bootproto=dhcp --device=eth0
network --bootproto=dhcp --device=eth1
reboot
timezone Asia/Shanghai
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part /boot --asprimary --fstype="xfs" --size=1024
part swap --fstype="swap" --size=2048
part / --fstype="xfs" --grow --size=1
%packages
@base
@core
@compat-libraries
@debugging
@development
@gnome-desktop
@X Window System
%end
查看kickstart的配置
[root@cobbler-server kickstarts]
Name : CentOS_7.7_1908-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : CentOS_7.7_1908-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/sample_end.ks
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : ['admin']
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : []
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm
[root@cobbler-server kickstarts]
CentOS_7.7_1908-x86_64
[root@cobbler-server kickstarts]
[root@cobbler-server kickstarts]
[root@cobbler-server kickstarts]
task started: 2020-07-18_141252_sync
task started (id=Sync, time=Sat Jul 18 14:12:52 2020)
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/CentOS_7.7_1908-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/CentOS_7.7_1908-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying files for distro: CentOS_7.7_1908-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/CentOS_7.7_1908-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/CentOS_7.7_1908-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: CentOS_7.7_1908-x86_64
trying hardlink /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/CentOS_7.7_1908-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/CentOS_7.7_1908-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/CentOS_7.7_1908-x86_64/initrd.img
Writing template files for CentOS_7.7_1908-x86_64
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: CentOS_7.7_1908-x86_64
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout:
received on stderr: Redirecting to /bin/systemctl restart dhcpd.service
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
[root@cobbler-server kickstarts]
Kickstart : /var/lib/cobbler/kickstarts/centos7u7-x64.ks
Kickstart Metadata : {}
[root@cobbler-server kickstarts]
[root@cobbler-server kickstarts]
修改启动菜单
[root@cobbler-server ~]
[root@cobbler-server ~]
default
[root@cobbler-server ~]
[root@cobbler-server ~]
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT CentOS_7.7_1908-x86_64
LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
LABEL CentOS_7.7_1908-x86_64
kernel /images/CentOS_7.7_1908-x86_64/vmlinuz
MENU LABEL CentOS_7.7_1908-x86_64
append initrd=/images/CentOS_7.7_1908-x86_64/initrd.img ksdevice=bootif lang=kssendmac text ks=http://10.111.66.218/cblr/svc/op/ks/profile/CentOS_7.7_1908-x86_64
ipappend 2
MENU end
到此,cobber已经配置完成,只需要将机器启动方式改为网络启动即可