使用Cobbler2.6.11批自动化部署Esxi5.5(实战篇)

原理整理完了,下面动手实战了(原理篇  http://blog.csdn.net/sj349781478/article/details/78759272)

--------------------------------------------------------------------------------------------

实战篇

1)准备一台linux系统,我这里准备的是CentOS6.6

2)为系统安装yum源及epel源

#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

#yum install  epel-release

#yum clean all && yum makecache

3)安装所需软件包

# yum install cobbler  cobbler-webpykickstartdebmirror httpdsyslinux

#yuminstall dhcp tftp-server

--------------------------------------------------------------------------------------------------------

此时你会发现cobbler-web包装不上,提示

cobbler-web-2.6.11-1.el6.noarch (epel)            Requires: Django >= 1.4

按照提示我们安装Django

# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
# tar -xzvf pip-1.5.4.tar.gz
# cd pip-1.5.4
# python setup.py install

# pip install Django==1.5.1

-------------------------------------------------------------------------------------------------------

继续安装cobbler-web

# yum install  cobbler-web

如果还是报错,请下载cobbler-web及django的rpm包,然后rpm安装。

#rpm -ivh python-django-1.5.1-7.1.x86_64.rpm cobbler-web-2.6.11-1.el6.noarch.rpm  --nodeps

-------------------------------------------------------------------------------------------------------


4)配置cobbler

#必要服务
1)cobbler      (cobbler的核心)
2)httpd        (提供cobbler的web界面)
3)dhcpd        (为自动安装系统分配IP地址)
4)epel-release (为之提供yum源)
5)rsync        (cobbler需要同步信息)
6)cobbler-web  (cobbler的一个web插件)
7)xinetd       (为rsync和tftp的守护进程)
8)tftp         (传送安装的一些文件的类似ftp)

#检查cobbler配置,常见错误如下
cobbler check

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 : change 'disable' to 'no' in /etc/xinetd.d/rsync
6 : file /etc/xinetd.d/rsync does not exist
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : ksvalidator was not found, install pykickstart
9 : 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
10 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

1.编辑/etc/cobbler/settings文件,找到 server选项,修改为本机IP即可
2.编辑/etc/cobbler/settings文件,找到 next_server选项,修改为本机IP即可
3.SELinux的设置, 如果上面已经关闭了SELinux就不用管了
4.执行 cobbler get-loaders,系统将自动下载loader程序,完成提示4的修复工作,之前安装了syslinux,可忽略
5.编辑/etc/xinetd.d/tftp文件,将文件中的disable字段的配置由yes改为no
6.编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no
7.在iptables中将698025151端口打开。如果仅仅只是在内部环境中使用,建议直接将防火墙关掉
8.提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略
9.修改cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码。生成密码命令:openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'其中“random-phrase-here”为任意字符
10.安装cman或者fence-agents,没有可忽略
-------------------------------------------------------------------------------------------------------
#关闭selinux/iptables
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0
chkconfig iptables off
service iptables stop
-------------------------------------------------------------------------------------------------------
#设置tftp服务和rsync服务,将disable改为no
sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp
sed -i -e 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync 

#设置DHCP server的IP,将ip地址改为服务器的IP
sed -i 's/next_server: 127.0.0.1/next_server: 172.28.70.245/g' /etc/cobbler/settings  

#设置cobbler的IP,将ip地址改为服务器的IP
sed -i 's/server: 127.0.0.1/server: 172.28.70.245/g' /etc/cobbler/settings
-------------------------------------------------------------------------------------------------------
#设置Cobbler管理rsync
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings  

#设置Cobbler管理DHCP
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings 
#设置debmirror,dists与arches行前加上#号
sed -i -e 's/@dists=/#@dists=/g' /etc/debmirror.conf
sed -i -e 's/@arches=/#@arches=/g' /etc/debmirror.conf
-------------------------------------------------------------------------------------------------------
#编辑/etc/cobbler/dhcp.template , dhcp中的具体参数解析,可以看下文末的【DHCP服务配置之主服务器配置
allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet 172.28.70.0 netmask 255.255.255.0 {
     option routers             172.28.70.254;
     option domain-name-servers 172.28.70.254;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        172.28.70.246 172.28.70.250;
     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 {
                  filename "pxelinux.0";
          }
     }
-------------------------------------------------------------------------------------------------------
重启服务
/etc/init.d/cobblerd restart
/etc/init.d/httpd restart
/etc/init.d/xinetd restart
cobbler sync
-------------------------------------------------------------------------------------------------------

Cobbler web界面访问

#设置Web登录,cobbler 2.6以上版本已经无需修改

#vi /etc/cobbler/modules.conf

[authentication] 

module = authn_configfile 

[authorization] 

module = authz_allowall 

#设置Cobbler Web登录用户登录密码 htdigest /etc/cobbler/users.digest "Cobbler" cobbler Changing password for user cobbler in realm Cobbler New password:cobbler Re-type new password:cobbler #cobbler_web登录地址,推荐使用命令行管理 http://{IP}/cobbler_web

-------------------------------------------------------------------------------------------------------
基本内容的搞定了,下面是批量安装Esxi

1:.放入光盘

2:  mount /dev/cdrom /mnt

3:  ISO导入至cobbler当中.

#cobbler import --path=/mnt/ --name=ESXI-5.5.0u03 --arch=x86_64

#service cobblerd restart

#cobbler sync


4. 配置 ESXI 5 ks 文件 :
 #vim /var/lib/cobbler/kickstarts/esxi5-ks.cfg    


  
  

  • # Test ESXi 5.5 ks file
  • #
  • accepteula
  • rootpw you@password 这里的密码不能少于7个字符
  • clearpart --firstdisk --overwritevmfs
  • install --firstdisk --overwritevmfs
  • network --bootproto=dhcp --device=vmnic0
  • reboot --noeject


 
 

5.在WEB里,配置ESXI5.5KS文件,该文件为上述的这个,并保存

 


6.经过上面这些步骤,我们就完成了Cobbler当中ESXI5.5的配置,下面我们测试装机:

开机从PXE启动;

选择ESXI-5.5.0安装。


【完】




配置参考文档:

cobbler部署安装
使用Cobbler2.4.0批量自动安装Esxi5.5
通过pip安装Django
Cobbler自动化安装配置
DHCP服务配置之主服务器配置






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Mr. Sun_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值