自动安装部署,局域网不能有多个DHCP,虚拟机网卡-cobbler网络类型,cobbler sync
一、cobbler服务器信息
[root@controller ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [root@controller ~]# getenforce Disabled [root@controller ~]# systemctl status firewalld ● 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@controller ~]# ifconfig eno16777736|awk -F "[ :]+" 'NR==2 {print $3}' 192.168.153.11 [root@controller ~]# hostname controller.www.local
二、安装epel源和cobbler相关包
[root@controller ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm [root@controller ~]# yum install cobbler cobbler-web dhcp tftp-server pykickstart httpd python-ctypes xinetd -y [root@controller ~]# systemctl restart httpd [root@controller ~]# systemctl start cobblerd [root@controller ~]# systemctl enable httpd [root@controller ~]# systemctl enable cobblerd [root@controller ~]# systemctl status httpd [root@controller ~]# systemctl status cobblerd
三、cobbler配置
1、cobbler check检查并处理。
[root@controller ~]# cobbler checkThe 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步和第2步: [root@controller ~]# vi /etc/cobbler/settings server: 192.168.153.11 next_server: 192.168.153.11 manage_dhcp: 1 解决第3步: [root@controller ~]# vi /etc/xinetd.d/tftp disable = no 解决第4步: [root@controller ~]# cobbler get-loaders task started: 2018-03-31_155437_get_loaders task started (id=Download Bootloader Content, time=Sat Mar 31 15:54:37 2018) 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@controller ~]# systemctl start rsyncd [root@controller ~]# systemctl enable rsyncd Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service. 解决第7步: [root@controller ~]# openssl passwd -1 -salt 'suijizhi' 'gxm' $1$suijizhi$7RpWQlgtVB8T8vrrCmV7v. default_password_crypted: "$1$suijizhi$7RpWQlgtVB8T8vrrCmV7v." [root@controller ~]# systemctl restart cobblerd [root@controller ~]# 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. 这2个可以不解决,如果要解决用下面的命令安装,不过安装后再check又有其他提示。 [root@controller ~]# yum -y install debmirror yum-utils fence-agents(我自己没安装) 备注:防止误重装系统的方法(网上方法,自己没有实验过)pxe安装只允许一次,防止误操作 ( 在正式环境有用。实际测试来看,这个功能可以屏蔽掉 ) [root@controller ~]# sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings [root@controller ~]# grep '^pxe_just_once' /etc/cobbler/setting
2、修改dhcp模版文件,它会自动生产dhcp文件(网上也有cp一份模版重命名为/etc/dhcp/dhcpd.conf配置文件的方式)
[root@controller ~]# vim /etc/cobbler/dhcp.template subnet 192.168.153.0 netmask 255.255.255.0 { option routers 192.168.153.2; option domain-name-servers 192.168.153.2; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.153.100 192.168.153.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"; } }}
3、复制pxelinux.0, menu.c32到/var/lib/cobbler/loaders/(不要做,我没做)
[root@controller ~]# cd /usr/share/syslinux/ [root@controller ~]# cp -r * /var/lib/cobbler/loaders/
4、重启服务器并同步配置:
[root@controller ~]# systemctl restart cobblerd [root@controller ~]# cobbler sync task started: 2018-03-31_173554_sync task started (id=Sync, time=Sat Mar 31 17:35:54 2018) 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 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.scm_track running shell triggers from /var/lib/cobbler/triggers/change/* *** TASK COMPLETE ***
5、检查dhcp是否正常
[root@controller ~]# systemctl enable dhcpd.service [root@controller ~]# netstat -lnup|grep dhcp udp 0 0 0.0.0.0:67 0.0.0.0:* 11738/dhcpd udp 0 0 0.0.0.0:1129 0.0.0.0:* 11738/dhcpd udp6 0 0 :::31636 :::* 11738/dhcpd
6、记得启动下xinetd,要不客户端会报这个错误:PXE-E32:TFTP open timeout TFTP"Open"请求没有应答
[root@controller ~]# systemctl restart xinetd [root@controller ~]# netstat -anltup | grep :69 udp 0 0 0.0.0.0:69 0.0.0.0:* 12005/xinetd
7、加载centos7的光盘或ISO文件
[root@controller ~]# mount /dev/cdrom /mnt/ mount: /dev/sr0 写保护,将以只读方式挂载 [root@controller ~]# cobbler import --name=CentOS_7_x86_64 --path=/mnt/ task started: 2018-03-31_164113_import task started (id=Media import, time=Sat Mar 31 16:41:13 2018) 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_x86_64: creating new distro: CentOS_7-x86_64 trying symlink: /var/www/cobbler/ks_mirror/CentOS_7_x86_64 -> /var/www/cobbler/links/CentOS_7-x86_64 creating new profile: CentOS_7-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_x86_64 for CentOS_7-x86_64 processing repo at : /var/www/cobbler/ks_mirror/CentOS_7_x86_64 need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS_7_x86_64 looking for /var/www/cobbler/ks_mirror/CentOS_7_x86_64/repodata/*comps*.xml Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS_7_x86_64/repodata *** TASK COMPLETE ***
8、加载centos6.9的光盘或ISO文件
[root@controller ~]# umount /mnt 加载centos6.9的光盘或ISO文件 [root@controller ~]# mount /dev/cdrom /mnt/ [root@controller ~]# cobbler import --name=CentOS_6.9_x86_64 --path=/mnt/ task started: 2018-03-31_174506_import task started (id=Media import, time=Sat Mar 31 17:45:06 2018) 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/CentOS_6.9_x86_64: creating new distro: CentOS_6.9-x86_64 trying symlink: /var/www/cobbler/ks_mirror/CentOS_6.9_x86_64 -> /var/www/cobbler/links/CentOS_6.9-x86_64 creating new profile: CentOS_6.9-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_6.9_x86_64 for CentOS_6.9-x86_64 processing repo at : /var/www/cobbler/ks_mirror/CentOS_6.9_x86_64 need to process repo/comps: /var/www/cobbler/ks_mirror/CentOS_6.9_x86_64 looking for /var/www/cobbler/ks_mirror/CentOS_6.9_x86_64/repodata/*comps*.xml Keeping repodata as-is :/var/www/cobbler/ks_mirror/CentOS_6.9_x86_64/repodata *** TASK COMPLETE *** [root@controller ~]# ll /var/www/cobbler/ks_mirror/ 总用量 8 dr-xr-xr-x 7 root root 4096 3月 29 2017 CentOS_6.9_x86_64 dr-xr-xr-x 8 root root 4096 12月 10 2015 CentOS_7_x86_64 drwxr-xr-x 2 root root 62 3月 31 17:48 config 查看dirstro。 [root@controller syslinux]# cobbler distro list CentOS_6.9-x86_64 CentOS_7-x86_64
9、准备centos 7的ks文件(如果不定义ks文件,默认有一个,生产环境用自己定义一个)
[root@controller ~]# vi /var/lib/cobbler/kickstarts/CentOS7_x86_64.ks.cfg #version=DEVEL # System authorization information auth --enableshadow --passalgo=sha512 # Install OS instead of upgrade install # Use network installation url --url=http://192.168.153.11/cobbler/ks_mirror/CentOS_7_x86_64 # Use graphical install graphical # Run the Setup Agent on first boot firstboot --enable ignoredisk --only-use=sda # Keyboard layouts keyboard --vckeymap=us --xlayouts='us' # System language lang en_US.UTF-8 # Network information network --bootproto=dhcp --device=eno16777736 --onboot=yes --ipv6=auto network --hostname=localhost.localdomain # Root password rootpw --iscrypted $1$password$7ZK8mMeLGXxbNPeJEFJOU0 # System timezone timezone Asia/Shanghai --isUtc # System bootloader configuration bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda autopart --type=lvm # Partition clearing information clearpart --none --initlabel %packages @^minimal @core kexec-tools vim wget httpd lrzsz net-tools %end %addon com_redhat_kdump --enable --reserve-mb='auto' %end selinux --disabled reboot
10、准备centos 6.9的ks文件
[root@controller ~]# vi /var/lib/cobbler/kickstarts/CentOS6.9_x86_64.ks.cfg #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use network installation url --url=http://192.168.153.11/cobbler/ks_mirror/CentOS_6.9_x86_64 # Root password rootpw --iscrypted $1$password$7ZK8mMeLGXxbNPeJEFJOU0 # System authorization information auth --useshadow --enablemd5 # Use graphical install graphical firstboot --disable # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux --disabled # Installation logging level logging --level=info # Reboot after installation reboot # System timezone timezone --isUtc Asia/Shanghai # Network information network --bootproto=dhcp --device=eth0 --onboot=on # System bootloader configuration key --skip bootloader --append="rhgb quiet" --location=mbr --driveorder=sda # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part / --fstype="ext4" --size=8192 part swap --fstype="swap" --size=1024 part /home --fstype="ext4" --size=2048 %packages @base kexec-tools vim wget httpd lrzsz net-tools %end
11、添加Cobbler Profile
因为导入centos7和centos6.9后系统默认产生了2个,所以可以直接在上面修改,命令是cobbler profile edit --name=xxx --kickstart=xxx 。不过我这里是add新建,就是保留默认产生的2人,然后自己add新建两个。
[root@controller kickstarts]# cobbler profile add --name=CentOS7_X86_64-basic --distro=CentOS_7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7_x86_64.ks.cfg [root@controller kickstarts]# cobbler profile edit --name=CentOS7_X86_64-basic --kopts='net.ifnames=0 biosdevname=0' (这条是修改网卡名为eth0,但是我没做这个,生产环境会用到,7版本要用到,6版本不用) [root@controller kickstarts]# cobbler profile add --name=CentOS_6.9_X86_64-basic --distro=CentOS_6.9-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS6.9_x86_64.ks.cfg [root@controller kickstarts]# cobbler profile list CentOS7_X86_64-basic CentOS_6.9-x86_64 CentOS_6.9_X86_64-basic CentOS_7-x86_64 [root@controller kickstarts]# cobbler profile report Name : CentOS7_X86_64-basic TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS_7-x86_64 Enable gPXE? : 0 Enable PXE Menu? : 1 Fetchable Files : {} Kernel Options : {} Kernel Options (Post Install) : {} Kickstart : /var/lib/cobbler/kickstarts/CentOS7_x86_64.ks.cfg 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 : xenpv Name : CentOS_7-x86_64 TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS_7-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 Name : CentOS_6.9_X86_64-basic TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS_6.9-x86_64 Enable gPXE? : 0 Enable PXE Menu? : 1 Fetchable Files : {} Kernel Options : {} Kernel Options (Post Install) : {} Kickstart : /var/lib/cobbler/kickstarts/CentOS6.9_x86_64.ks.cfg 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 : xenpv Name : CentOS_6.9-x86_64 TFTP Boot Files : {} Comment : DHCP Tag : default Distribution : CentOS_6.9-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
12、cobbler sync下(好像不执行这个也可以,以前那之前已经执行了)
[root@controller ~]# cobbler sync
13、客户端安装,网卡模式启动
14、cobbler web界面配置
使用系统用户(pam)或者configfile定义用户登录管理cobbler web[root@cobbler ~]# vim /etc/cobbler/modules.conf [authentication] #module = authn_configfile (默认值) module = authn_pam [root@cobbler ~]# useradd Cadmin [root@cobbler ~]# echo "Cadmin" | passwd --stdin Cadmin Changing password for user Cadmin. passwd: all authentication tokens updated successfully. [root@cobbler ~]# vim /etc/cobbler/users.conf [admins] admin = "Cadmin" [root@controller kickstarts]# systemctl restart cobblerd [root@controller kickstarts]# systemctl restart httpd 访问地址 https://192.168.153.11/cobbler_web
-------------------------------------------------------------------------------------------------
扩展1:客户端默认是从local启动的,需要手动选择启动项,如果要修改默认启动项,更改下面这个配置文件。
LABEL CentOS_6.9-x86_64和LABEL CentOS_7-x86_64这个不是按照我的ks文件,默认密码是改settings配置文件那个。其它两个接basic是我自己的。
[root@controller kickstarts]# vi /var/lib/tftpboot/pxelinux.cfg/default DEFAULT menu PROMPT 0 MENU TITLE Cobbler | http://www.gxm.com/ TIMEOUT 200 TOTALTIMEOUT 6000 ONTIMEOUT localLABEL local MENU LABEL (local) MENU DEFAULT LOCALBOOT -1 LABEL CentOS7_X86_64-basic kernel /images/CentOS_7-x86_64/vmlinuz MENU LABEL CentOS7_X86_64-basic append initrd=/images/CentOS_7-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.153.11/cblr/svc/op/ks/profile/CentOS7_X86_64-basic ipappend 2 LABEL CentOS_6.9-x86_64 kernel /images/CentOS_6.9-x86_64/vmlinuz MENU LABEL CentOS_6.9-x86_64 append initrd=/images/CentOS_6.9-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.153.11/cblr/svc/op/ks/profile/CentOS_6.9-x86_64 ipappend 2 LABEL CentOS_6.9_X86_64-basic kernel /images/CentOS_6.9-x86_64/vmlinuz MENU LABEL CentOS_6.9_X86_64-basic append initrd=/images/CentOS_6.9-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.153.11/cblr/svc/op/ks/profile/CentOS_6.9_X86_64-basic ipappend 2 LABEL CentOS_7-x86_64 kernel /images/CentOS_7-x86_64/vmlinuz MENU LABEL CentOS_7-x86_64 append initrd=/images/CentOS_7-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.153.11/cblr/svc/op/ks/profile/CentOS_7-x86_64 ipappend 2 MENU end 或者修改[root@controller kickstarts]# vi /etc/cobbler/pxe/pxedefault.template这个文件。
扩展2:通过MAC地址定制化安装(注意ks用默认产生的,因为你自建的ks一般可能你手动固定了主机名等,这样ks文件优先)
我们可以根据不同的MAC地址来给安装 不同的操作系统、配置不同的静态iP、设置不同的主机名、应用指定的ks文件等等,vmware虚拟机查看MAC地址步骤如图:
[root@localhost cobbler]# cobbler system add --name=gxm01 --mac=00:0C:29:88:17:13 --profile=CentOS_7-x86_64 --ip-address=192.168.153.200 --subnet=255.255.255.0 --gateway=192.168.153.2 --interface=eth0 --static=1 --hostname=linux-gxm --name-servers="114.114.114.114 8.8.8.8" --kickstart=/var/lib/cobbler/kickstarts/sample_end.ks [root@localhost cobbler]# cobbler system list gxm01 如果误操作了,可以删除重新add [root@controller ~]# cobbler system remove --name gxm01 如果要修改,用下面的命令获取帮助 [root@controller ~]# cobbler system edit --help 接下来我们创建一个虚拟机,mac地址为00:0C:29:88:17:13,启动后会发现自动进入安装系统了,等安装完以后,所有的配置都和我们当初设置的一样。
扩展3:
备注1:网友的遇到的一个问题处理版本 期间因为导入CentOS7的镜像文件时我的电脑磁盘满了而虚拟机停止,触发了一个Cobbler的BUG,再次启动虚拟机后重新导入CentOS7的映像文件时显示如下。 # cobbler import --name=CentOS_7_x86_64 --path=/mnt/ Traceback (most recent call last): File "/usr/bin/cobbler", line 35, in <module> sys.exit(app.main()) File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 644, in main rc = cli.run(sys.argv) File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 270, in run self.token = self.remote.login("", self.shared_secret) File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__ return self.__send(self.__name, args) File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request verbose=self.__verbose File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request return self._parse_response(h.getfile(), sock) File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response return u.close() File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close raise Fault(**self._stack[0]) xmlrpclib.Fault: <Fault 1: "<class 'cobbler.cexceptions.CX'>:'login failed'"> 解决方法。 # service cobblerd restart Stopping cobbler daemon: [ OK ] Starting cobbler daemon: [ OK ] # cobbler get-loaders 重新导入。 # cobbler import --name=CentOS_7_x86_64 --path=/mnt/ task started: 2014-10-08_173739_import task started (id=Media import, time=Wed Oct 8 17:37:39 2014) Found a candidate signature: breed=redhat, version=rhel6 Found a candidate signature: breed=redhat, version=fedora16 Found a candidate signature: breed=redhat, version=fedora17 Found a candidate signature: breed=redhat, version=fedora18 No signature matched in /var/www/cobbler/ks_mirror/CentOS_7_x86_64 !!! TASK FAILED !!! 这个时候又一次的出错了:!!! TASK FAILED !!!,使用如下命令解决。 # cobbler signature update 再次导入。 # cobbler import --name=CentOS_7_x86_64 --path=/mnt/ 备注2:Cobbler 子命令介绍 cobbler check #检查cobbler配置 cobbler sync #步配置到dhcp pxe和数据目录 cobbler list #列出所有的cobbler元素 cobbler import #导入安装的系统光盘镜像 cobbler report #列出各元素的详细信息 cobbler distro #查看导入的发行版系统信息 cobbler profile #查看配置信息 cobbler system #查看添加的系统信息 cobbler reposync #同步yum仓库到本地 备注3:配置文件目录: /etc/cobbler /etc/cobbler/settings : cobbler 主配置文件 /etc/cobbler/iso/: iso模板配置文件 /etc/cobbler/pxe: pxe模板文件 /etc/cobbler/power: 电源配置文件 /etc/cobbler/user.conf: web服务授权配置文件 /etc/cobbler/users.digest: web访问的用户名密码配置文件 /etc/cobbler/dhcp.template : dhcp服务器的的配置末班 /etc/cobbler/dnsmasq.template : dns服务器的配置模板 /etc/cobbler/tftpd.template : tftp服务的配置模板 /etc/cobbler/modules.conf : 模块的配置文件 备注4:数据目录: /var/lib/cobbler/config/: 用于存放distros,system,profiles 等信 息配置文件 /var/lib/cobbler/triggers/: 用于存放用户定义的cobbler命令 /var/lib/cobbler/kickstart/: 默认存放kickstart文件 /var/lib/cobbler/loaders/: 存放各种引导程序 镜像目录 /var/www/cobbler/ks_mirror/: 导入的发行版系统的所有数据 /var/www/cobbler/images/ : 导入发行版的kernel和initrd镜像用于 远程网络启动 /var/www/cobbler/repo_mirror/: yum 仓库存储目录 备注5:日志目录: /var/log/cobbler/installing: 客户端安装日志 /var/log/cobbler/cobbler.log : cobbler日志 备注6:使用koan实现重新安装系统 在客户端安装koan(要配置好源) [root@localhost ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm [root@localhost ~]# yum install koan 查看cobbler上的配置文件 [root@localhost ~]# koan --server=10.0.0.101 --list=profiles - looking for Cobbler at http://10.0.0.101:80/cobbler_api Centos-7.2-x86_64 重新安装客户端系统 [root@localhost ~]# koan --replace-self --server=10.0.0.101 --profile=webserver1 重启系统后会自动重装系统