设为首页 收藏本站
查看: 1068|回复: 0

[经验分享] cobbler批量安装linux(centos6.5)

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-6-27 16:34:37 | 显示全部楼层 |阅读模式
1.安装 cobbler
(1).安装第三方软件库所需要的包
#cd /tmp
#wget  http://mirrors.ustc.edu.cn/fedor ... ease-6-8.noarch.rpm
#rpm -ivh epel-release-6-8.noarch.rpm
(2).安装 dhcp
#yum -y install dhcp
(3). 安装其他的相关软件
#yum -y install tftp rsync xinetd httpd
(4). 安装 cobbler
#yum -y install cobbler

2.关闭 selinux 和 防火墙
#setenforce 0
#service iptables stop

3.启动 cobbler及相关服务
#service httpd start
#chkconfig httpd on
#service cobblerd start
#chkconfig cobblerd on


4.设置 cobbler
(1).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 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
    https://github.com/cobbler/cobbler/wiki/Selinux
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 : debmirror package is not installed, it will be required to manage debian deployments and repositories
7 : ksvalidator was not found, install pykickstart
8 : 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
9 : 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).根据要求修改
说明下1怎么做
修改这个/etc/cobbler/settings配置文件中的server参数为本服务器的ip

说明下2怎么做
修改这个/etc/cobbler/settings配置文件中的next_server参数为本服务器的ip

说明下3怎么做
如果你开启了selinux这个安全东西,需要关闭它
#setenforce 0
或者修改配置文件/etc/selinux/config中的SELINUX=disabled,这一步需要重启操作系统

说明下4怎么做
#cobbler get-loaders

说明下5怎么做
修改配置文件/etc/xinetd.d/rsync中的disable = no

说明下6怎么做(其实6可以不做)
#yum -y install ed patch perl perl-Digest-SHA1 perl-libwww-perl perl-Compress-Zlib perl-LockFile-Simple
#rpm -ivh debmirror-20090807-1.el5.noarch.rpm

#vim /etc/debmirror.conf
注释以下两行
#@dists="sid";
#@arches="i386";

说明下7怎么做
#yum -y install pykickstart

说明下8怎么做
修改cobbler用户的默认密码,可以用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码,找到这一行default_password_crypted
以下是生成密码的命令
#openssl passwd -1 -salt 'daoke' 'mirrtalk'
会产生如下密码
$1$daoke$p2T8SDDadwH.qOeQIUeUR/
替换即可
修改过程中,多次使用cobbler check查看,知道所有的问题解决
(3)重启cobbler并应用应用所有的设置
#service cobblerd restart
#cobbler sync

5.修改DHCP模板,确保DHCP分配的地址和cobbler在同一个网段,记得修改/etc/cobbler/settings的参数manage_dhcp 设为 1,以便管理 DHCP
vim /etc/cobbler/dhcp.template
# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************

ddns-update-style interim;

allow booting;
allow bootp;

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

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

subnet 192.168.5.0 netmask 255.255.255.0 {
     option routers             192.168.5.2;
     option domain-name-servers 192.168.5.2;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.5.110 192.168.5.220;
     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";
          }
     }

}

#for dhcp_tag in $dhcp_tags.keys():
    ## group could be subnet if your dhcp tags line up with your subnets
    ## or really any valid dhcpd.conf construct ... if you only use the
    ## default dhcp tag in cobbler, the group block can be deleted for a
    ## flat configuration
# group for Cobbler DHCP tag: $dhcp_tag
group {
        #for mac in $dhcp_tags[$dhcp_tag].keys():
            #set iface = $dhcp_tags[$dhcp_tag][$mac]
    host $iface.name {
        hardware ethernet $mac;
        #if $iface.ip_address:
        fixed-address $iface.ip_address;
        #end if
        #if $iface.hostname:
        option host-name "$iface.hostname";
        #end if
        #if $iface.netmask:
        option subnet-mask $iface.netmask;
        #end if
        #if $iface.gateway:
        option routers $iface.gateway;
        #end if
        #if $iface.enable_gpxe:
        if exists user-class and option user-class = "gPXE" {
            filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
        } else if exists user-class and option user-class = "iPXE" {
            filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
        } else {
            filename "undionly.kpxe";
        }
        #else
        filename "$iface.filename";
        #end if
        ## Cobbler defaults to $next_server, but some users
        ## may like to use $iface.system.server for proxied setups
        next-server $next_server;
        ## next-server $iface.next_server;
    }
        #end for
}
#end for
注意!!!!
vim  /etc/dhcp/dhcpd.conf
ddns-update-style interim;

allow booting;
allow bootp;

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

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

subnet 192.168.5.0 netmask 255.255.255.0 {
     option routers             192.168.5.2;
     option domain-name-servers 192.168.5.2;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.5.110 192.168.5.220;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                192.168.5.132;
     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";
          }
     }

}

group {
}
启动dhcp及开机自动启动
#service dhcpd start
#chkconfig dhcpd on


6.挂在centos6.5安装盘,生成安装镜像
#mkdir /mnt/mirrtalk65miso/
#mount -o loop /data/mirrtalk-6.5-x86_64-minimal.iso /mnt/mirrtalk65miso/
#cobbler import --path=/mnt/mirrtalk65miso/ --name=mirrtalk-6.5-x86_64 --arch=x86_64
查看已导入的
#cobbler distro list
#cobbler list
#cobbler report

7.修改mirrtalk65miso.ks
#vim /var/lib/cobbler/kickstarts/mirrtalk65miso.ks
auth --useshadow --enablemd5
bootloader --location=mbr
clearpart --all --initlabel
text
firewall --disabled
firstboot --disabled

keyboard us
lang en_US.UTF-8

network --onboot yes --bootproto dhcp --noipv6

url --url=$tree
$yum_repo_stanza

reboot


rootpw mirrtalk
selinux --disabled
skipx
timezone --utc Asia/Shanghai
install
zerombr yes

part /boot --fstype ext4 --size=200 --asprimary
part / --fstype ext4 --size=102400
part swap --size=16384
part /data --fstype ext4 --size=100 --grow

reboot

%packages
@core
@server-policy
@workstation-policy
%end

8.修改显示界面
#vim /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://www.cobblerd.org/
TIMEOUT 200
TOTALTIMEOUT 6000
ONTIMEOUT local


LABEL mirrtalk-6.5-x86_64
        kernel /images/mirrtalk-6.5-x86_64/vmlinuz
        MENU LABEL mirrtalk-6.5-x86_64
        append initrd=/images/mirrtalk-6.5-x86_64/initrd.img ksdevice=bootif lang=  kssendmac text  ks=http://192.168.5.132/cblr/svc/op/ks/profile/mirrtalk-6.5-x86_64
        ipappend 2



MENU end

重启相关服务
#/etc/init.d/xinetd restart
#/etc/init.d/cobblerd  restart

指定某个profile的ks文件
#cobbler profile add --name=mirrtalk-6.5-x86_64 kickstart=/var/lib/cobbler/kickstarts/mirrtalk65miso.ks
#cobbler profile edit --name=mirrtalk-6.5-x86_64 kickstart=/var/lib/cobbler/kickstarts/mirrtalk65miso.ks

9.重启
#/etc/init.d/cobblerd  restart


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-21170-1-1.html 上篇帖子: RHEL6Kickstart无人值守安装 下篇帖子: Ubuntu 14.04安装redmine
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表