标签:
环境描述:一台装有centos6.5的虚拟机,centos6.5安装镜像。
cobbler装机系统是较早前kickstart的升级版,自带web界面比较易于管理。
操作系统:CentOS 6.5
测试机器ip:192.168.40.130
操作步骤:
一、先将iptables selinux 关掉。
#/etc/init.d/iptables stop
#chkconfig iptables off
#setenforce 0
并修改配置文件/etc/sysconfig/selinux 将其disable
{涉及到的几个配置文件
/etc/cobbler/settings
/etc/xinetd.d/tftp
/etc/xinetd/rsync
/var/lib/tftpboot/pxelinux.cfg/default}
二、导入yum源,安装软件.【要求安装机器联网】
#
#yum install cobbler cobbler-web 【安装字符和图形两种COBBLER】
#yum install dhcp httpd 【安装DHCP,HTTP】
#chkconfig cobblerd on
#chkconfig httpd on 【将HTTP服务设为开机自启动】
#cobbler check 【检查cobbler配置】
三:配置环境
1)修改cobbler 的配置文件
#vim /etc/cobbler/settings
修改如下地方:
next_server: 192.168.40.130
server: 192.168.40.130
manage_dhcp: 1
manage_rsync: 1
2)生成密码串并输出到根目录下的passwdchar文件中【方便将生成的密码字符串输入到/etc/cobbler/settings中】
[root@puppet ~]# openssl passwd -1 -salt "cobber" "123456" >/passwdchar
#######openssl passwd -1 -salt ‘任意字符‘ ‘密码‘#######
这个命令的用法,任意字符可以随便写,这个密码就是安装完系统root的密码了。替换配置文件里的字串。
3)将上步生成的密码字符串替换到配置文件settings中default_password_crypted中的字符。
vi /etc/cobbler/settings
default_password_crypted: "$1$cobber$yV9XfOuaaiVDvImopK7o.1"
4)启用tftp 和 rsync服务
#vim /etc/xinetd.d/tftp
#vim /etc/xinetd.d/rsync
将disable的值修改成no
启动服务
/etc/init.d/xinetd restart
5>修改dhcp的配置文件
# vim /etc/cobbler/dhcp.template
###############begin#####################################
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.40.130 netmask 255.255.255.0 {
option routers 192.168.40.130;
option domain-name-servers 8.8.8.8;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.40.20 192.168.40.200;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
################end####################################
6)加载配置信息
[root@cobbler ~]# cobbler get-loaders
四:配置COBBLER的web管理环境
1)设置认证方式
#vi /etc/cobbler/modules.conf
module = authn_configfile /修改认证方式为密码文件类型
2)添加web管理用户
#htdigest /etc/cobbler/users.digest "Cobbler"cobbler/添加cobbler用户,提示输入2遍密码确认
3)同步配置
# cobbler sync /输出*** TASK COMPLETE *** 表示配置无错误
4)重启相关服务使新配置生效
# /etc/init.d/httpd restart
# /etc/init.d/cobblerd restart
5)测试web登陆
访问web页面 https://10.0.0.128/cobbler_web /使用刚才创建的用户登录
五、添加网络安装所需镜像
1):添加DVD源,
[root@puppet soft]# mount /dev/cdrom /mnt/cdrom/
[root@cobbler ~]# cobbler import --path=/mnt/cdrom --name=centos6.5
2):修改/var/lib/tftpboot/pxelinux.cfg/default这个配置文件为下述方式【实现完全自动安装,毋须选择启动位置】
######begin########################################################################################
DEFAULT menu
PROMPT 0
MENU TITLE Cobbler | http://cobbler.github.com
TIMEOUT 200 【可设为更小的值不为0(0为无限),直接从ONTIMEOUT中指定的位置开始安装】
TOTALTIMEOUT 6000
ONTIMEOUT centos6.5-x86_64
LABEL local
MENU LABEL local
MENU DEFAULT
LOCALBOOT -1
LABEL centos6.5-x86_64
kernel /images/centos6.5-x86_64/vmlinuz
MENU LABEL centos6.5-x86_64
append initrd=/images/centos6.5-x86_64/initrd.img ksdevice=bootif lang=kssendmac text ks=http://192.168.40.130/cblr/svc/op/ks/profile/centos6.5-x86_64
ipappend 2
MENU end
###################################end#############################################################
3)安装图形界面
在kictstart配置模板中%page中添加图形模式所需安装包
4):客户端从网络启动后选择对应的工程文件开始自动部署
选择配置好的选项开始自动安装
完成后自动重启,可以用先前定义好的密码登陆了.
附:错误排除
# cobbler check
The following are potential configuration items that you may want to fix:
1 : Must enable a selinux boolean to enable vital web services components, run: setsebool -P httpd_can_network_connect true
2 : you need to set some SELinux content rules to ensure cobbler serves content correctly in your SELinux environment, run the following: /usr/sbin/semanage fcontext -a -t public_content_t "/tftpboot/.*" && /usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler"/images/.*
3 : you need to set some SELinux rules if you want to use cobbler-web (an optional package), run the following: /usr/sbin/semanage fcontext -a -t httpd_sys_content_rw_t "/var/lib/cobbler/webui_sessions/.*"
解决:关闭selinux
# vim /etc/sysconfig/selinux
SELINUX=disabled
4 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/tftp
解决:编辑/etc/xinetd.d/tftp文件,将文件中的disable字段的配置由yes改为no
5 : change ‘disable‘ to ‘no‘ in /etc/xinetd.d/rsync
解决:编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no
6 : since iptables may be running, ensure 69, 80, and 25151 are unblocked
解决:在iptables中将69,80,25151端口打开。如果仅仅只是在内部环境中使用,建议直接将防火墙关掉
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
解决:yum install debmirror
或:rpm -Uvh ftp://rpmfind.net/linux/epel/5/i386/debmirror-20090807-1.el5.noarch.rpm –nodeps –force
8 : ksvalidator was not found, install pykickstart
解决:yum 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
解决: 修改默认密码就OK了,然后把密码写入到/etc/cobbler/settings中
# openssl passwd -1 -salt ‘random-phrase-here‘ ‘your-password-here‘
10 : comment ‘dists‘ on /etc/debmirror.conf for proper debian support
11 : comment ‘arches‘ on /etc/debmirror.conf for proper debian support
解决:注释/etc/debmirror.conf 下面两行
#@dists="sid";
@sections="main,main/debian-installer,contrib,non-free";
#@arches="i386";
12:fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
解决: yum install cman
修复完成,再用 cobbler check 检查一下,确认没问题后用 cobbler sync 做同步操作:
# cobbler check
No configuration problems found. All systems go.
13. comment out ‘dists‘ on /etc/debmirror.conf for proper debian support
comment out ‘arches‘ on /etc/debmirror.conf for proper debian supportvim vi /etc/debmirror.conf
#注释掉@dists="sid"与@arches="i386即可
#@dists="sid";
#@arches="i386";
14. 校验cobbler check出错
Traceback (most recent call last):
File "/usr/bin/cobbler", line 35, in ?
sys.exit(app.main())
File "/usr/lib/python2.4/site-packages/cobbler/cli.py", line 558, in main
rc = cli.run(sys.argv)
File "/usr/lib/python2.4/site-packages/cobbler/cli.py", line 202, in run
self.token = self.remote.login("", self.shared_secret)
File "/usr/lib64/python2.4/xmlrpclib.py", line 1096, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.4/xmlrpclib.py", line 1383, in __request
verbose=self.__verbose
File "/usr/lib64/python2.4/xmlrpclib.py", line 1147, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib64/python2.4/xmlrpclib.py", line 1286, in _parse_response
return u.close()
File "/usr/lib64/python2.4/xmlrpclib.py", line 744, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault:
解决方法:此为BUG,按下方操作执行即
service cobblerd restart
cobbler get-loaders
返回这个结果就OK了
增
二、导入ISO文件
1. 上传ISO镜像至服务器
2. 创建文件夹
# mkdir -p /system/ubuntu12.04
3. 挂载ISO镜像到/system /ubuntu12.04 目录
# mount -o loop ~/Downloads/ubuntu-12.04-server-amd64.iso /system/ubuntu12.04/
4. 从iso中导入客户端的OS。这将自动设置了“x86_64”,并将其命名为ubuntu12.04。
# cobbler import
--path=/system/ubuntu12.04/ --name=ubuntu12.04 --arch=x86_64
这需要一点时间,不要急。可查看/var/www/cobbler/ks_mirror/ubuntu12.04-x86_64/目录文件生成情况。
# cobbler sync
# cobbler list
distros: |
标签:
原文地址:http://www.cnblogs.com/baishuchao/p/5737642.html