前言:昨天提到了如何在CentOS7下利用cobbler来部署CentOS,没接触过的朋友可以参考我上一篇的文章:http://molewan.blog.51cto.com/287340/1908475,今天又测试了下利用cobbler2.8.0部署esxi5.5,参考了网上的一些资料,但与我实际操作中碰到的有些差异,所以特意记录下来。
1、查看cobbler的版本
[root@cobbler~]#cobbler--version Cobbler2.8.0 source:?,? buildtime:TueJan3123:25:142017 [root@cobbler~]#cat/etc/redhat-release CentOSLinuxrelease7.3.1611(Core)
2、挂载并导入ESXI5.5的数据
[root@cobbler~]#mount/dev/cdrom/mnt/ mount:/dev/sr0iswrite-protected,mountingread-only [root@cobbler~]#cobblerimport--path=/mnt--name=EXSI5.5--arch=x86_64 taskstarted:2017-03-21_143016_import taskstarted(id=Mediaimport,time=TueMar2114:30:162017) #以下为提示信息,最开始看到的时候吓我一跳 Foundacandidatesignature:breed=vmware,version=esxi51 running:/usr/bin/file/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/s.v00 receivedonstdout:/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/s.v00:gzipcompresseddata,was"vmvisor-sys.tar.vtar",fromUnix,lastmodified:ThuSep1914:39:272013 receivedonstderr: Foundacandidatesignature:breed=vmware,version=esxi60 running:/usr/bin/file/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/s.v00 receivedonstdout:/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/s.v00:gzipcompresseddata,version=esxi5 running:/usr/bin/file/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/s.v00 receivedonstdout:/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/s.v00:gzipcompresseddata,version=esxi55 running:/usr/bin/file/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/s.v00 receivedonstdout:/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/s.v00:gzipcompresseddata,lastmodified:ThuSep1914:39:272013 receivedonstderr: Foundamatchingsignature:breed=vmware,version=esxi55 Addingdistrosfrompath/var/www/cobbler/ks_mirror/EXSI5.5-x86_64: running:/usr/bin/file/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/tools.t00 receivedonstdout:/var/www/cobbler/ks_mirror/EXSI5.5-x86_64/tools.t00:gzipcompresseddata,lastmodified:ThuSep1914:38:112013 receivedonstderr: creatingnewdistro:EXSI5.5-x86_64 tryingsymlink:/var/www/cobbler/ks_mirror/EXSI5.5-x86_64->/var/www/cobbler/links/EXSI5.5-x86_64 creatingnewprofile:EXSI5.5-x86_64 associatingrepos ***TASKCOMPLETE*** [root@cobbler~]#echo$? 0 说明:以上的输出结果可知,导入没有问题
3、编辑kickstart文件
[root@cobbler~]#cd/var/lib/cobbler/kickstarts/ [root@cobblerkickstarts]#vimESXI55.cfg #setforinstallesxi55 vmaccepteula #注意如果密码长度小于7位,安装的时候会有报错的(可惜忘记截图了) rootpwredhat123456 clearpart--firstdisk--overwritevmfs install--firstdisk--overwritevmfs #注意网卡名称为vmnic0 network--bootproto=dhcp--device=vmnic0 reboot--noeject [root@cobblerkickstarts]#ll total64 -rw-r--r--1rootroot1254Mar2015:32CentOS-6.7-x86_64.cfg -rw-r--r--1rootroot1301Mar2012:23CentOS-7.3-x86_64.cfg -rw-r--r--1rootroot115Nov1703:09default.ks -rw-r--r--1rootroot22Nov1703:09esxi4-ks.cfg -rw-r--r--1rootroot184Mar2114:44ESXI55.cfg -rw-r--r--1rootroot22Nov1703:09esxi5-ks.cfg drwxr-xr-x2rootroot56Mar2010:39install_profiles -rw-r--r--1rootroot1424Nov1703:09legacy.ks -rw-r--r--1rootroot292Nov1703:09pxerescue.ks -rw-r--r--1rootroot2916Nov1703:09sample_autoyast.xml -rw-r--r--1rootroot1825Nov1703:09sample_end.ks -rw-r--r--1rootroot0Nov1703:09sample_esx4.ks -rw-r--r--1rootroot324Nov1703:09sample_esxi4.ks -rw-r--r--1rootroot386Nov1703:09sample_esxi5.ks -rw-r--r--1rootroot1784Nov1703:09sample.ks -rw-r--r--1rootroot3419Nov1703:09sample_old.seed -rw-r--r--1rootroot5879Nov1703:09sample.seed 说明:可以参考sample_esxi5.ks文件进行编辑 [root@cobblerkickstarts]#cobblerlist distros: CentOS-6.7-x86_64 CentOS-7.3-x86_64 EXSI5.5-x86_64 profiles: CentOS-6.7-x86_64 CentOS-7.3-x86_64 EXSI5.5-x86_64 systems: cobbler2 repos: images: mgmtclasses: packages: files:
4、查看cobbler profile
[root@cobblerkickstarts]#cobblerprofilereport Name:CentOS-7.3-x86_64 TFTPBootFiles:{} Comment: DHCPTag:default Distribution:CentOS-7.3-x86_64 EnablegPXE?:0 EnablePXEMenu?:1 FetchableFiles:{} KernelOptions:{'biosdevname':'0','net.ifnames':'0'} KernelOptions(PostInstall):{} Kickstart:/var/lib/cobbler/kickstarts/CentOS-7.3-x86_64.cfg KickstartMetadata:{} ManagementClasses:[] ManagementParameters:<<inherit>> NameServers:[] NameServeRSSearchPath:[] Owners:['admin'] ParentProfile: Internalproxy: RedHatManagementKey:<<inherit>> RedHatManagementServer:<<inherit>> Repos:[] ServerOverride:<<inherit>> TemplateFiles:{} VirtAutoBoot:1 VirtBridge:xenbr0 Virtcpus:1 VirtDiskDriverType:raw VirtFileSize(GB):5 VirtPath: VirtRAM(MB):512 VirtType:kvm Name:CentOS-6.7-x86_64 TFTPBootFiles:{} Comment: DHCPTag:default Distribution:CentOS-6.7-x86_64 EnablegPXE?:0 EnablePXEMenu?:1 FetchableFiles:{} KernelOptions:{} KernelOptions(PostInstall):{} Kickstart:/var/lib/cobbler/kickstarts/sample_end.ks KickstartMetadata:{} ManagementClasses:[] ManagementParameters:<<inherit>> NameServers:[] NameServeRSSearchPath:[] Owners:['admin'] ParentProfile: Internalproxy: RedHatManagementKey:<<inherit>> RedHatManagementServer:<<inherit>> Repos:[] ServerOverride:<<inherit>> TemplateFiles:{} VirtAutoBoot:1 VirtBridge:xenbr0 Virtcpus:1 VirtDiskDriverType:raw VirtFileSize(GB):5 VirtPath: VirtRAM(MB):512 VirtType:kvm Name:EXSI5.5-x86_64 TFTPBootFiles:{} Comment: DHCPTag:default Distribution:EXSI5.5-x86_64 EnablegPXE?:0 EnablePXEMenu?:1 FetchableFiles:{} KernelOptions:{} KernelOptions(PostInstall):{} Kickstart:/var/lib/cobbler/kickstarts/sample_esxi5.ks KickstartMetadata:{} ManagementClasses:[] ManagementParameters:<<inherit>> NameServers:[] NameServeRSSearchPath:[] Owners:['admin'] ParentProfile: Internalproxy: RedHatManagementKey:<<inherit>> RedHatManagementServer:<<inherit>> Repos:[] ServerOverride:<<inherit>> TemplateFiles:{} VirtAutoBoot:1 VirtBridge:xenbr0 Virtcpus:1 VirtDiskDriverType:raw VirtFileSize(GB):5 VirtPath: VirtRAM(MB):512 VirtType:kvm 说明:由上的输出结果,我们可以发现,EXSI5.5-x86_64默认的kickstart文件是/var/lib/cobbler/kickstarts/sample_esxi5.ks,显然这不是我们想要的 [root@cobblerkickstarts]#cobblerprofileedit--name=EXSI5.5-x86_64--kickstart=/var/lib/cobbler/kickstarts/ESXI55.cfg #修改EXSI5.5-x86_64默认的kickstart文件为/var/lib/cobbler/kickstarts/ESXI55.cfg,并再次查看 [root@cobblerkickstarts]#cobblerprofilereport Name:CentOS-7.3-x86_64 TFTPBootFiles:{} Comment: DHCPTag:default Distribution:CentOS-7.3-x86_64 EnablegPXE?:0 EnablePXEMenu?:1 FetchableFiles:{} KernelOptions:{'biosdevname':'0','net.ifnames':'0'} KernelOptions(PostInstall):{} Kickstart:/var/lib/cobbler/kickstarts/CentOS-7.3-x86_64.cfg KickstartMetadata:{} ManagementClasses:[] ManagementParameters:<<inherit>> NameServers:[] NameServeRSSearchPath:[] Owners:['admin'] ParentProfile: Internalproxy: RedHatManagementKey:<<inherit>> RedHatManagementServer:<<inherit>> Repos:[] ServerOverride:<<inherit>> TemplateFiles:{} VirtAutoBoot:1 VirtBridge:xenbr0 Virtcpus:1 VirtDiskDriverType:raw VirtFileSize(GB):5 VirtPath: VirtRAM(MB):512 VirtType:kvm Name:CentOS-6.7-x86_64 TFTPBootFiles:{} Comment: DHCPTag:default Distribution:CentOS-6.7-x86_64 EnablegPXE?:0 EnablePXEMenu?:1 FetchableFiles:{} KernelOptions:{} KernelOptions(PostInstall):{} Kickstart:/var/lib/cobbler/kickstarts/sample_end.ks KickstartMetadata:{} ManagementClasses:[] ManagementParameters:<<inherit>> NameServers:[] NameServeRSSearchPath:[] Owners:['admin'] ParentProfile: Internalproxy: RedHatManagementKey:<<inherit>> RedHatManagementServer:<<inherit>> Repos:[] ServerOverride:<<inherit>> TemplateFiles:{} VirtAutoBoot:1 VirtBridge:xenbr0 Virtcpus:1 VirtDiskDriverType:raw VirtFileSize(GB):5 VirtPath: VirtRAM(MB):512 VirtType:kvm Name:EXSI5.5-x86_64 TFTPBootFiles:{} Comment: DHCPTag:default Distribution:EXSI5.5-x86_64 EnablegPXE?:0 EnablePXEMenu?:1 FetchableFiles:{} KernelOptions:{} KernelOptions(PostInstall):{} Kickstart:/var/lib/cobbler/kickstarts/ESXI55.cfg KickstartMetadata:{} ManagementClasses:[] ManagementParameters:<<inherit>> NameServers:[] NameServeRSSearchPath:[] Owners:['admin'] ParentProfile: Internalproxy: RedHatManagementKey:<<inherit>> RedHatManagementServer:<<inherit>> Repos:[] ServerOverride:<<inherit>> TemplateFiles:{} VirtAutoBoot:1 VirtBridge:xenbr0 Virtcpus:1 VirtDiskDriverType:raw VirtFileSize(GB):5 VirtPath: VirtRAM(MB):512 VirtType:kvm #进行cobbler数据同步 [root@cobbler~]#cobblersync #根据mac地址,分配一个固定IP [root@cobbler~]#cobblersystemadd--name=esxi55-01--mac=00:0C:29:4A:9F:44--profile=EXSI5.5-x86_64--ip-address=10.10.10.168--subnet=255.255.255.0--gateway=10.10.10.2--interface=vmnic0--static=1--hostname=esxi55-01.saltstack.com--name-servers="10.10.10.2" 说明:以上的网卡是esxi55客户机的真实网卡,为它安装的时候指定一个固定的ip、子网掩码、网关、主机名、DNS等 [root@cobbler~]#cobblersystemlist esxi55-01
然后开启服务器,坐等ESXI5.5安装完毕
在esxi5.5上配置好ssh后,命令行模式下测试下网络情况
~#ping10.10.10.2 PING10.10.10.2(10.10.10.2):56databytes 64bytesfrom10.10.10.2:icmp_seq=0ttl=128time=1.044ms 64bytesfrom10.10.10.2:icmp_seq=1ttl=128time=0.691ms 64bytesfrom10.10.10.2:icmp_seq=2ttl=128time=0.624ms ---10.10.10.2pingstatistics--- 3packetstransmitted,3packetsreceived,0%packetloss round-tripmin/avg/max=0.624/0.786/1.044ms ~#pingwww.sina.com.cn PINGwww.sina.com.cn(60.215.128.246):56databytes 64bytesfrom60.215.128.246:icmp_seq=0ttl=128time=23.509ms 64bytesfrom60.215.128.246:icmp_seq=1ttl=128time=26.123ms 64bytesfrom60.215.128.246:icmp_seq=2ttl=128time=26.520ms ---www.sina.com.cnpingstatistics--- 3packetstransmitted,0%packetloss round-tripmin/avg/max=23.509/25.384/26.520ms
到此,一个完整的ESXI5.5就部署完成了。
原文链接:https://www.f2er.com/centos/378288.html