以前在没有kickstart的时候,安装系统都是通过光盘来安装,如果数量大的话,就会很浪费时间,有了kickstart,通过pxe+dhcp+tftp配合kickstart,这样安装系统就方便了很多,现在开源社区里的cobbler工具,使用后觉得比kickstart更方便,Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。
一、安装epel源
二、安装与配置cobbler
三、使用koan来实现cobbler重新安装系统
四、cobbler的图形化管理
五、使用
vmware来安装系统
六、
FAQ
一、安装
epel源
默认的光盘中没有
cobbler软件,必须在yum仓库中设置第三方的软件源,才能安装cobbler等软件。这里用的epel软件源
由于我的
rhel 5.3 64为系统,所以我下载的是
http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm源
- wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
- rpm -ivh epel-release-5-4.noarch.rpm
(
1)、什么是epel
如果既想获得 RHEL 的高质量、高性能、高可靠性,又需要方便易用(关键是免费)的软件包更新功能,那么 Fedora Project 推出的 EPEL(Extra Packages for Enterprise Linux)正好适合你。EPEL(http://fedoraproject.org/wiki/EPEL) 是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。
(2)、使用心得
1,不用去换原来yum源,安装后会产生新repo
2,epel会有很多源地址,如果一个下不到,会去另外一个下
3,更新时如果下载的包不全,就不会进行安装。这样的话,依赖关系可以保重
如果既想获得 RHEL 的高质量、高性能、高可靠性,又需要方便易用(关键是免费)的软件包更新功能,那么 Fedora Project 推出的 EPEL(Extra Packages for Enterprise Linux)正好适合你。EPEL(http://fedoraproject.org/wiki/EPEL) 是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。
(2)、使用心得
1,不用去换原来yum源,安装后会产生新repo
2,epel会有很多源地址,如果一个下不到,会去另外一个下
3,更新时如果下载的包不全,就不会进行安装。这样的话,依赖关系可以保重
(
3)安装epel源的好处
就是
epel这个项目是由fedora维护的,在维护的这个源中包含许多软件,包括ntop,nagios之类的,也就是说,你安装了epel源就可以直接用yum install ntop来安装了,贼方便
不过这个应该针对红帽企业版
Linux(RHEL)及其衍生发行版(比如CentOS、Scientific Linux)系统,ubuntu这类的应该不行。
二、安装与配置
cobbler
- yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes
安装完成后,启动
cobbler与httpd,然后输入cobbler check
- [root@cobbler ~]# 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 : you need to set some SELinux content rules to ensure cobbler works 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/.*"
- 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/tftp
- 6 : change 'disable' to 'no' in /etc/xinetd.d/rsync
- 7 : since iptables may be running, ensure 69, 80, and 25151 are unblocked
- 8 : debmirror package is not installed, it will be required to manage debian deployments and repositories
- 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
- Restart cobblerd and then run 'cobbler sync' to apply changes.
上面这段信息大意就是:
1,编辑
/etc/cobbler/settings文件,找到 server选项,修改为适当的ip地址,本实例配置ip为:192.168.10.1
2,编辑
/etc/cobbler/settings文件,找到 next_server选项,修改为适当的ip地址,本实例配置ip为:192.168.10.1
3,
SELinux的设置。如果上面已经关闭了SELinux就不用管了
4,执行
cobbler get-loaders,系统将自动下载loader程序,完成提示4的修复工作。
5,编辑
/etc/xinetd.d/tftp文件,将文件中的disable字段的配置由yes改为no
6,编辑
/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no
7,在
iptables中将69,80,25151端口打开。如果仅仅只是在内部环境中使用,建议直接将防火墙关掉
8,提示说
debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略,如果需要安装,下载地址为:
http://rpmfind.net/linux/rpm2html/search.php?query=debmirror
CentOS 6使用
RHEL 5的包就可以。
9,修改
cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码。生成密码命令:
openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'
其中“
random-phrase-here”为干扰码
所有提示全部
fix之后,执行
/etc/init.d/cobblerd restart
为了解决上面的问题,使用以下方法:
1、tftp服务和
rsync服务配置
- sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp
- sed -i -e 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync
- service xinetd restart
你的
iptables与selinux也必须关闭
- chkconfig ip6tables off
- chkconfig iptables off
- /etc/init.d/ip6tables stop
- /etc/init.d/iptables stop
并且
selinux修改后,需要重启
2、TFTP服务器
IP地址
- sed -i 's/next_server: 127.0.0.1/next_server: 192.168.1.225/g' /etc/cobbler/settings
3、cobbler管理
rsync
- sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
4、cobbler管理
dhcp
- sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
5、dhcp服务是有
cobbler来管理 /etc/cobbler/dhcp.template
修改下面的内容就可以。如果你不想内网出个
dhcp服务器,那么你需要注释掉 range dynamic-bootp 。不然你内网就会出现一个dhcp服务器。
- subnet 192.168.1.0 netmask 255.255.255.0 {
- option routers 192.168.1.1;
- option domain-name-servers 202.106.0.20;
- option subnet-mask 255.255.255.0;
- range dynamic-bootp 192.168.1.10 192.168.1.50;
- filename "/pxelinux.0";
- default-lease-time 21600;
- max-lease-time 43200;
- next-server $next_server;
- }
6、启动菜单
- cobbler get-loaders
7、然后挂载光盘,导入镜像文件
- [root@cobbler mnt]# mount -o loop /root/rhel-server-5.3-i386-dvd.iso /mnt/rhel/
由于
centos里光盘信息比较多,所以导入的时候,会同时创建一个distro,profile。并且还设置的repo。不过这个repo,只包括DVD1,如果希望包括DVD2,还需要做设置才行
- [root@cobbler mnt]# cobbler import --path=/mnt/rhel/ --name=rhel-server-5.3-i386
- task started: 2012-09-11_225453_import
- task started (id=Media import, time=Tue Sep 11 22:54:53 2012)
- Found a redhat compatible signature: Server
- adding distros
- creating new distro: rhel-server-5.3-i386
- creating new profile: rhel-server-5.3-i386
- creating new distro: rhel-server-5.3-xen-i386
- creating new profile: rhel-server-5.3-xen-i386
- associating repos
- traversing distro rhel-server-5.3-i386
- descent into /var/www/cobbler/ks_mirror/rhel-server-5.3-i386
- processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage
- need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage
- looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage/repodata/*comps*.xml
- running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage/repodata/comps-rhel5-cluster-st.xml /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage
- 39/39 - Global_File_System-mr-IN-5.2-1.noarch.rpm
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
- received on stderr: This option is deprecated
- processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server
- need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server
- looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server/repodata/*comps*.xml
- running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server/repodata/comps-rhel5-server-core.xml /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server
- 2216/2216 - m17n-db-kazakh-1.3.3-48.el5.noarch.rpm m
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
- received on stderr: This option is deprecated
- processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT
- need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT
- looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT/repodata/*comps*.xml
- running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT/repodata/comps-rhel5-vt.xml /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT
- 35/35 - xen-3.0.3-80.el5.i386.rpm
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
- received on stderr: This option is deprecated
- processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster
- need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster
- looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster/repodata/*comps*.xml
- running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster/repodata/comps-rhel5-cluster.xml /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster
- 32/32 - Cluster_Administration-es-ES-5.2-1.noarch.rpm
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
- received on stderr: This option is deprecated
- traversing distro rhel-server-5.3-xen-i386
- descent into /var/www/cobbler/ks_mirror/rhel-server-5.3-i386
- processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage
- need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage
- looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage/repodata/*comps*.xml
- running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage/repodata/comps-rhel5-cluster-st.xml /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage
- 39/39 - Global_File_System-mr-IN-5.2-1.noarch.rpm
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
- received on stderr: This option is deprecated
- processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server
- need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server
- looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server/repodata/*comps*.xml
- running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server/repodata/comps-rhel5-server-core.xml /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server
- 2216/2216 - m17n-db-kazakh-1.3.3-48.el5.noarch.rpm m
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
- received on stderr: This option is deprecated
- processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT
- need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT
- looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT/repodata/*comps*.xml
- running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT/repodata/comps-rhel5-vt.xml /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT
- 35/35 - xen-3.0.3-80.el5.i386.rpm
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
- received on stderr: This option is deprecated
- processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster
- need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster
- looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster/repodata/*comps*.xml
- running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster/repodata/comps-rhel5-cluster.xml /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster
- 32/32 - Cluster_Administration-es-ES-5.2-1.noarch.rpm
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
- received on stderr: This option is deprecated
- associating kickstarts
- *** TASK COMPLETE ***
导入的镜像存储在
/var/www/cobbler/ks_mirror/这个目录下
cobbler distro list 查看导入结果
cobbler distro list 查看导入结果
8、完成后同步所有配置
每次修改后必须
cobbler sync同步配置
- [root@cobbler ~]# cobbler sync
- task started: 2012-09-11_233141_sync
- task started (id=Sync, time=Tue Sep 11 23:31:41 2012)
- running pre-sync triggers
- cleaning trees
- removing: /var/www/cobbler/images/rhel-server-5.3-xen-i386
- removing: /var/www/cobbler/images/rhel-server-5.3-i386
- removing: /tftpboot/pxelinux.cfg/default
- removing: /tftpboot/grub/images
- removing: /tftpboot/grub/efidefault
- removing: /tftpboot/s390x/profile_list
- copying bootloaders
- copying: /var/lib/cobbler/loaders/pxelinux.0 -> /tftpboot/pxelinux.0
- copying: /usr/lib/syslinux/pxelinux.0 -> /tftpboot/pxelinux.0
- copying: /usr/lib/syslinux/menu.c32 -> /tftpboot/menu.c32
- copying: /var/lib/cobbler/loaders/yaboot -> /tftpboot/yaboot
- copying: /usr/lib/syslinux/memdisk -> /tftpboot/memdisk
- copying distros to tftpboot
- copying files for distro: rhel-server-5.3-xen-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/xen/vmlinuz -> /tftpboot/images/rhel-server-5.3-xen-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/xen/initrd.img -> /tftpboot/images/rhel-server-5.3-xen-i386/initrd.img
- copying files for distro: rhel-server-5.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/pxeboot/vmlinuz -> /tftpboot/images/rhel-server-5.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/pxeboot/initrd.img -> /tftpboot/images/rhel-server-5.3-i386/initrd.img
- copying images
- generating PXE configuration files
- generating PXE menu structure
- copying files for distro: rhel-server-5.3-xen-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/xen/vmlinuz -> /var/www/cobbler/images/rhel-server-5.3-xen-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/xen/initrd.img -> /var/www/cobbler/images/rhel-server-5.3-xen-i386/initrd.img
- copying files for distro: rhel-server-5.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rhel-server-5.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/pxeboot/initrd.img -> /var/www/cobbler/images/rhel-server-5.3-i386/initrd.img
- rendering DHCP files
- generating /etc/dhcpd.conf
- 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: dhcpd -t -q
- received on stdout:
- received on stderr:
- running: service dhcpd restart
- received on stdout: Starting dhcpd: [ OK ]
- received on stderr:
- 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 ***
- 看到以下内容即成功:
- running shell triggers from /var/lib/cobbler/triggers/change/*
- *** TASK COMPLETE ***
- 若看到以下内容:
- dhcpd -t failed
- Exception occured: cobbler.cexceptions.CX
- Exception value: 'cobbler trigger failed: cobbler.modules.sync_post_restart_services'
- ......................................................................
去查看下
/var/log/messages这里一定有你需要的信息
9、然后再重启
xinted、httpd、cobblerd
cobbler sync时会自动启动
dhcpd的服务,不需要单独启动。
重要:用cobbler安装操作系统时,cobbler真正执行的kickstart文件其实不是 /var/lib/cobbler/kickstarts/default.ks,而是 /var/lib/cobbler/kickstarts/sample.ks,当然,这是在默认没有手动指定profile的情况下。
对
ks进行配置,可以参考kickstart的配置,使用system-config-kickstart命令来进行图形化的配置,如果没有这个命令的话,可以yum install system-config-kickstart.noarch来安装。
学习
cobbler配置,最好把kickstart的配置文件也搞懂,默认sample.ks文件会清空硬盘所有分区资料。
下面贴出我的
sample.ks
- [root@cobbler kickstarts]# cat sample.ks
- #platform=x86, AMD64, or Intel EM64T
- # System authorization information
- auth --useshadow --enablemd5
- # System bootloader configuration
- bootloader --location=mbr
- # Partition clearing information
- clearpart --all --initlabel
- # Use text mode install
- lang zh_CN.UTF-8
- #langsupport zh_CN.UTF-8 en_US --default=en_US
- keyboard us
- #mouse generic3ps/2
- timezone Asia/Shanghai
- install
- url --url=$tree
- text
- #zerombr yes
- #Partition clearing information
- part /boot --fstype ext3 --size=100
- part swap --size=2048
- part / --fstype ext3 --size=10000
- network --bootproto static --device eth0 --ip 192.168.1.55 --netmask 255.255.255.0 --gateway=192.168.1.1 --noipv6 --hostname test
- firewall --disabled
- selinux --disabled
- skipx
- # Network information
- #--- Reboot the host after installation is done
- reboot
- #Root password
- rootpw 123456
- %pre
- $SNIPPET('log_ks_pre')
- $SNIPPET('kickstart_start')
- $SNIPPET('pre_install_network_config')
- %packages
- @base
- @core
- @development
- device-mapper-multipath
- imake
- %post
- $SNIPPET('log_ks_post')
- # Start yum configuration
- $yum_config_stanza
- # End yum configuration
- $SNIPPET('post_install_kernel_options')
- #$SNIPPET('post_install_network_config')
- echo "NETWORKING=yes" >/etc/sysconfig/network
- echo "NETWORKING_IPV6=no" >>/etc/sysconfig/network
- echo "HOSTNAME=cobbler" >>/etc/sysconfig/network
- echo "GATEWAY=192.168.1.1">>/etc/sysconfig/network
- echo "nameserver 192.168.1.1" >/etc/resolv.conf
- echo "nameserver 202.106.0.20" >>/etc/resolv.conf
- for service in `chkconfig --list|awk '{print $1}'|egrep -v "^$"|awk -F ":" '{print $1}'`; do chkconfig $service off;done
- for service in crond sshd syslog network; do chkconfig $service on;done
- ulimit -HSn 65535
- echo "this is cobber">/etc/motd
- # Start final steps
- $SNIPPET('kickstart_done')
- # End final steps
10、安装第三方的
repo源
这个源里面有
2726个rpm包,所以如果你安装的话,得看你的的网络是否给力,硬盘空间是否足够了。
下面是我的第三方源的
rpm包个数
- [root@cobbler CentOS]# cd /var/www/cobbler/repo_mirror/rhel-5.3/CentOS/
- [root@cobbler CentOS]# ll|wc -l
- 2726
如果想安装第三放源,可以使用下面命令:
(
1)添加第三方
rpm仓库
- cobbler repo add --name=rhel-5.3 --mirror=http://mirrors.163.com/centos/5/os/i386/
(
2)添加完成后,同步
epel上的文件到本地:
- cobbler reposync
11、设置profile和system:
这里你也可以不用设置
profile,因为默认已经创建了profile,下面是我的cobbler list
如果有多个发行版,则在创建
system的时候就要指定使用哪个发行版了。
添加
profile:
- cobbler profile --name=rhel6 --distro=RHEL6_X86_64-x86_64 --kickstart=/var/lib/cobbler/kickstarts/rhel6.ks
三、使用
koan来实现cobbler重新安装系统
1、这个软件是安装在客户端的,可以对已经存在的客户端进行重新安装,默认的系统光盘里是没有的,必须使用第三方源,这里是
epel软件源,执行yum install koan即可。
2、查看
cobbler server上的配置文件
koan --server=192.168.1.225 --list=profiles
koan --server=192.168.1.225 --list=profiles
3、重新安装客户端系统
koan --replace-self --server=192.168.1.225 --profile=rhel-5.3-i386
reboot
4、reboot重启服务器后,客户端服务器会自动重新安装操作系统
koan --replace-self --server=192.168.1.225 --profile=rhel-5.3-i386
reboot
4、reboot重启服务器后,客户端服务器会自动重新安装操作系统
四、
cobbler的图形化管理
cobbler的使用,主要是集中在上面几个菜单里。这里简单解析一下。
Distros:这个其实就是发行版,类似
Centos,ubuntu,suse。centos6.2和centos6.3,是不同的distros。假设我们导入一个centos6.3的iso,就是增加了一个Distros
Profiles:针对
Distros的设置,一个distros,可以保护多个profiles,包括不同的kickstart文件。源的设置,都是在这里设置。
Systems:针对是每个节点,这里可以指定节点的
ip地址,dns name,还有就是ipmi的用户名和密码,实现远程开机,关机。这是一个重点,日后对机器的操作,全部在sytem的菜单里操作。system里,会指定节点使用哪个profile。
Repos:这个主要是针对
Redhat和Centos有效,可以管理源,并且这些源,可以在profile里添加。比较方便。需要注意的是,对于ubuntu的源,只能在kickstart 脚本里指定。
Images:这个我没用到,看说明主要是针对不能
pxe的机器,采用iso启动。
Kicsstart Templates:这是核心,
cobbler内置了几个ks文件,你如果导入一个centos,系统会默认关联一个ks文件,你不需要做任何设置,就可以把os自动装完。对于ubuntu,我们就需要单独创建一个preseed文件,这些文件可以通过web管理和修改。非常方便。
Snippets:这是
cobbler的精华。一些常用的设置,写成一个模块,让ks文件调用。这样更加灵活。例如centos的网络固定IP地址的设置,就是通过这里实现。
1、安装
cobbler_web
- yum install cobbler-web
2、设置用户名密码:
为已存在的用户重置密码:
- htdigest /etc/cobbler/users.digest "Cobbler" cobbler
- 添加新用户:
- htdigest /etc/cobbler/users.digest "Cobbler" your_newname
3、
web可以登录
- sed -i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf
4、重启
cobbler与http
- service cobblerd restart
- /etc/init.d/httpd restart
如果只是重启
cobbler,那么在web里打开cobbler的时候,就会出现404错误,如下图
5、Cobbler web界面访问地址:
http://192.168.1.225/cobbler_web/ (
192.168.1.225为Cobbler web server地址)
用户与密码是第
2步设置的。
五、使用
vmware来通过Cobbler安装系统
1、新建个虚拟机,选择自定义配置,然后选择下一步
2、硬件兼容性,我选择
workstation 8.0(这个按照你的需要选择),然后选择下一步
3、设置
vmware的如何安装系统时候,不选择镜像,选择以后再安装操作系统,然后选择下一步
4、系统我选择的
rhel5,然后选择下一步
5、虚拟机名字与位置,根据你的需要设置,然后选择下一步
6、处理器核数,我选择默认,然后选择下一步
7、内存大小,我选择
1024MB,然后选择下一步
8、然后再选择网络的时候,选择桥接,然后选择下一步
9、
I/O我选择默认的,然后选择下一步
10、我选择创建一个新的虚拟磁盘,然后选择下一步
11、磁盘类型,我选择
scsi,然后选择下一步
12、磁盘大小,我选择
20GB,由于是测试,所以没不要那么大,然后选择下一步
13、直接默认,然后选择下一步
14、选择完成即可
15、之后启动
vmware的时候,默认就是dhcp安装
16、等
dhcp获取了cobbler的地址,就会出现以下界面,选择我们的rhel-5.3-i386,然后回车
然后等待即可
17、之后就出现以下界面,选择
skip,然后ok
18、如果出现以下界面,选择
Continue,这个界面主要是安装我ks里的packages
19、以下界面是安装刚才的
package界面,等待既可以
20、出现以下界面代表系统安装成功
输入你的账号与密码即可,比如我是账号是
root,密码是ks里的rootpw为123456
21、成功登陆后,发现有个信息为“
this is cobbler”这个是我在ks里设置/etc/motd里的内容
22、在查看一下内存与硬盘分区大小,查看是否与我们在
ks里设置的一样
经过对比,没有发现问题,所以此次使用
vmware来通过cobbler安装rhel 5.3系统成功。
上面的
ks配置与vmware安装系统,为了给大家观看方便,所以在进行vmware安装系统的时候,通过dhcp找到cobbler的ip,然后选择镜像来安装系统,下面是ks配置与操作,是进行自动化安装系统。
1、查看列表
- [root@cobbler centos-6.3]# cobbler list
- distros:
- rhel-5.3-i386
- rhel-5.3-xen-i386
- profiles:
- rhel-5.3-i386
- rhel-5.3-xen-i386
- systems:
- repos:
- rhel-5.3
- images:
- mgmtclasses:
- packages:
- files:
可以看到现在只有
rhel-5.3镜像与配置
2、现在挂载
centos6.3镜像
- [root@cobbler centos-6.3]# cobbler import --path=/mnt/centos-6.3/ --name=centos6.3
- task started: 2012-09-23_074339_import
- task started (id=Media import, time=Sun Sep 23 07:43:39 2012)
- Found a redhat compatible signature: Packages
- adding distros
- creating new distro: centos-6.3-i386
- creating new profile: centos-6.3-i386
- associating repos
- traversing distro centos-6.3-i386
- descent into /var/www/cobbler/ks_mirror/centos-6.3
- processing repo at : /var/www/cobbler/ks_mirror/centos-6.3
- need to process repo/comps: /var/www/cobbler/ks_mirror/centos-6.3
- looking for /var/www/cobbler/ks_mirror/centos-6.3/repodata/*comps*.xml
- running: createrepo -c cache -s sha --groupfile /var/www/cobbler/ks_mirror/centos-6.3/repodata/151ad5b0a3056212a6012b429192adcabba8b37571ff12453d6a29bc5199c943-c6-i386-comps.xml /var/www/cobbler/ks_mirror/centos-6.3
- 3024/3024 - Packages/git-1.7.1-2.el6_0.1.i686.rpm mpm
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
- received on stderr: This option is deprecated
- associating kickstarts
- *** TASK COMPLETE ***
iso镜像导入完成后,查看一下列表
- [root@cobbler images]# cobbler list
- distros:
- centos6.3-i386
- rhel-5.3-i386
- rhel-5.3-xen-i386
- profiles:
- centos6.3-i386
- rhel-5.3-i386
- rhel-5.3-xen-i386
- systems:
- repos:
- rhel-5.3
- images:
- mgmtclasses:
- packages:
- files:
可以看到centos6.3的distro与profile已经有了,但如果我们想使用自己的ks配置,所以直接修改profile
3、
- [root@cobbler images]# cobbler profile edit --name=centos6.3-i386 --distro=centos6.3-i386 --kickstart=/var/lib/cobbler/kickstarts/centos-6.3.ks
- [root@cobbler images]# cobbler list
- distros:
- centos6.3-i386
- rhel-5.3-i386
- rhel-5.3-xen-i386
- profiles:
- centos6.3-i386
- rhel-5.3-i386
- rhel-5.3-xen-i386
- systems:
- repos:
- rhel-5.3
- images:
- mgmtclasses:
- packages:
- files:
4、进行配置同步
- [root@cobbler images]# cobbler sync
- task started: 2012-09-23_104034_sync
- task started (id=Sync, time=Sun Sep 23 10:40:34 2012)
- running pre-sync triggers
- cleaning trees
- removing: /var/www/cobbler/images/rhel-5.3-xen-i386
- removing: /var/www/cobbler/images/rhel-5.3-i386
- removing: /var/www/cobbler/images/centos6.3-i386
- removing: /tftpboot/pxelinux.cfg/default
- removing: /tftpboot/grub/grub-x86_64.efi
- removing: /tftpboot/grub/grub-x86.efi
- removing: /tftpboot/grub/efidefault
- removing: /tftpboot/grub/images
- removing: /tftpboot/s390x/profile_list
- copying bootloaders
- trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /tftpboot/grub/grub-x86_64.efi
- trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /tftpboot/grub/grub-x86.efi
- copying distros to tftpboot
- copying files for distro: rhel-5.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/vmlinuz -> /tftpboot/images/rhel-5.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/initrd.img -> /tftpboot/images/rhel-5.3-i386/initrd.img
- copying files for distro: centos6.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/vmlinuz -> /tftpboot/images/centos6.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/initrd.img -> /tftpboot/images/centos6.3-i386/initrd.img
- copying files for distro: rhel-5.3-xen-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/vmlinuz -> /tftpboot/images/rhel-5.3-xen-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/initrd.img -> /tftpboot/images/rhel-5.3-xen-i386/initrd.img
- copying images
- generating PXE configuration files
- generating PXE menu structure
- copying files for distro: rhel-5.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rhel-5.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/initrd.img -> /var/www/cobbler/images/rhel-5.3-i386/initrd.img
- copying files for distro: centos6.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos6.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos6.3-i386/initrd.img
- copying files for distro: rhel-5.3-xen-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/vmlinuz -> /var/www/cobbler/images/rhel-5.3-xen-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/initrd.img -> /var/www/cobbler/images/rhel-5.3-xen-i386/initrd.img
- rendering DHCP files
- generating /etc/dhcpd.conf
- 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: dhcpd -t -q
- received on stdout:
- received on stderr:
- running: service dhcpd restart
- received on stdout: Shutting down dhcpd: [ OK ]
- Starting dhcpd: [ OK ]
- received on stderr:
- 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 ***
如果想实现自动化安装自动化安装系统的话,需要在cobbler服务端把需要安装机器网卡的mac给记住,然后再根据mac自动化进行安装系统,使客户端不用在通过dhcp获取服务端ip,继而手动选择系统来安装。
下面是我的centos-6.3.ks配置
- [root@cobbler kickstarts]# cat centos-6.3.ks
- #platform=x86, AMD64, or Intel EM64T
- # System authorization information
- auth --useshadow --enablemd5
- # System bootloader configuration
- bootloader --location=mbr
- # Use text mode install
- lang zh_CN.UTF-8
- #langsupport zh_CN.UTF-8 en_US --default=en_US
- keyboard us
- #mouse generic3ps/2
- timezone Asia/Shanghai
- install
- url --url=http://192.168.1.225/cobbler/ks_mirror/centos6.3
- text
- #zerombr yes
- # Partition clearing information
- clearpart --all --initlabel
- #Partition clearing information
- part /boot --fstype ext4 --size=100
- part swap --size=2048
- part / --fstype ext4 --size=10000
- network --bootproto static --device eth0 --ip 192.168.1.30 --netmask 255.255.255.0 --gateway=192.168.1.1 --noipv6 --hostname cobbler
- firewall --disabled
- selinux --disabled
- skipx
- # Network information
- #--- Reboot the host after installation is done
- reboot
- #Root password
- rootpw 111111
- %pre
- $SNIPPET('log_ks_pre')
- $SNIPPET('kickstart_start')
- $SNIPPET('pre_install_network_config')
- %packages
- @base
- @core
- %post
- $SNIPPET('log_ks_post')
- # Start yum configuration
- $yum_config_stanza
- # End yum configuration
- $SNIPPET('post_install_kernel_options')
- #$SNIPPET('post_install_network_config')
- echo "NETWORKING=yes" >/etc/sysconfig/network
- echo "NETWORKING_IPV6=no" >>/etc/sysconfig/network
- echo "HOSTNAME=cobbler" >>/etc/sysconfig/network
- echo "nameserver 192.168.1.1" >/etc/resolv.conf
- echo "nameserver 202.106.0.20" >>/etc/resolv.conf
- for service in `chkconfig --list|awk '{print $1}'|egrep -v "^$"|awk -F ":" '{print $1}'`; do chkconfig $service off;done
- for service in crond sshd syslog network; do chkconfig $service on;done
- ulimit -HSn 65535
- # Start final steps
- $SNIPPET('kickstart_done')
- # End final steps
其实除了对方的mac知道外,如果想制定系统的话,在url --url=http://192.168.1.225/cobbler/ks_mirror/centos6.3
这一块必须手动的输入系统路径,ip是cobbler服务端的ip,这个路径是我们在进行iso导入的时候,文件复制的路径,一般为/var/www/cobbler/ks_mirror,如果想手动选择系统,这一块可以变为url --url=$tree。
现在在服务端还需要知道要安装系统的mac,并且设定ip、dns、hostname等
5、通过绑定mac来进行自动化安装
- [root@cobbler images]# cobbler system add --name=centos6.3-i386 --mac=00:0C:29:A0:26:7F --ip-address=192.168.1.30 --subnet=255.255.255.0 --gateway=192.168.1.1 --interface=eth0 --static=1 --dns-name=202.106.0.20 --profile=centos6.3-i386
- [root@cobbler images]# cobbler list
- distros:
- centos6.3-i386
- rhel-5.3-i386
- rhel-5.3-xen-i386
- profiles:
- centos6.3-i386
- rhel-5.3-i386
- rhel-5.3-xen-i386
- systems:
- centos6.3-i386
- repos:
- rhel-5.3
- images:
- mgmtclasses:
- packages:
- files:
- [root@cobbler images]# cobbler sync
- task started: 2012-09-23_104149_sync
- task started (id=Sync, time=Sun Sep 23 10:41:49 2012)
- running pre-sync triggers
- cleaning trees
- removing: /var/www/cobbler/images/rhel-5.3-xen-i386
- removing: /var/www/cobbler/images/rhel-5.3-i386
- removing: /var/www/cobbler/images/centos6.3-i386
- removing: /tftpboot/pxelinux.cfg/01-00-0c-29-a0-26-7f
- removing: /tftpboot/pxelinux.cfg/default
- removing: /tftpboot/grub/grub-x86_64.efi
- removing: /tftpboot/grub/grub-x86.efi
- removing: /tftpboot/grub/efidefault
- removing: /tftpboot/grub/images
- removing: /tftpboot/grub/01-00-0C-29-A0-26-7F
- removing: /tftpboot/s390x/profile_list
- copying bootloaders
- trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /tftpboot/grub/grub-x86_64.efi
- trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /tftpboot/grub/grub-x86.efi
- copying distros to tftpboot
- copying files for distro: rhel-5.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/vmlinuz -> /tftpboot/images/rhel-5.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/initrd.img -> /tftpboot/images/rhel-5.3-i386/initrd.img
- copying files for distro: centos6.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/vmlinuz -> /tftpboot/images/centos6.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/initrd.img -> /tftpboot/images/centos6.3-i386/initrd.img
- copying files for distro: rhel-5.3-xen-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/vmlinuz -> /tftpboot/images/rhel-5.3-xen-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/initrd.img -> /tftpboot/images/rhel-5.3-xen-i386/initrd.img
- copying images
- generating PXE configuration files
- generating: /tftpboot/pxelinux.cfg/01-00-0c-29-a0-26-7f
- generating: /tftpboot/grub/01-00-0C-29-A0-26-7F
- generating PXE menu structure
- copying files for distro: rhel-5.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rhel-5.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/initrd.img -> /var/www/cobbler/images/rhel-5.3-i386/initrd.img
- copying files for distro: centos6.3-i386
- trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos6.3-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos6.3-i386/initrd.img
- copying files for distro: rhel-5.3-xen-i386
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/vmlinuz -> /var/www/cobbler/images/rhel-5.3-xen-i386/vmlinuz
- trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/initrd.img -> /var/www/cobbler/images/rhel-5.3-xen-i386/initrd.img
- rendering DHCP files
- generating /etc/dhcpd.conf
- 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: dhcpd -t -q
- received on stdout:
- received on stderr:
- running: service dhcpd restart
- received on stdout: Shutting down dhcpd: [ OK ]
- Starting dhcpd: [ OK ]
- received on stderr:
- 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 ***
下面是在vmware里安装系统出现的界面(选择几个重要的内容截图)
如果想知道对方的mac地址,可以查看网络适配器——高级——MAC地址查看
在打开虚拟机的时候,由于在cobble服务端通过mac制定了系统,所以开始的界面为
之后就完全的是自动化安装了,没有什么好说的
10分钟左右,系统安装成功,下面是登录界面
输入账号与密码
可以看到分区大小、类型、ip都是我们配置的
hostname与dns正确
现在cobbler自动化安装系统完成。
六、
FAQ
1、在RHEL 5.4安装
cobbler完的时候需要重启http,但重启发现错误如下
- [root@cobbler cobbler]# service httpd start
- Starting httpd: Syntax error on line 10 of /etc/httpd/conf.d/cobbler.conf:
- Invalid command 'WSGIScriptAliasMatch', perhaps misspelled or defined by a module not included in the server configuration
- [FAILED]
问题在于模块
mod_wsgi.so未启动,手工开启下:编辑/etc/httpd/conf.d/wsgi.conf ,取消注释"LoadModule wsgi_module modules/mod_wsgi.so"即可
- [root@cobbler cobbler]# cat /etc/httpd/conf.d/wsgi.conf
- #################################################################################
- # mod_python and mod_wsgi compatibility note
- #################################################################################
- # mod_wsgi will deadlock if run in daemon mode while mod_python is enabled
- # do not enable both mod_python and mod_wsgi if you are going to use the
- # WSGIDaemonProcess directive
- # In previous version of mod_wsgi, apache would segfault when both mod_wsgi
- # and mod_python were enabled. This update does not guarantee that will not
- # happen.
- #################################################################################
- # Do not enable mod_python and mod_wsgi in the same apache process.
- #################################################################################
- LoadModule wsgi_module modules/mod_wsgi.so
重启
httpd
- [root@cobbler cobbler]# service httpd restart
- Stopping httpd: [FAILED]
- Starting httpd: [Mon Sep 10 02:34:26 2012] [warn] The Alias directive in /etc/httpd/conf/httpd.conf at line 995 will probably never match because it overlaps an earlier Alias.
- [ OK ]
查看端口是否监听
- [root@cobbler cobbler]# lsof -i:80
- COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
- httpd 3128 root 3u IPv6 437066 TCP *:http (LISTEN)
- httpd 3130 apache 3u IPv6 437066 TCP *:http (LISTEN)
- httpd 3131 apache 3u IPv6 437066 TCP *:http (LISTEN)
- httpd 3132 apache 3u IPv6 437066 TCP *:http (LISTEN)
- httpd 3133 apache 3u IPv6 437066 TCP *:http (LISTEN)
- httpd 3134 apache 3u IPv6 437066 TCP *:http (LISTEN)
- httpd 3135 apache 3u IPv6 437066 TCP *:http (LISTEN)
- httpd 3136 apache 3u IPv6 437066 TCP *:http (LISTEN)
- httpd 3137 apache 3u IPv6 437066 TCP *:http (LISTEN)
2、
RHEL5.4启动cobbler的时候出现
- [root@cobbler ~]# /etc/init.d/cobblerd start
- Starting cobbler daemon: No module named ctypes
- Traceback (most recent call last):
- File "/usr/bin/cobblerd", line 76, in main
- api = cobbler_api.BootAPI(is_cobblerd=True)
- File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 127, in __init__
- module_loader.load_modules()
- File "/usr/lib/python2.4/site-packages/cobbler/module_loader.py", line 62, in load_modules
- blip = __import__("modules.%s" % ( modname), globals(), locals(), [modname])
- File "/usr/lib/python2.4/site-packages/cobbler/modules/authn_pam.py", line 53, in ?
- from ctypes import CDLL, POINTER, Structure, CFUNCTYPE, cast, pointer, sizeof
- ImportError: No module named ctypes
- [ OK ]
同时
cobbler锁住
- [root@cobbler ~]# /etc/init.d/cobblerd status
- cobblerd dead but subsys locked
原因是python-ctypes没有安装
解决方法是
yum install python-ctypes
然后再运行
cobbler
- [root@cobbler ~]# /etc/init.d/cobblerd start
- Starting cobbler daemon: [ OK ]
- [root@cobbler ~]# /etc/init.d/cobblerd status
- cobblerd (pid 30812) is running...
3、
启动apache发现
- [root@cobbler tmp]# /etc/init.d/httpd restart
- Stopping httpd: [ OK ]
- Starting httpd: httpd: apr_sockaddr_info_get() failed for cobbler
- httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
- [ OK ]
解决方法是在/etc/hosts里,把ip与主机名对应上
- [root@cobbler tmp]# cat /etc/hosts
- # Do not remove the following line, or various programs
- # that require network functionality will fail.
- 127.0.0.1 localhost.localdomain localhost
- ::1 localhost6.localdomain6 localhost6
- 192.168.1.205 cobbler
- [root@cobbler tmp]# /etc/init.d/httpd restart
- Stopping httpd: [ OK ]
- Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.205 for ServerName
- [ OK ]
4
、如果在安装cobbler的web,打开界面的时候,出现404错误,如下图
说明httpd或者cobbler没有重启,解决方法,重启这2个服务即可
成功后如下图
5
、在centos 6.3系统里,进行cobbler get-loaders获得镜像的时候,发现问题如下
- [root@centos-6 centos-6.3]# cobbler get-loaders
- task started: 2012-09-21_004402_get_loaders
- task started (id=Download Bootloader Content, time=Fri Sep 21 00:44:02 2012)
- path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update
- path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update
- downloading http://dgoodwin.fedorapeople.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
- Exception occured: <class 'urlgrabber.grabber.URLGrabError'>
- Exception value: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'dgoodwin.fedorapeople.org'"
- Exception Info:
- File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 89, in run
- rc = self._run(self)
- File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 183, in runner
- return self.remote.api.dlcontent(self.options.get("force",False), self.logger)
- File "/usr/lib/python2.6/site-packages/cobbler/api.py", line 689, in dlcontent
- return grabber.run(force)
- File "/usr/lib/python2.6/site-packages/cobbler/action_dlcontent.py", line 80, in run
- urlgrabber.grabber.urlgrab(src, filename=dst, proxiesproxies=proxies)
- File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 618, in urlgrab
- return default_grabber.urlgrab(url, filename, **kwargs)
- File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 985, in urlgrab
- return self._retry(opts, retryfunc, url, filename)
- File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 886, in _retry
- r = apply(func, (opts,) + args, {})
- File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 971, in retryfunc
- fo = PyCurlFileObject(url, filename, opts)
- File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 1066, in __init__
- self._do_open()
- File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 1360, in _do_open
- self._do_grab()
- File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 1490, in _do_grab
- self._do_perform()
- File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 1347, in _do_perform
- raise err
- !!! TASK FAILED !!!
解决方法是修改/etc/resolv.conf,增加内容如下:
- [root@centos-6 yum.repos.d]# cat /etc/resolv.conf
- # Generated by NetworkManager
- #search 3
- # No nameservers found; try putting DNS servers into your
- # ifcfg files in /etc/sysconfig/network-scripts like so:
- #
- # DNS1=xxx.xxx.xxx.xxx
- # DNS2=xxx.xxx.xxx.xxx
- # DOMAIN=lab.foo.com bar.foo.com
- nameserver 8.8.8.8
- nameserver 202.106.0.20
本文转自 reinxu 51CTO博客,原文链接:http://blog.51cto.com/dl528888/1004298,如需转载请自行联系原作者