运维自动化之Cobbler系统安装详解
设置epel源
rpm -Uvh 'http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm'
yum 安装
yum -y installcobbler dhcp httpd xinetd tftp-server
==========================================================================================================
正在安装:
cobbler noarch 2.6.9-1.el6 epel 613 k
为依赖而安装:
PyYAML x86_64 3.10-3.1.el6 updates 157 k
createrepo noarch 0.9.9-22.el6 base 96 k
deltarpm x86_64 3.5-0.5.20090913git.el6 base 71 k
libyaml x86_64 0.1.3-4.el6_6 updates 52 k
mod_wsgi x86_64 3.2-7.el6 base 66 k
python-cheetah x86_64 2.4.1-1.el6 base 365 k
python-deltarpm x86_64 3.5-0.5.20090913git.el6 base 27 k
python-markdown noarch 2.0.1-3.1.el6 base 118 k
python-pygments noarch 1.1.1-1.el6 base 562 k
python-setuptools noarch 0.6.10-3.el6 base 336 k
python-simplejson x86_64 2.0.9-3.1.el6 base 126 k
tftp-server x86_64 0.49-7.el6 base 39 k
Cobbler check检查解决以下问题:
[root@wdds_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 : 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 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked
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参数的值为提供cobbler服务的主机相应的IP地址或主机名,10.0.0.61
2、 修改/etc/cobbler/settings文件中的next_server参数的值为提供PXE服务的主机相应的IP地址 ,10.0.0.61
3、 change 'disable' to 'no' in /etc/xinetd.d/tftp
4、 如果当前节点可以访问互联网,执行“cobbler get-loaders”命令即可;否则,需要安装syslinux程序包,而后复制/usr/share/syslinux/{pxelinux.0,memu.c32}等文件至/var/lib/cobbler/loaders/目录中
5、 change 'disable' to 'no' in /etc/xinetd.d/rsync
6、 关闭防火墙或开放端口69, 80/443, and 25151
7、 Yum installdebmirror
8、 Yum installpykickstart
9、 执行“openssl passwd -1 -salt $(openssl rand -hex 4)”生成密码,并用其替换/etc/cobbler/settings文件中default_password_crypted参数的值;
10、 yum install cman fence-agents
解决完成后重启cobblerd
Service cobblerdrestart
配置dhcp服务:
[root@wdds_1 ~]#egrep -v '#|^$' /etc/dhcp/dhcpd.conf
option domain-name"dylan.com";
optiondomain-name-servers 10.0.0.2;
default-lease-time43200;
max-lease-time86400;
log-facilitylocal7;
subnet 10.0.0.0netmask 255.255.255.0 {
range 10.0.0.26 10.0.0.30;
option routers 10.0.0.61;
}
next-server10.0.0.61;
filename="pxelinux.0";
启动DHCP、tftp、rsync
[root@wdds_1 ~]#/etc/init.d/dhcpd restart
[root@wdds_1 ~]#/etc/init.d/xinetd start
正在启动 xinetd:
导入镜像文件
事先将光盘镜像挂载到/mnt/iso中 (也可以使用网上的镜像源)
[root@wdds_1 iso]# cobbler import --path=/mnt/iso/ --name=centos6.6 --arch=x86_64
task started: 2015-08-11_092305_import
task started (id=Media import, time=Tue Aug 11 09:23:05 2015)
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/centos6.6-x86_64:
creating new distro: centos6.6-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos6.6-x86_64 -> /var/www/cobbler/links/centos6.6-x86_64
creating new profile: centos6.6-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/centos6.6-x86_64 for centos6.6-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos6.6-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/centos6.6-x86_64
looking for /var/www/cobbler/ks_mirror/centos6.6-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos6.6-x86_64/repodata
*** TASK COMPLETE ***
Cobbler 常用命令:
[root@wdds_1 dhcp]# cobbler distro
usage
=====
cobbler distro add
cobbler distro copy
cobbler distro edit
cobbler distro find
cobbler distro list
cobbler distro remove
cobbler distro rename
cobbler distro report
[root@wdds_1 dhcp]#
[root@wdds_1 dhcp]# cobbler distro list
centos6.6-x86_64
[root@wdds_1 dhcp]# cobbler import --help
出现的错误解决:
[root@wdds_1 ~]# cobbler get-loaders
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", line 657, in main
rc = cli.run(sys.argv)
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 270, 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:
解决方法:
修改hosts 文件在 127.0.0.1 localhost.localdomainlocalhost 添加本机的主机名
127.0.0.1 localhost.localdomainlocalhost wdds_1
待续。。。
后续添加cobbler_web认证等