cobbler自动化安装详解
Cobbler介绍
cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows.改工具使用python开发,小巧轻便,使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP,DNS,以及yum包镜像。
Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。
1、安装Cobbler
需要EPEL的YUM源,否则就需要下载源码安装
2、yum安装Cobbler组件
安装后cobbler的配置文件
[root@test cobbler]# ls auth.conf completions named.template tftpd.template cheetah_macros dhcp.template power users.conf cobbler_bash dnsmasq.template pxe users.digest cobbler.conf iso reporting version cobblerd_rotate ldap rsync.exclude zone.template cobblerd.service modules.conf rsync.template zone_templates cobbler_web.conf mongodb.conf settings3、启动cobbler服务
4、检查cobbler的配置
首先要启动httpd服务 service httpd start 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 : 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. 4 : change 'disable' to 'no' in /etc/xinetd.d/rsync 5 : debmirror package is not installed, it will be required to manage debian deployments and repositories 6 : 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 7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use themRestart cobblerd and then run 'cobbler sync' to apply changes.错误解释
1:/etc/cobbler/settings/中的server必须要与外部指令交互的地址。
2:PXE的服务必须要启动,/etc/cobbler/settings必须要指定web主机通信的地址。
3:pxe和cobbler等所需要的驱动文件。需要安装syslinux等插件
4:需要启动rsync服务
5:debmirror安装包还没有安装。如果不是安装debin系统可以忽略
6:需要定义密码
7:电源管理,需要安装cman,可以忽略
解决错误
最后重启服务,同步数据
[root@test cobbler]# service cobblerd restart Stopping cobbler daemon: [ OK ] Starting cobbler daemon: [ OK ] cobbler check cobbler sync5、启动dhcp服务
service dhcpd startDHCP的配置在此文中不描述
6、启动tftp服务
二、导入安装光盘镜像文件
先用光盘去加载安装镜像
mount -r /dev/cdrom /var/ftp/pub/centos-6.4-x86_64 cobbler import --name="centos-6.4-x86_64" --path=/var/ftp/pub/centos-6.4-x86_64/ 加载后可以查看distro [root@test ~]# cobbler distro listcentos-6.4-x86_64制作一份kickstart.cfg文件。此文不再描述
创建一份profile,profile中需用到profile name distro(加载过的镜像文件) kickstart的文件路径cobbler profile add --name=centos-6.4-x86_64-basic --distro=centos-6.4-x86_64 --kickstart=/root/centos6.cfg [root@test ~]# cobbler list distros:centos-6.4-x86_64profiles:centos-6.4-x86_64 自动生成的profile可以删除centos-6.4-x86_64-basic [root@test ~]# cobbler sync task started: 2014-12-11_164024_sync task started (id=Sync, time=Thu Dec 11 16:40:24 2014) running pre-sync triggers cleaning trees removing: /var/www/cobbler/p_w_picpaths/centos-6.4-x86_64 removing: /tftpboot/pxelinux.cfg/default removing: /tftpboot/grub/efidefault removing: /tftpboot/grub/p_w_picpaths removing: /tftpboot/p_w_picpaths/centos-6.4-x86_64 removing: /tftpboot/s390x/profile_list copying bootloaders trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /tftpboot/pxelinux.0 copying: /var/lib/cobbler/loaders/pxelinux.0 -> /tftpboot/pxelinux.0 trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /tftpboot/menu.c32 copying: /var/lib/cobbler/loaders/menu.c32 -> /tftpboot/menu.c32 trying hardlink /var/lib/cobbler/loaders/yaboot -> /tftpboot/yaboot copying: /var/lib/cobbler/loaders/yaboot -> /tftpboot/yaboot copying distros to tftpboot copying files for distro: centos-6.4-x86_64 trying hardlink /var/www/cobbler/ks_mirror/centos-6.4-x86_64/p_w_picpaths/pxeboot/vmlinuz -> /tftpboot/p_w_picpaths/centos-6.4-x86_64/vmlinuz trying hardlink /var/www/cobbler/ks_mirror/centos-6.4-x86_64/p_w_picpaths/pxeboot/initrd.img -> /tftpboot/p_w_picpaths/centos-6.4-x86_64/initrd.img copying p_w_picpaths generating PXE configuration files generating PXE menu structure copying files for distro: centos-6.4-x86_64 trying hardlink /var/www/cobbler/ks_mirror/centos-6.4-x86_64/p_w_picpaths/pxeboot/vmlinuz -> /var/www/cobbler/p_w_picpaths/centos-6.4-x86_64/vmlinuz trying hardlink /var/www/cobbler/ks_mirror/centos-6.4-x86_64/p_w_picpaths/pxeboot/initrd.img -> /var/www/cobbler/p_w_picpaths/centos-6.4-x86_64/initrd.img rendering TFTPD files generating /etc/xinetd.d/tftp cleaning link caches running post-sync triggers running python triggers from /var/lib/cobbler/triggers/sync/post/* running python trigger cobbler.modules.sync_post_restart_services running shell triggers from /var/lib/cobbler/triggers/sync/post/* running python triggers from /var/lib/cobbler/triggers/change/* running python trigger cobbler.modules.scm_track running shell triggers from /var/lib/cobbler/triggers/change/* *** TASK COMPLETE ***查看加载后的配置选项
[root@test tftpboot]# cat /tftpboot/pxelinux.cfg/default LABEL centos-6.4-x86_64-basickernel /p_w_picpaths/centos-6.4-x86_64/vmlinuzMENU LABEL centos-6.4-x86_64-basicappend initrd=/p_w_picpaths/centos-6.4-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.254.2/cblr/svc/op/ks/profile/centos-6.4-x86_64-basicipappend 2至此,cobbler已经配置完成,可以启动物理机或者虚拟机PXE引导自动安装。
附加选项
三、cobbler_web配置
核心配置文件
[root@test web]# cat /etc/cobbler/cobbler_web.conf # This configuration file enables the cobbler web # interface (django version)<VirtualHost *:80># Do not log the requests generated from the event notification system SetEnvIf Request_URI ".*/op/events/user/.*" dontlog # Log only what remains CustomLog logs/access_log combined env=!dontlogWSGIScriptAlias /cobbler_web /usr/share/cobbler/web/cobbler.wsgi</VirtualHost>创建用户名和密码
vim /etc/cobbler/modules.conf[authentication] module = authn_configfile #修改成authn_config用户配置模式[root@test cobbler]# htdigest /etc/cobbler/users.digest "Cobbler" bjia Changing password for user bjia in realm Cobbler New password: Re-type new password: 重启cobblerd、httpd服务 [root@test cobbler]# service cobblerd restart [root@test cobbler]# service httpd restart出现如上图界面。既可以用图形化操作来完成cobblerd服务配置了。
转载于:https://blog.51cto.com/jiaxu201/1588841
总结
以上是生活随笔为你收集整理的cobbler自动化安装详解的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 2.Knockout.Js(监控属性Ob
- 下一篇: 《MFC dialog中加入OpenGL