Cobbler无人值守

cobbler的运行依赖于dhcp、tftp、rsync、dns、http、xinetd服务

cobbler #cobbler程序包
pykickstart #cobbler检查kickstart语法错误
httpd #Apache web服务
dhcp #Dhcp服务
tftp #tftp服务
xinetd #诸多服务的超级守护进程

配置文件目录 /etc/cobbler

/etc/cobbler #配置文件目录
/etc/cobbler/settings #cobbler主配置文件
/etc/cobbler/dhcp.template #DHCP服务的配置模板
/etc/cobbler/tftpd.template #tftp服务的配置模板
/etc/cobbler/rsync.template #rsync服务的配置模板
/etc/cobbler/iso #iso模板配置文件目录
/etc/cobbler/pxe #pxe模板文件目录
/etc/cobbler/power #电源的配置文件目录
/etc/cobbler/users.conf #web服务授权配置文件
/etc/cobbler/users.digest #web访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template #DNS服务的配置模板
/etc/cobbler/modules.conf #Cobbler模块配置文件

Cobbler数据目录

/var/lib/cobbler
/var/lib/cobbler/config #配置文件
/var/lib/cobbler/kickstarts #默认存放kickstart文件
/var/lib/cobbler/loaders #存放的各种引导程序
/var/www/cobbler #系统安装镜像目录
/var/www/cobbler/ks_mirror #导入的系统镜像列表,cobbler distro文件目录
/var/www/cobbler/images #导入的系统镜像启动文件
/var/www/cobbler/repo_mirror #yum源存储目录

日志目录

/var/log/cobbler
/var/log/cobbler/install.log #客户端系统安装日志
/var/log/cobbler/cobbler.log #cobbler日志

环境

