www.cnblogs.com/ruiyqinrui

开源、架构、Linux C/C++/python AI BI 运维开发自动化运维。 春风桃李花 秋雨梧桐叶。“力尽不知热 但惜夏日长”。夏不惜,秋不获。@ruiY--秦瑞

python爬虫,C编程,嵌入式开发.hadoop大数据,桉树,onenebula云计算架构.linux运维及驱动开发.

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1,yum 安装cobbler

  rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

  yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes cman pykickstart debmirror -y 

1、设置http服务

vi /etc/httpd/conf.d/wsgi.conf

LoadModule wsgi_module modules/mod_wsgi.so  #取消前面的注释

:wq! #保存退出

chkconfig httpd on  #设置开机启动

service httpd start #启动

2、设置tftp服务开机启动

vi  /etc/etc/xinetd.d/tftpd   #编辑

service tftp

{

disable                 = no #修改为no

socket_type             = dgram

protocol                = udp

wait                    = yes

user                    = root

server                  = /usr/sbin/in.tftpd

server_args             = -B 1380 -v -s /tftpboot

per_source              = 11

cps                     = 100 2

flags                   = IPv4

}

:wq! #保存退出

3、设置rsync服务开机启动

vi /etc/xinetd.d/rsync  #编辑配置文件,设置开机启动rsync

service rsync

{

disable = no   #修改为no

socket_type     = stream

wait            = no

user            = root

server          = /usr/bin/rsync

server_args     = --daemon

log_on_failure  += USERID

}

:wq! #保存退出

/etc/init.d/xinetd start  #启动(CentOS中是以xinetd 来管理Rsync和tftp服务的

4、配置cobbler相关参数

vi /etc/debmirror.conf  #注释掉 @dists 和 @arches 两行

#@dists="sid";

#@arches="i386";

:wq! #保存退出

openssl passwd -1 -salt 'ruiy' '123456#生成默认模板下系统安装完成之后root账号登录密码

  #记录下这行,下面会用到

vi /etc/cobbler/settings  #编辑,修改

default_password_crypted: ""

next_server:

server:

manage_dhcp: 1

manage_rsync:1

default_kickstart: /var/lib/cobbler/kickstarts/我们下面自己创建的ks,CentOS-6.4-x86_64;

:wq! #保存退出

5、配置dhcp服务器

vi /etc/cobbler/dhcp.template #编辑,修改

subnet 192.168.21.0 netmask 255.255.255.0 { #设置网段

option routers             ; #设置网关

option domain-name-servers 8.8.8.8,8.8.4.4; #设置dns服务器地址

option subnet-mask         255.255.255.0; #设置子网掩码

range dynamic-bootp        ;  #设置dhcp服务器IP地址租用的范围

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";

}

}

}

:wq! #保存退出

vi /etc/sysconfig/dhcpd   #指定DHCP服务的网络接口

DHCPDARGS=eth0

:wq!  #保存退出

dhcpd  #测试dhcp服务器配置是否正确

chkconfig dhcpd on   #设置开机启动

chkconfig cobblerd on   #设置开机启动

cobbler get-loaders  #安装cobbler相关工具包,否则检查cobbler配置会报错

service cobblerd start  #启动cobbler

cobbler sync  #同步配置文件到dhcp服务器

service dhcpd start    #启动dhcp服务

6、设置cobbler相关服务启动脚本

vi /etc/rc.d/init.d/cobbler #编辑,添加以下代码

#!/bin/sh

# chkconfig: - 80 90

# description:cobbler

case $1 in

start)

/etc/init.d/httpd start

/etc/init.d/xinetd start

/etc/init.d/dhcpd start

/etc/init.d/cobblerd start

;;

stop)

/etc/init.d/httpd stop

/etc/init.d/xinetd stop

/etc/init.d/dhcpd stop

/etc/init.d/cobblerd stop

;;

restart)

/etc/init.d/httpd restart

/etc/init.d/xinetd restart

/etc/init.d/dhcpd restart

/etc/init.d/cobblerd restart

;;

status)

/etc/init.d/httpd status

/etc/init.d/xinetd status

/etc/init.d/dhcpd status

/etc/init.d/cobblerd status

;;

sync)

cobbler sync

;;

*)

echo "Input error,please in put 'start|stop|restart|status|sync'!";

exit 2>&1 >/dev/null &

;;

esac

:wq! #保存退出

chmod +x /etc/rc.d/init.d/cobbler  #添加脚本执行权限

chkconfig cobbler on  #添加开机启动

service cobbler  restart  #重启cobbler

cobbler  check  #检查cobbler配置

kickstart自动安装脚本

cobbler

 

posted on 2014-05-05 15:58  秦瑞It行程实录  阅读(427)  评论(0编辑  收藏  举报
www.cnblogs.com/ruiyqinrui