自动化运维之cobbler批量部署操作系统(一)_PHP教程
程序员文章站
2024-01-28 16:23:58
...
自动化运维之cobbler批量部署操作系统(一)
注:本文只介绍cobbler简单的安装和使用,进阶操作以后有时间再进行整理。cobbler装机系统是较早前kickstart的升级版,优点比较容易配置,还自带web界面比较易于管理,不过安装cobbler-web时提示如下:
Error: Package: cobbler-web-2.6.11-1.el6.noarch (epel)
Requires: Django >= 1.4
鉴于安装Django比较麻烦,我就没有使用cobbler-web的功能。
环境:centos6.4
IP:192.168.1.105
yum源:
CentOS 5 x86_64
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
CentOS6 x86_64:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
CentOS6 i386:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
步骤:
1.
2.
- yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes -y
[root@bogon yum.repos.d]# cobbler check
- cobbler check 检验cobbler,根据提示一步步解决问题
httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 252, in check_setup
s.ping()
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 1243, in request
headers
ProtocolError:
由第一行得知httpd没有启动,selinux没有关闭,所以照着提示做即可。
/etc/init.d/httpd restart && setenforce 0(或者直接更改配置文件)
然后再次运行cobbler check,提示如下:
除了第9.10.12这三个不用特别关注外,其他都需要修改,根据提示很简单。
- [root@bogon yum.repos.d]# 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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
- 5 : 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.
- 6 : change 'disable' to 'no' in /etc/xinetd.d/rsync
- 7 : file /etc/xinetd.d/rsync does not exist
- 8 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked
- 9 : debmirror package is not installed, it will be required to manage debian deployments and repositories
- 10 : ksvalidator was not found, install pykickstart
- 11 : 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
- 12 : 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.
3.
修改/etc/cobbler/dhcp.template ,根据实际情况配置即可,也不难。
4.
导入镜像
cobbler import --path=/media/CentOS_5.8_Final --name=CentOS5.8 --arch=x86_64
cobbler profile edit --name=centos5.4-i686-x86_64 --kickstart=kickstart路径
导入完成后使用
cobbler report查看一下
- [root@bogon ~]# cobbler report
- distros:
- ==========
- Name : CentOS5.8-xen-x86_64
- Architecture : x86_64
- TFTP Boot Files : {}
- Breed : redhat
- Comment :
- Fetchable Files : {}
- Initrd : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/xen/initrd.img
- Kernel : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/xen/vmlinuz
- Kernel Options : {}
- Kernel Options (Post Install) : {}
- Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS5.8-xen-x86_64'}
- Management Classes : []
- OS Version : rhel5
- Owners : ['admin']
- Red Hat Management Key : >
- Red Hat Management Server : >
- Template Files : {}
- Name : CentOS5.8-x86_64
- Architecture : x86_64
- TFTP Boot Files : {}
- Breed : redhat
- Comment :
- Fetchable Files : {}
- Initrd : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/pxeboot/initrd.img
- Kernel : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/pxeboot/vmlinuz
- Kernel Options : {}
- Kernel Options (Post Install) : {}
- Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS5.8-x86_64'}
- Management Classes : []
- OS Version : rhel5
- Owners : ['admin']
- Red Hat Management Key : >
- Red Hat Management Server : >
- Template Files : {}
- profiles:
- ==========
- Name : CentOS5.8-xen-x86_64
- TFTP Boot Files : {}
- Comment :
- DHCP Tag : default
- Distribution : CentOS5.8-xen-x86_64
- Enable gPXE? : 0
- Enable PXE Menu? : 1
- Fetchable Files : {}
- Kernel Options : {}
- Kernel Options (Post Install) : {}
- Kickstart : /var/lib/cobbler/kickstarts/sample.ks kickstart路径
- Kickstart Metadata : {}
- Management Classes : []
- Management Parameters : >
- Name Servers : []
- Name Servers Search Path : []
- Owners : ['admin']
- Parent Profile :
- Internal proxy :
- Red Hat Management Key : >
- Red Hat Management Server : >
- Repos : []
- Server Override : >
- Template Files : {}
- Virt Auto Boot : 1
- Virt Bridge : xenbr0
- Virt CPUs : 1
- Virt Disk Driver Type : raw
- Virt File Size(GB) : 5
- Virt Path :
- Virt RAM (MB) : 512
- Virt Type : xenpv
- Name : CentOS5.8-x86_64
- TFTP Boot Files : {}
- Comment :
- DHCP Tag : default
- Distribution : CentOS5.8-x86_64
- Enable gPXE? : 0
- Enable PXE Menu? : 1
- Fetchable Files : {}
- Kernel Options : {}
- Kernel Options (Post Install) : {}
- Kickstart : /var/lib/cobbler/kickstarts/sample.ks
- Kickstart Metadata : {}
- Management Classes : []
- Management Parameters : >
- Name Servers : []
- Name Servers Search Path : []
- Owners : ['admin']
- Parent Profile :
- Internal proxy :
- Red Hat Management Key : >
- Red Hat Management Server : >
- Repos : []
- Server Override : >
- Template Files : {}
- Virt Auto Boot : 1
- Virt Bridge : xenbr0
- Virt CPUs : 1
- Virt Disk Driver Type : raw
- Virt File Size(GB) : 5
- Virt Path :
- Virt RAM (MB) : 512
- Virt Type : kvm
- systems:
- ==========
- repos:
- ==========
- images:
- ==========
- mgmtclasses:
- ==========
- packages:
- ==========
- files:
- ==========
5.客户端使用pxe网络启动即自动进行安装了。
- [root@bogon ~]# cobbler distro list
- CentOS5.8-x86_64
- CentOS5.8-xen-x86_64
补充:
#重命名安装选项名字:
cobbler profile rename --name='old name' –newname='new name'
#册除选项:
cobbler profile rename --name='old name'