[root@m01 ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 
[root@m01 ~]# uname -a
Linux m01 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@m01 ~]# curl -s -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@m01 ~]# curl -s -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@m01 ~]# getenforce 
Disabled
[root@m01 ~]# systemctl status firewalld.service 
● 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@m01 ~]# ifconfig eth0
eth0: flags=4163  mtu 1500
        inet 10.0.0.61  netmask 255.255.255.0  broadcast 10.0.0.255
        inet6 fe80::20c:29ff:fe1c:6e7f  prefixlen 64  scopeid 0x20
        ether 00:0c:29:1c:6e:7f  txqueuelen 1000  (Ethernet)
        RX packets 22627  bytes 24506454 (23.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11245  bytes 1357860 (1.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

yum方式安装相关组件包

yum install -y httpd tftp dhcp cobbler pykickstart xinetd

[root@m01 ~]# yum install -y httpd tftp dhcp cobbler pykickstart xinetd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
(1/2): extras/7/x86_64/primary_db                                                                                                                | 188 kB  00:00:02     
(2/2): updates/7/x86_64/primary_db                                                                                                               | 4.2 MB  00:00:04     
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
The program yum-complete-transaction is found in the yum-utils package.
……………………………………………………………………………………………………………………………………………………………部分省略……………………………………………………………………………………………………………………………………………………………………………
Installed:
  cobbler.x86_64 0:2.8.4-4.el7  dhcp.x86_64 12:4.2.5-68.el7.centos.1 httpd.x86_64 0:2.4.6-89.el7.centos pykickstart.noarch 0:1.99.66.19-2.el7 tftp.x86_64 0:5.2-22.el7
  xinetd.x86_64 2:2.3.15-13.el7

Dependency Installed:
  PyYAML.x86_64 0:3.10-11.el7                          createrepo.noarch 0:0.9.9-28.el7                 deltarpm.x86_64 0:3.6-3.el7                                     
  genisoimage.x86_64 0:1.1.11-25.el7                   httpd-tools.x86_64 0:2.4.6-89.el7.centos         jbigkit-libs.x86_64 0:2.0-11.el7                                
  libtiff.x86_64 0:4.0.3-27.el7_3                      libusal.x86_64 0:1.1.11-25.el7                   libwebp.x86_64 0:0.3.0-7.el7                                    
  libyaml.x86_64 0:0.1.4-11.el7_0                      mailcap.noarch 0:2.1.41-2.el7                    mod_wsgi.x86_64 0:3.4-18.el7                                    
  mtools.x86_64 0:4.0.18-5.el7                         python-backports.x86_64 0:1.0-8.el7              python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7      
  python-chardet.noarch 0:2.2.1-1.el7_1                python-cheetah.x86_64 0:2.4.4-5.el7.centos       python-deltarpm.x86_64 0:3.6-3.el7                              
  python-ipaddress.noarch 0:1.0.16-2.el7               python-kitchen.noarch 0:1.1.1-5.el7              python-netaddr.noarch 0:0.7.5-9.el7                             
  python-pillow.x86_64 0:2.0.0-19.gitd1c6db8.el7       python-pygments.noarch 0:1.4-10.el7              python-setuptools.noarch 0:0.9.8-7.el7                          
  python2-markdown.noarch 0:2.4.1-4.el7                python2-pyyaml.noarch 0:3.10-0.el7               python2-simplejson.x86_64 0:3.10.0-2.el7                        
  syslinux.x86_64 0:4.05-15.el7                        tftp-server.x86_64 0:5.2-22.el7                  yum-utils.noarch 0:1.1.31-50.el7                                

Complete!

配置DHCP服务

[root@m01 ~]# cat /etc/dhcp/dhcpd.conf 
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#
subnet 10.0.0.0 netmask 255.255.255.0 {
  range 10.0.0.200 10.0.0.220;
  default-lease-time 600;
  max-lease-time 7200;
  filename "pxelinux.0";
}
[root@m01 ~]# systemctl restart  dhcpd
[root@m01 ~]# systemctl enable dhcpd
[root@m01 ~]# cat /etc/cobbler/dhcp.template 
……………………………………………………………………………………………………………………………………………………………部分省略……………………………………………………………………………………………………………………………………………………………………………
subnet 10.0.0.0 netmask 255.255.255.0 {      
     option routers             10.0.0.254;
     option domain-name-servers 223.5.5.5;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        10.0.0.200 10.0.0.220;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

     }
……………………………………………………………………………………………………………………………………………………………部分省略……………………………………………………………………………………………………………………………………………………………………………

配置tftp服务

[root@m01 ~]# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#   protocol.  The tftp protocol is often used to boot diskless \
#   workstations, download configuration files to network-aware printers, \
#   and to start the installation process for some operating systems.
service tftp
{
    socket_type     = dgram
    protocol        = udp
    wait            = yes
    user            = root
    server          = /usr/sbin/in.tftpd
    server_args     = -s /var/lib/tftpboot
    disable         = no ######将默认的'yes'改为'no'
    per_source      = 11
    cps         = 100 2
    flags           = IPv4
[root@m01 ~]# systemctl restart xinetd.service 
[root@m01 ~]# systemctl enable xinetd.service 
[root@m01 ~]# systemctl restart httpd 
[root@m01 ~]# systemctl enable httpd
[root@m01 ~]# systemctl restart cobblerd
[root@m01 ~]# systemctl enable cobblerd 
[root@m01 ~]# sed -i 's#manage_dhcp: 0#manage_dhcp: 1#g' /etc/cobbler/settings 

配置cobbler

运行cobbler chec得出以下提示

[root@m01 ~]# 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/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 : 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.
4 : enable and start rsyncd.service with systemctl
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : 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
7 : 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文件默认是127.0.0.1本地回环地址,需要更改为提供cobbler服务的ip地址 10.0.0.61,在384行
sed -i 's#server: 127.0.0.1#server: 10.0.0.61#g' /etc/cobbler/settings

[root@m01 ~]# sed -i 's#server: 127.0.0.1#server: 10.0.0.61#g' /etc/cobbler/settings

问题2

netx_server也是默认本地127.0.0.1回环地址,需要修改为提供cobbler服务的ip地址 192.163.182,128,在272行
sed -i 's#next_server: 127.0.0.1#next_server: 10.0.0.61#g' /etc/cobbler/settings

[root@m01 ~]# sed -i 's#next_server: 127.0.0.1#next_server: 10.0.0.61#g' /etc/cobbler/settings

问题3

提示让执行cobbler get-loaders命令,执行下就好了。(可以忽略)

[root@m01 ~]# cobbler get-loaders
task started: 2019-05-03_132702_get_loaders
task started (id=Download Bootloader Content, time=Fri May  3 13:27:02 2019)
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 ***

问题4

启动rsyncd服务

[root@m01 ~]# systemctl start rsyncd
[root@m01 ~]# systemctl enable rsyncd
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.

问题5

提示没有安装debmirror包,需要管理debian部署和存储库(可以忽略)

问题6

提示更改密码

[root@m01 ~]# openssl passwd -1 -salt "123" "123456"
$1$123$7mft0jKnzzvAdU4t0unTG1
并把把新生成的密码写入到/etc/cobbler/settings中,所处101行
default_password_crypted: "$1$123$7mft0jKnzzvAdU4t0unTG1"

问题7

可以忽略

以上问题解决完成后需要同步和重启服务

[root@m01 ~]# systemctl restart  cobblerd.service 
[root@m01 ~]# cobbler sync
task started: 2019-05-03_133401_sync
task started (id=Sync, time=Fri May  3 13:34:01 2019)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
trying hardlink /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
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 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 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@m01 ~]# systemctl restart cobblerd.service 
[root@m01 ~]# systemctl enable cobblerd.service
[root@m01 ~]# systemctl restart httpd.service 
[root@m01 ~]# systemctl enable httpd.service 

再次检查是否完成更改

[root@m01 ~]# cobbler check
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
2 : 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.

磁盘挂载并导入

[root@m01 ~]# mount /dev/cdrom  /mnt
mount: /dev/sr0 is write-protected, mounting read-only
[root@m01 ~]# cobbler import --path=/mnt --name=CentOS7.6
task started: 2019-05-03_134203_import
task started (id=Media import, time=Fri May  3 13:42:03 2019) ######此处需要较长的一个时间
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/CentOS7.6:
creating new distro: CentOS7.6-x86_64
trying symlink: /var/www/cobbler/ks_mirror/CentOS7.6 -> /var/www/cobbler/links/CentOS7.6-x86_64
creating new profile: CentOS7.6-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/CentOS7.6 for CentOS7.6-x86_64
processing repo at : /var/www/cobbler/ks_mirror/CentOS7.6
need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS7.6
looking for /var/www/cobbler/ks_mirror/CentOS7.6/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS7.6/repodata
*** TASK COMPLETE ***

查看导入结果

[root@m01 ~]#  cobbler distro list
   CentOS7.6-x86_64
[root@m01 ~]# cobbler profile list
   CentOS7.6-x86_64
distro : 发行版, 就是我们安装什么版本的linux操作系统的名称 一会我们会导入一个 distro.
profile : 类似于一个 配置文件,类似于你的 bash_profile, 里面包含你可以添加 kernel 参数,对应的kickstart 文件 以及 此profile 对应的 distro 等等.

准备kickstart文件

在root目录下找到ks文件,并移动到/var/lib/cobbler/kickstarts/到目录下改名为ks.cfg或者使用下面的
CentOS6:

#Kickstart Configurator for cobbler by Jason Zhao
#platform=x86, AMD64, or Intel EM64T
key --skip
#System  language
lang en_US
#System keyboard
keyboard us
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $default_password_crypted
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
url --url=http://10.0.0.61/cobbler/ks_mirror/*      #这里需要更改为repodata所在的http地址
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype ext4 --size 1024 --ondisk sda
part swap --size 16384 --ondisk sda
part / --fstype ext4 --size 1 --grow --ondisk sda
#System authorization infomation
auth  --useshadow  --enablemd5
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=em1 --onboot=on
#Reboot after installation
reboot
#Firewall configuration
firewall --disabled
#SELinux configuration
selinux --disabled
#Do not configure XWindows
skipx
#Package install information
%packages
@ base
@ chinese-support
@ core
sysstat
iptraf
ntp
e2fsprogs-devel
keyutils-libs-devel
krb5-devel
libselinux-devel
libsepol-devel
lrzsz
ncurses-devel
openssl-devel
zlib-devel
OpenIPMI-tools
mysql
lockdev
minicom
nmap

%post
#/bin/sed -i 's/#Protocol 2,1/Protocol 2/' /etc/ssh/sshd_config
/bin/sed  -i 's/^ca::ctrlaltdel:/#ca::ctrlaltdel:/' /etc/inittab
/sbin/chkconfig --level 3 diskdump off
/sbin/chkconfig --level 3 dc_server off
/sbin/chkconfig --level 3 nscd off
/sbin/chkconfig --level 3 netfs off
/sbin/chkconfig --level 3 psacct off
/sbin/chkconfig --level 3 mdmpd off
/sbin/chkconfig --level 3 netdump off
/sbin/chkconfig --level 3 readahead off
/sbin/chkconfig --level 3 wpa_supplicant off
/sbin/chkconfig --level 3 mdmonitor off
/sbin/chkconfig --level 3 microcode_ctl off
/sbin/chkconfig --level 3 xfs off
/sbin/chkconfig --level 3 lvm2-monitor off
/sbin/chkconfig --level 3 iptables off
/sbin/chkconfig --level 3 nfs off
/sbin/chkconfig --level 3 ipmi off
/sbin/chkconfig --level 3 autofs off
/sbin/chkconfig --level 3 iiim off
/sbin/chkconfig --level 3 cups off
/sbin/chkconfig --level 3 openibd off
/sbin/chkconfig --level 3 saslauthd off
/sbin/chkconfig --level 3 ypbind off
/sbin/chkconfig --level 3 auditd off
/sbin/chkconfig --level 3 rdisc off
/sbin/chkconfig --level 3 tog-pegasus off
/sbin/chkconfig --level 3 rpcgssd off
/sbin/chkconfig --level 3 kudzu off
/sbin/chkconfig --level 3 gpm off
/sbin/chkconfig --level 3 arptables_jf off
/sbin/chkconfig --level 3 dc_client off
/sbin/chkconfig --level 3 lm_sensors off
/sbin/chkconfig --level 3 apmd off
/sbin/chkconfig --level 3 sysstat off
/sbin/chkconfig --level 3 cpuspeed off
/sbin/chkconfig --level 3 rpcidmapd off
/sbin/chkconfig --level 3 rawdevices off
/sbin/chkconfig --level 3 rhnsd off
/sbin/chkconfig --level 3 nfslock off
/sbin/chkconfig --level 3 winbind off
/sbin/chkconfig --level 3 bluetooth off
/sbin/chkconfig --level 3 isdn off
/sbin/chkconfig --level 3 portmap off
/sbin/chkconfig --level 3 anacron off
/sbin/chkconfig --level 3 irda off
/sbin/chkconfig --level 3 NetworkManager off
/sbin/chkconfig --level 3 acpid off
/sbin/chkconfig --level 3 pcmcia off
/sbin/chkconfig --level 3 atd off
/sbin/chkconfig --level 3 sendmail off
/sbin/chkconfig --level 3 haldaemon off
/sbin/chkconfig --level 3 smartd off
/sbin/chkconfig --level 3 xinetd off
/sbin/chkconfig --level 3 netplugd off
/sbin/chkconfig --level 3 readahead_early off
/sbin/chkconfig --level 3 xinetd off
/sbin/chkconfig --level 3 ntpd on
/sbin/chkconfig --level 3 avahi-daemon off
/sbin/chkconfig --level 3 ip6tables off
/sbin/chkconfig --level 3 restorecond off
/sbin/chkconfig --level 3 postfix off

CentOS7:

#Kickstart Configurator for cobbler by Jason Zhao
#platform=x86, AMD64, or Intel EM64T
#System  language
lang en_US
#System keyboard
keyboard us
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $default_password_crypted
#Use text mode install
text
#Install OS instead of upgrade
install
#Use NFS installation Media
url --url=http://10.0.0.61/cobbler/ks_mirror/CentOS7.6/ #这里需要更改为repodata所在的http地址
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype xfs --size 1024 --ondisk sda
part swap --size 16384 --ondisk sda
part / --fstype xfs --size 1 --grow --ondisk sda
#System authorization infomation
auth  --useshadow  --enablemd5
#Network information
$SNIPPET('network_config')
#network --bootproto=dhcp --device=em1 --onboot=on
# Reboot after installation
reboot
#Firewall configuration
firewall --disabled
#SELinux configuration
selinux --disabled
#Do not configure XWindows
skipx
#Package install information
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$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

主机名默认是localhost
修改方式,在配置文件中添加
network --hostname=test
修改网卡名称从eth0开始技术 ######CentOS7默认是ens33开始计数,

[root@m01 ~]# cobbler profile edit --name=CentOS7.6-x86_64 --kopts='net.ifnames=0 biosdevname=0' --kickstart=/var/lib/cobbler/kickstarts/ks.cfg
[root@m01 ~]# cobbler profile report CentOS7.6-x86_64
Name                           : CentOS7.6-x86_64
TFTP Boot Files                : {}
Comment                        : 
DHCP Tag                       : default
Distribution                   : CentOS7.6-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {'biosdevname': '0', 'net.ifnames': '0'}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/ks.cfg
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : ['admin']
Parent Profile                 : 
Internal proxy                 : 
Red Hat Management Key         : <>
Red Hat Management Server      : <>
Repos                          : []
Server Override                : <>
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

选择相应操作系统回车执行下一步

image

等待自动安装结束

装机页面自定义

[root@m01 ~]# cat /etc/cobbler/pxe/pxedefault.template
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.io/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT $pxe_timeout_profile

LABEL local
        MENU LABEL (local)
        MENU DEFAULT
        LOCALBOOT -1

$pxe_menu_items

MENU end

修改完配置文件后一定要执行 cobbler sync

根据MAC地址设置固定IP

[root@m01 ~]# cobbler system add --name=test --mac=00:50:56:29:32:09 --profile=CentOS7.6 --ip-address=10.0.0.200 subnet=255.255.255.0 --gateway=10.0.0.254 --interface=eth0 --static=1 --hostname=nginx 
设置完成后curl http://10.0.0.61/cblr/svc/op/ks/system/test 得到ks配置文件

建议内存大于3G否则可能会产生不可预知的错误

你可能感兴趣的:(Cobbler无人值守)