环境:redhat6.5-x64
关闭防火墙和selinux
基本环境安装
yum-y install dhcp tftp rsync xinetd httpd cobbler
sed -i's@#ServerName www.example.com:80@ServerName 127.0.0.1:80@g'/etc/httpd/conf/httpd.conf
/etc/init.d/httpdrestart
chkconfighttpd on
/etc/init.d/cobblerdstart
sed -i's@next_server: 127.0.0.1@next_server: 10.0.1.28@g' /etc/cobbler/settings
sed -i's@server: 127.0.0.1@server: 10.0.1.28@g' /etc/cobbler/settings
cobblerget-loaders
需要/etc/init.d/cobblerd start /etc/init.d/httpd start(httpd没运行会提示error: [Errno 111]
Connection refused),防火墙没关闭会提示503错误
下面是正常的返回(cobbler
get-loaders)
task started:2014-08-16_162609_get_loaders
task started (id=DownloadBootloader Content, time=Sat Aug 16 16:26:09 2014)
downloadinghttp://www.cobblerd.org/loaders/README to /var/lib/cobbler/loaders/README
downloadinghttp://www.cobblerd.org/loaders/COPYING.elilo to/var/lib/cobbler/loaders/COPYING.elilo
downloadinghttp://www.cobblerd.org/loaders/COPYING.yaboot to/var/lib/cobbler/loaders/COPYING.yaboot
downloadinghttp://www.cobblerd.org/loaders/COPYING.syslinux to/var/lib/cobbler/loaders/COPYING.syslinux
downloadinghttp://www.cobblerd.org/loaders/elilo-3.8-ia64.efi to/var/lib/cobbler/loaders/elilo-ia64.efi
downloadinghttp://www.cobblerd.org/loaders/yaboot-1.3.14-12 to/var/lib/cobbler/loaders/yaboot
downloadinghttp://www.cobblerd.org/loaders/pxelinux.0-3.86 to/var/lib/cobbler/loaders/pxelinux.0
downloadinghttp://www.cobblerd.org/loaders/menu.c32-3.86 to/var/lib/cobbler/loaders/menu.c32
downloadinghttp://www.cobblerd.org/loaders/grub-0.97-x86.efi to/var/lib/cobbler/loaders/grub-x86.efi
downloadinghttp://www.cobblerd.org/loaders/grub-0.97-x86_64.efi to/var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***
提示说debmirror 没安装。如果不是安装 debian之类的系统,此提示可以忽略,如果需要安装,下载地址为: http://rpmfind.net/linux/rpm2html/search.php?query=debmirrorCentOS 6使用 RHEL 5的包就可以。
yum install debmirror –y
这个没需求就不要装,装了还报错
cobbler check
The following are potentialconfiguration items that you may want to fix:
1 : comment out 'dists' on/etc/debmirror.conf for proper debian support
2 : comment out 'arches' on/etc/debmirror.conf for proper debian support
Restartcobblerd and then run 'cobbler sync' to apply changes.
报错处理:
1.
cobbler check
Traceback (most recent call last):
File "/usr/bin/cobbler", line 36, in
sys.exit(app.main())
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line657, in main
rc = cli.run(sys.argv)
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line270, in run
self.token =self.remote.login("", self.shared_secret)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in__call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in__request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request
return self._parse_response(h.getfile(), sock)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in_parse_response
return u.close()
File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: :'login failed'">
解决办法:
service cobblerd restart
2.
httpd does not appear to be running andproxying cobbler, or SELinux is in the way. Original traceback:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line252, in check_setup
…..
error: [Errno 113] No route to host
解决:除了防火墙和selinux关闭
vim /etc/cobbler/settings
server:10.0.1.33
next_server:10.0.1.33
sed -i '/disable/s/yes/no/g' /etc/xinetd.d/tftp
sed -i '/disable/s/yes/no/g' /etc/xinetd.d/rsync
chmod +x /etc/xinetd.d/tftp
openssl passwd -1 -salt 'random-phrase-here''Y0ugou!@?>'
vim /etc/cobbler/settings
加入密码
101 default_password_crypted:"$1$random-p$DpgZ7OFIEGf/tyW//J4NA0"
yum -y install cman pykickstart
cobbler check
/etc/init.d/cobblerd restart
cobbler sync
加入镜像
命令:cobbler import --path=镜像路径 -- name=安装引导名 --arch=32位或64位
参数:
path 是镜像所挂载的目录
name 是导入到cobbler里面显示的名字
arch 是32位系统还是64位系统
mkdir -p /data/iso/linux/{redhat-x64,centos-x64}
上传镜像
mount -o loop/usr/local/src/rhel-server-6.5-x86_64-dvd.iso /data/iso/linux/redhat-x64/
mount -o loop/usr/local/src/CentOS-6.5-x86_64-bin-DVD1.iso /data/iso/linux/centos-x64/
导入镜像:
cobbler import --path=/data/iso/linux/redhat-x64/--name=redhat-6.5 --arch=x86_64
cobblerimport --path=/data/iso/linux/centos-x64/ --name=centos-6.5 --arch=x86_64
配置DHCP
vim /etc/dhcp/dhcpd.conf
chkconfig httpd on
chkconfig cobblerd on
chkconfig xinetd on
chkconfig tftp on
/etc/init.d/dhcpd start
chkconfig dhcpd on
到目前为止,全部的准备工作已经就算全部完成,接下来要做的就是启动服务了。在之前的调试过程中,很多服务已经启动过了,这里只需要启动 xinetd服务即可:
/etc/init.d/xinetd start
同步 cobbler配置
cobbler sync
cobbler会自动进行初始化工作,移除已经存在的启动项,然后根据模板拷贝 loader文件。之后再生成pxe的配置文件,生成 dhcp的配置文件,最后再重启 dhcp服务。
添加profile(此处不需要操作)
cobblerprofile add --name=Fab --distro=RedHat-6.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/fab.ks
cobbler命令说明
[if !supportLists]· [endif]cobbler check #检查cobbler配置
[if !supportLists]· [endif]cobbler sync #同步配置到dhcp/pxe和数据目录
[if !supportLists]· [endif]cobbler list #列出所有的cobbler元素
[if !supportLists]· [endif]cobbler import #导入安装的系统镜像
[if !supportLists]· [endif]cobbler report #列出各元素的详细信息
[if !supportLists]· [endif]cobbler distro #查看导入的发行版系统信息
[if !supportLists]· [endif]cobbler profile #查看配置信息
[if !supportLists]· [endif]cobbler system #查看添加的系统信息
[if !supportLists]· [endif]cobbler reposync #同步yum仓库到本地
Cobbler配置文件存放在/etc/cobbler下
[if !supportLists]· [endif]/etc/cobbler/settings cobbler主配置文件
[if !supportLists]· [endif]/etc/cobbler/iso/ iso模板配置文件
[if !supportLists]· [endif]/etc/cobbler/pxe pxe模板文件
[if !supportLists]· [endif]/etc/cobbler/power 电源的配置文件
[if !supportLists]· [endif]/etc/cobbler/users.conf Web 服务授权配置文件
[if !supportLists]· [endif]/etc/cobbler/users.digest 用于web访问的用户名密码配置文件
[if !supportLists]· [endif]/etc/cobbler/dhcp.template DHCP服务的配置模板
[if !supportLists]· [endif]/etc/cobbler/dnsmasq.template DNS服务的配置模板
[if !supportLists]· [endif]/etc/cobbler/tftpd.template tftp服务的配置模板
[if !supportLists]· [endif]/etc/cobbler/modules.conf Cobbler模块配置文件
cobbler distro 命令不但可以查看导入的发行版系统信息还可以增加与修改等。
cobbler profile命令不但可以查看Kickstart文件而且还可以编辑与删除此文件。
cobbler system 命令可以将cobbler的配置安装文件与客户端相关联
obbler reposync命令可以同步远程的yum源到本地。
Cobbler数据目录/var/lib/cobbler
此目录存储和Cobbler profiles、systems、distros相关的配置。
[if !supportLists]· [endif]/var/lib/cobbler/config/ 用于存放distros、systems、profiles等信息配置文件
[if !supportLists]· [endif]/var/lib/cobbler/triggers 用于存放用户定义的cobbler 命令
[if !supportLists]· [endif]/var/lib/cobbler/kickstarts/ 默认存放kickstart文件
[if !supportLists]· [endif]/var/lib/cobbler/loaders 存放的各种引导程序
镜像数据目录/var/www/cobbler
[if !supportLists]· [endif]/var/www/cobbler/ks_mirror/ 导入的发行版系统的所有数据
[if !supportLists]· [endif]/var/www/cobbler/images/ 导入发行版的Kernel和initrd镜像用于远程网络启动
[if !supportLists]· [endif]/var/www/cobbler/repo_mirror/ yum仓库存储目录
相关日志文件
web日志存放点
/var/log/httpd/access_log
/var/log/httpd/error_log
/var/log/httpd/ssl_access_log
/var/log/httpd/ssl_error_log
Cobbler日志
/var/log/cobbler/cobbler.log
/var/log/cobbler/install.log
通过Cobbler日志可以获取系统的安装状态
删除导入的系统
cobbler profile find --distro=redhat-6.5-x86_64
redhat-6.5-x86_64 这个名字和cobbler report看到的相同,也就是/var/www/cobbler/images/下面的名字
cobbler profile remove --name=redhat-6.5-x86_64
cobbler distro remove --name=redhat-6.5-x86_64
cobbler profile find --distro=redhat-6.5-x86_64
默认ks.cfg位置
/var/lib/cobbler/kickstarts/sample.ks
自定义ks.cfg文件
命令:cobbler profile add --name=list名 --distro=镜像 --kickstart=路径
参数:
[if !supportLists]· [endif]name是表示添加的ks 的名字,用cobbler report可以看到这个名字
[if !supportLists]· [endif]distro 是用哪个镜像,list的distros里面选择一个,需要版本相对应
[if !supportLists]· [endif]kickstart 是具体的 ks 文件路径
cobbler profile edit --name redhat-6.5-x86_64--kickstart=/var/lib/cobbler/kickstarts/redhat6u5.cfg
cobbler profile edit --name centos-6.5-x86_64--kickstart=/var/lib/cobbler/kickstarts/centos6u5.cfg
创建pxe菜单密码
openssl passwd -1 -salt 9P@42K1 yougou
是数字1,不是字母l
$1$9P@42K1$6zTA7.hBF.DmFNR1lMW8e/
vim /etc/cobbler/pxe/pxedefault.template
MENU MASTER PASSWD 写在MENU TITLE上面一行也行
MENU MASTER PASSWD $1$9P@42K1$6zTA7.hBF.DmFNR1lMW8e/
vim/etc/cobbler/pxe/pxeprofile.template
定制pxe菜单title
vim /etc/cobbler/pxe/pxedefault.template
TIMEOUT的单位是毫秒,不是秒!
修改完成后执行
cobbler check
cobbler sync
cobber web管理
安装cobbler_web
yum -y install cobbler-web
为已存在的用户cobbler重置密码
htdigest /etc/cobbler/users.digest"Cobbler" cobbler
添加新用户
htdigest /etc/cobbler/users.digest"Cobbler" admin
配置cobbler web可以登录
sed-i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf
重启cobbler和httpd
/etc/init.d/cobblerd restart
/etc/init.d/httpd restart
redhat的包1237
centos的包1214
http://10.0.1.80/cobbler_web
cobbler默认端口25151
[root@kvm lib]#grep -n 25151
/etc/cobbler/*
/etc/cobbler/settings:421:xmlrpc_port:25151
让cobbler接管dhcp
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g'/etc/cobbler/settings
manage_tftpd:1
restart_dhcp:1
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g'/etc/cobbler/settings
修改dhcp模板
vim /etc/cobbler/dhcp.template
/etc/init.d/cobblerd restart
cobbler sync