当前位置: 首页 > news >正文

运维自动化之使用Cobbler自动化安装系统与FAQ

以前在没有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源

 
  1. wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm  
  2. 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,更新时如果下载的包不全,就不会进行安装。这样的话,依赖关系可以保重
( 3)安装epel源的好处
就是 epel这个项目是由fedora维护的,在维护的这个源中包含许多软件,包括ntop,nagios之类的,也就是说,你安装了epel源就可以直接用yum install ntop来安装了,贼方便
不过这个应该针对红帽企业版 Linux(RHEL)及其衍生发行版(比如CentOS、Scientific Linux)系统,ubuntu这类的应该不行。
二、安装与配置 cobbler

 
  1. yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes 
安装完成后,启动 cobbler与httpd,然后输入cobbler check

 
  1. [root@cobbler ~]# cobbler check  
  2. The following are potential configuration items that you may want to fix:  
  3.    
  4.  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.  
  5.  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.  
  6.  3 : you need to set some SELinux content rules to ensure cobbler works correctly in your SELinux environment, run the following:  
  7.       /usr/sbin/semanage fcontext -a -t public_content_t "/tftpboot/.*" && \  
  8.       /usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"  
  9.  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.  
  10.  5 : change 'disable' to 'no' in /etc/xinetd.d/tftp  
  11.  6 : change 'disable' to 'no' in /etc/xinetd.d/rsync  
  12.  7 : since iptables may be running, ensure 69, 80, and 25151 are unblocked  
  13.  8 : debmirror package is not installed, it will be required to manage debian deployments and repositories  
  14.  9 : The default password used by the sample templates for newly installed machines  
  15.       (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed,  
  16.       try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one  
  17.    
  18.  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服务配置

 
  1. sed -i '/disable/c\\tdisable\t\t\tno' /etc/xinetd.d/tftp  
  2. sed -i -e 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync   
  3. service xinetd restart  
你的 iptables与selinux也必须关闭

 
  1. chkconfig ip6tables off  
  2. chkconfig iptables off  
  3. /etc/init.d/ip6tables stop  
  4. /etc/init.d/iptables stop  
并且 selinux修改后,需要重启
2、TFTP服务器 IP地址

 
  1. sed -i 's/next_server: 127.0.0.1/next_server: 192.168.1.225/g' /etc/cobbler/settings 
3、cobbler管理 rsync
 

 
  1. sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings 
4、cobbler管理 dhcp

 
  1. 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服务器。

 
  1. subnet 192.168.1.0 netmask 255.255.255.0 {  
  2.      option routers             192.168.1.1;  
  3.      option domain-name-servers 202.106.0.20;  
  4.      option subnet-mask         255.255.255.0;  
  5.      range dynamic-bootp        192.168.1.10 192.168.1.50;  
  6.      filename                   "/pxelinux.0";  
  7.      default-lease-time         21600;  
  8.      max-lease-time             43200;  
  9.      next-server                $next_server;  
  10. }  
6、启动菜单

 
  1. cobbler get-loaders 
7、然后挂载光盘,导入镜像文件

 
  1. [root@cobbler mnt]# mount -o loop /root/rhel-server-5.3-i386-dvd.iso /mnt/rhel/ 
由于 centos里光盘信息比较多,所以导入的时候,会同时创建一个distro,profile。并且还设置的repo。不过这个repo,只包括DVD1,如果希望包括DVD2,还需要做设置才行

 
  1. [root@cobbler mnt]# cobbler import --path=/mnt/rhel/ --name=rhel-server-5.3-i386  
  2. task started: 2012-09-11_225453_import  
  3. task started (id=Media import, time=Tue Sep 11 22:54:53 2012)  
  4. Found a redhat compatible signature: Server  
  5. adding distros  
  6. creating new distro: rhel-server-5.3-i386  
  7. creating new profile: rhel-server-5.3-i386  
  8. creating new distro: rhel-server-5.3-xen-i386  
  9. creating new profile: rhel-server-5.3-xen-i386  
  10. associating repos  
  11. traversing distro rhel-server-5.3-i386  
  12. descent into /var/www/cobbler/ks_mirror/rhel-server-5.3-i386  
  13. processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage  
  14. need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage  
  15. looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage/repodata/*comps*.xml  
  16. 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  
  17. 39/39 - Global_File_System-mr-IN-5.2-1.noarch.rpm                                 
  18. Saving Primary metadata  
  19. Saving file lists metadata  
  20. Saving other metadata  
  21.  
  22. received on stderr: This option is deprecated  
  23.  
  24. processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server  
  25. need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server  
  26. looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server/repodata/*comps*.xml  
  27. 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  
  28. 2216/2216 - m17n-db-kazakh-1.3.3-48.el5.noarch.rpm                              m  
  29. Saving Primary metadata  
  30. Saving file lists metadata  
  31. Saving other metadata  
  32.  
  33. received on stderr: This option is deprecated  
  34.  
  35. processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT  
  36. need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT  
  37. looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT/repodata/*comps*.xml  
  38. 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  
  39. 35/35 - xen-3.0.3-80.el5.i386.rpm                                                 
  40. Saving Primary metadata  
  41. Saving file lists metadata  
  42. Saving other metadata  
  43.  
  44. received on stderr: This option is deprecated  
  45.  
  46. processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster  
  47. need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster  
  48. looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster/repodata/*comps*.xml  
  49. 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  
  50. 32/32 - Cluster_Administration-es-ES-5.2-1.noarch.rpm                             
  51. Saving Primary metadata  
  52. Saving file lists metadata  
  53. Saving other metadata  
  54.  
  55. received on stderr: This option is deprecated  
  56.  
  57. traversing distro rhel-server-5.3-xen-i386  
  58. descent into /var/www/cobbler/ks_mirror/rhel-server-5.3-i386  
  59. processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage  
  60. need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage  
  61. looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/ClusterStorage/repodata/*comps*.xml  
  62. 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  
  63. 39/39 - Global_File_System-mr-IN-5.2-1.noarch.rpm                                 
  64. Saving Primary metadata  
  65. Saving file lists metadata  
  66. Saving other metadata  
  67.  
  68. received on stderr: This option is deprecated  
  69.  
  70. processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server  
  71. need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server  
  72. looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Server/repodata/*comps*.xml  
  73. 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  
  74. 2216/2216 - m17n-db-kazakh-1.3.3-48.el5.noarch.rpm                              m  
  75. Saving Primary metadata  
  76. Saving file lists metadata  
  77. Saving other metadata  
  78.  
  79. received on stderr: This option is deprecated  
  80.  
  81. processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT  
  82. need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT  
  83. looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/VT/repodata/*comps*.xml  
  84. 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  
  85. 35/35 - xen-3.0.3-80.el5.i386.rpm                                                 
  86. Saving Primary metadata  
  87. Saving file lists metadata  
  88. Saving other metadata  
  89.  
  90. received on stderr: This option is deprecated  
  91.  
  92. processing repo at : /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster  
  93. need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster  
  94. looking for /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/Cluster/repodata/*comps*.xml  
  95. 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  
  96. 32/32 - Cluster_Administration-es-ES-5.2-1.noarch.rpm                             
  97. Saving Primary metadata  
  98. Saving file lists metadata  
  99. Saving other metadata  
  100.  
  101. received on stderr: This option is deprecated  
  102.  
  103. associating kickstarts  
  104. *** TASK COMPLETE ***  
导入的镜像存储在 /var/www/cobbler/ks_mirror/这个目录下
cobbler distro list 查看导入结果
8、完成后同步所有配置
每次修改后必须 cobbler sync同步配置

 
  1. [root@cobbler ~]# cobbler sync  
  2. task started: 2012-09-11_233141_sync  
  3. task started (id=Synctime=Tue Sep 11 23:31:41 2012)  
  4. running pre-sync triggers  
  5. cleaning trees  
  6. removing: /var/www/cobbler/images/rhel-server-5.3-xen-i386  
  7. removing: /var/www/cobbler/images/rhel-server-5.3-i386  
  8. removing: /tftpboot/pxelinux.cfg/default  
  9. removing: /tftpboot/grub/images  
  10. removing: /tftpboot/grub/efidefault  
  11. removing: /tftpboot/s390x/profile_list  
  12. copying bootloaders  
  13. copying: /var/lib/cobbler/loaders/pxelinux.0 -> /tftpboot/pxelinux.0  
  14. copying: /usr/lib/syslinux/pxelinux.0 -> /tftpboot/pxelinux.0  
  15. copying: /usr/lib/syslinux/menu.c32 -> /tftpboot/menu.c32  
  16. copying: /var/lib/cobbler/loaders/yaboot -> /tftpboot/yaboot  
  17. copying: /usr/lib/syslinux/memdisk -> /tftpboot/memdisk  
  18. copying distros to tftpboot  
  19. copying files for distro: rhel-server-5.3-xen-i386  
  20. trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/xen/vmlinuz -> /tftpboot/images/rhel-server-5.3-xen-i386/vmlinuz  
  21. 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  
  22. copying files for distro: rhel-server-5.3-i386  
  23. trying hardlink /var/www/cobbler/ks_mirror/rhel-server-5.3-i386/images/pxeboot/vmlinuz -> /tftpboot/images/rhel-server-5.3-i386/vmlinuz  
  24. 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  
  25. copying images  
  26. generating PXE configuration files  
  27. generating PXE menu structure  
  28. copying files for distro: rhel-server-5.3-xen-i386  
  29. 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  
  30. 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  
  31. copying files for distro: rhel-server-5.3-i386  
  32. 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  
  33. 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  
  34. rendering DHCP files  
  35. generating /etc/dhcpd.conf  
  36. rendering TFTPD files  
  37. generating /etc/xinetd.d/tftp  
  38. cleaning link caches  
  39. running post-sync triggers  
  40. running python triggers from /var/lib/cobbler/triggers/sync/post/*  
  41. running python trigger cobbler.modules.sync_post_restart_services  
  42. running: dhcpd -t -q  
  43. received on stdout:   
  44. received on stderr:   
  45. running: service dhcpd restart  
  46. received on stdout: Starting dhcpd: [  OK  ]  
  47.  
  48. received on stderr:   
  49. running shell triggers from /var/lib/cobbler/triggers/sync/post/*  
  50. running python triggers from /var/lib/cobbler/triggers/change/*  
  51. running python trigger cobbler.modules.scm_track  
  52. running shell triggers from /var/lib/cobbler/triggers/change/*  
  53. *** TASK COMPLETE ***  
  54. 看到以下内容即成功:  
  55. running shell triggers from /var/lib/cobbler/triggers/change/*  
  56. *** TASK COMPLETE ***  
  57. 若看到以下内容:  
  58. dhcpd -t failed  
  59. Exception occured: cobbler.cexceptions.CX  
  60. Exception value: 'cobbler trigger failed: cobbler.modules.sync_post_restart_services'  
  61. ......................................................................  
去查看下 /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

 
  1. [root@cobbler kickstarts]# cat sample.ks  
  2. #platform=x86, AMD64, or Intel EM64T  
  3. # System authorization information  
  4. auth  --useshadow  --enablemd5  
  5. # System bootloader configuration  
  6. bootloader --location=mbr 
  7. # Partition clearing information  
  8. clearpart --all --initlabel  
  9. # Use text mode install  
  10. lang zh_CN.UTF-8  
  11. #langsupport zh_CN.UTF-8 en_US --default=en_US 
  12. keyboard us  
  13. #mouse generic3ps/2  
  14. timezone Asia/Shanghai  
  15. install  
  16. url --url=$tree  
  17. text  
  18. #zerombr yes  
  19. #Partition clearing information  
  20. part /boot --fstype ext3 --size=100 
  21. part swap --size=2048 
  22. part / --fstype ext3 --size=10000 
  23. network --bootproto static --device eth0 --ip 192.168.1.55 --netmask 255.255.255.0 --gateway=192.168.1.1 --noipv6 --hostname test  
  24. firewall --disabled  
  25. selinux --disabled  
  26. skipx  
  27. # Network information  
  28. #--- Reboot the host after installation is done    
  29. reboot  
  30.  
  31. #Root password  
  32. rootpw 123456  
  33.  
  34. %pre  
  35. $SNIPPET('log_ks_pre')  
  36. $SNIPPET('kickstart_start')  
  37. $SNIPPET('pre_install_network_config')  
  38. %packages  
  39. @base  
  40. @core  
  41. @development  
  42. device-mapper-multipath  
  43. imake  
  44. %post  
  45. $SNIPPET('log_ks_post')  
  46. # Start yum configuration   
  47. $yum_config_stanza  
  48. # End yum configuration  
  49. $SNIPPET('post_install_kernel_options')  
  50. #$SNIPPET('post_install_network_config')  
  51. echo "NETWORKING=yes>/etc/sysconfig/network  
  52. echo "NETWORKING_IPV6=no>>/etc/sysconfig/network  
  53. echo "HOSTNAME=cobbler>>/etc/sysconfig/network  
  54. echo "GATEWAY=192.168.1.1">>/etc/sysconfig/network  
  55. echo "nameserver  192.168.1.1" >/etc/resolv.conf  
  56. echo "nameserver  202.106.0.20" >>/etc/resolv.conf  
  57. for service in `chkconfig --list|awk '{print $1}'|egrep -v "^$"|awk -F ":" '{print $1}'`; do chkconfig $service off;done  
  58. for service in crond  sshd syslog network; do chkconfig $service on;done  
  59. ulimit -HSn 65535  
  60. echo "this is cobber">/etc/motd  
  61. # Start final steps  
  62. $SNIPPET('kickstart_done')  
  63. # End final steps  
10、安装第三方的 repo源
这个源里面有 2726个rpm包,所以如果你安装的话,得看你的的网络是否给力,硬盘空间是否足够了。
下面是我的第三方源的 rpm包个数

 
  1. [root@cobbler CentOS]# cd /var/www/cobbler/repo_mirror/rhel-5.3/CentOS/  
  2. [root@cobbler CentOS]# ll|wc -l  
  3. 2726  
如果想安装第三放源,可以使用下面命令:
( 1)添加第三方 rpm仓库

 
  1. cobbler repo add --name=rhel-5.3 --mirror=http://mirrors.163.com/centos/5/os/i386/ 
( 2)添加完成后,同步 epel上的文件到本地:

 
  1. cobbler reposync 

11、设置profile和system:

这里你也可以不用设置 profile,因为默认已经创建了profile,下面是我的cobbler list

如果有多个发行版,则在创建 system的时候就要指定使用哪个发行版了。
添加 profile:

 
  1. 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
3、重新安装客户端系统
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

 
  1. yum install cobbler-web 

2、设置用户名密码:
为已存在的用户重置密码:


 
  1. htdigest /etc/cobbler/users.digest "Cobbler" cobbler   
  2. 添加新用户:  
  3. htdigest /etc/cobbler/users.digest "Cobbler" your_newname  
3、 web可以登录

 
  1. sed -i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf 
4、重启 cobbler与http

 
  1. service cobblerd restart  
  2. /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、查看列表

 
  1. [root@cobbler centos-6.3]# cobbler list  
  2. distros:  
  3.    rhel-5.3-i386  
  4.    rhel-5.3-xen-i386  
  5.  
  6. profiles:  
  7.    rhel-5.3-i386  
  8.    rhel-5.3-xen-i386  
  9.  
  10. systems:  
  11.  
  12. repos:  
  13.    rhel-5.3  
  14.  
  15. images:  
  16.  
  17. mgmtclasses:  
  18.  
  19. packages:  
  20.  
  21. files:  
可以看到现在只有 rhel-5.3镜像与配置
2、现在挂载 centos6.3镜像

 
  1. [root@cobbler centos-6.3]# cobbler import --path=/mnt/centos-6.3/ --name=centos6.3  
  2. task started: 2012-09-23_074339_import  
  3. task started (id=Media import, time=Sun Sep 23 07:43:39 2012)  
  4. Found a redhat compatible signature: Packages  
  5. adding distros  
  6. creating new distro: centos-6.3-i386  
  7. creating new profile: centos-6.3-i386  
  8. associating repos  
  9. traversing distro centos-6.3-i386  
  10. descent into /var/www/cobbler/ks_mirror/centos-6.3  
  11. processing repo at : /var/www/cobbler/ks_mirror/centos-6.3  
  12. need to process repo/comps: /var/www/cobbler/ks_mirror/centos-6.3  
  13. looking for /var/www/cobbler/ks_mirror/centos-6.3/repodata/*comps*.xml  
  14. 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  
  15. 3024/3024 - Packages/git-1.7.1-2.el6_0.1.i686.rpm                               mpm  
  16. Saving Primary metadata  
  17. Saving file lists metadata  
  18. Saving other metadata  
  19.  
  20. received on stderr: This option is deprecated  
  21.  
  22. associating kickstarts  
  23. *** TASK COMPLETE ***  
iso镜像导入完成后,查看一下列表

 
  1. [root@cobbler images]# cobbler list  
  2. distros:  
  3.    centos6.3-i386  
  4.    rhel-5.3-i386  
  5.    rhel-5.3-xen-i386  
  6.  
  7. profiles:  
  8.    centos6.3-i386  
  9.    rhel-5.3-i386  
  10.    rhel-5.3-xen-i386  
  11.  
  12. systems:  
  13.  
  14. repos:  
  15.    rhel-5.3  
  16.  
  17. images:  
  18.  
  19. mgmtclasses:  
  20.  
  21. packages:  
  22.  
  23. files:  
可以看到centos6.3的distro与profile已经有了,但如果我们想使用自己的ks配置,所以直接修改profile
3、

  

 

  1. [root@cobbler images]# cobbler profile edit --name=centos6.3-i386 --distro=centos6.3-i386 --kickstart=/var/lib/cobbler/kickstarts/centos-6.3.ks   
  2. [root@cobbler images]# cobbler list  
  3. distros:  
  4.    centos6.3-i386  
  5.    rhel-5.3-i386  
  6.    rhel-5.3-xen-i386  
  7.  
  8. profiles:  
  9.    centos6.3-i386  
  10.    rhel-5.3-i386  
  11.    rhel-5.3-xen-i386  
  12.  
  13. systems:  
  14.  
  15. repos:  
  16.    rhel-5.3  
  17.  
  18. images:  
  19.  
  20. mgmtclasses:  
  21.  
  22. packages:  
  23.  
  24. files:  
4、进行配置同步

 
  1. [root@cobbler images]# cobbler sync  
  2. task started: 2012-09-23_104034_sync  
  3. task started (id=Synctime=Sun Sep 23 10:40:34 2012)  
  4. running pre-sync triggers  
  5. cleaning trees  
  6. removing: /var/www/cobbler/images/rhel-5.3-xen-i386  
  7. removing: /var/www/cobbler/images/rhel-5.3-i386  
  8. removing: /var/www/cobbler/images/centos6.3-i386  
  9. removing: /tftpboot/pxelinux.cfg/default  
  10. removing: /tftpboot/grub/grub-x86_64.efi  
  11. removing: /tftpboot/grub/grub-x86.efi  
  12. removing: /tftpboot/grub/efidefault  
  13. removing: /tftpboot/grub/images  
  14. removing: /tftpboot/s390x/profile_list  
  15. copying bootloaders  
  16. trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /tftpboot/grub/grub-x86_64.efi  
  17. trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /tftpboot/grub/grub-x86.efi  
  18. copying distros to tftpboot  
  19. copying files for distro: rhel-5.3-i386  
  20. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/vmlinuz -> /tftpboot/images/rhel-5.3-i386/vmlinuz  
  21. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/initrd.img -> /tftpboot/images/rhel-5.3-i386/initrd.img  
  22. copying files for distro: centos6.3-i386  
  23. trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/vmlinuz -> /tftpboot/images/centos6.3-i386/vmlinuz  
  24. trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/initrd.img -> /tftpboot/images/centos6.3-i386/initrd.img  
  25. copying files for distro: rhel-5.3-xen-i386  
  26. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/vmlinuz -> /tftpboot/images/rhel-5.3-xen-i386/vmlinuz  
  27. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/initrd.img -> /tftpboot/images/rhel-5.3-xen-i386/initrd.img  
  28. copying images  
  29. generating PXE configuration files  
  30. generating PXE menu structure  
  31. copying files for distro: rhel-5.3-i386  
  32. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rhel-5.3-i386/vmlinuz  
  33. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/initrd.img -> /var/www/cobbler/images/rhel-5.3-i386/initrd.img  
  34. copying files for distro: centos6.3-i386  
  35. trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos6.3-i386/vmlinuz  
  36. trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos6.3-i386/initrd.img  
  37. copying files for distro: rhel-5.3-xen-i386  
  38. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/vmlinuz -> /var/www/cobbler/images/rhel-5.3-xen-i386/vmlinuz  
  39. 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  
  40. rendering DHCP files  
  41. generating /etc/dhcpd.conf  
  42. rendering TFTPD files  
  43. generating /etc/xinetd.d/tftp  
  44. cleaning link caches  
  45. running post-sync triggers  
  46. running python triggers from /var/lib/cobbler/triggers/sync/post/*  
  47. running python trigger cobbler.modules.sync_post_restart_services  
  48. running: dhcpd -t -q  
  49. received on stdout:   
  50. received on stderr:   
  51. running: service dhcpd restart  
  52. received on stdout: Shutting down dhcpd: [  OK  ]  
  53. Starting dhcpd: [  OK  ]  
  54.  
  55. received on stderr:   
  56. running shell triggers from /var/lib/cobbler/triggers/sync/post/*  
  57. running python triggers from /var/lib/cobbler/triggers/change/*  
  58. running python trigger cobbler.modules.scm_track  
  59. running shell triggers from /var/lib/cobbler/triggers/change/*  
  60. *** TASK COMPLETE ***  
如果想实现自动化安装自动化安装系统的话,需要在cobbler服务端把需要安装机器网卡的mac给记住,然后再根据mac自动化进行安装系统,使客户端不用在通过dhcp获取服务端ip,继而手动选择系统来安装。
下面是我的centos-6.3.ks配置

 
  1. [root@cobbler kickstarts]# cat centos-6.3.ks   
  2. #platform=x86, AMD64, or Intel EM64T  
  3. # System authorization information  
  4. auth  --useshadow  --enablemd5  
  5. # System bootloader configuration  
  6. bootloader --location=mbr 
  7. # Use text mode install  
  8. lang zh_CN.UTF-8  
  9. #langsupport zh_CN.UTF-8 en_US --default=en_US 
  10. keyboard us  
  11. #mouse generic3ps/2  
  12. timezone Asia/Shanghai  
  13. install  
  14. url --url=http://192.168.1.225/cobbler/ks_mirror/centos6.3  
  15. text  
  16. #zerombr yes  
  17. # Partition clearing information  
  18. clearpart --all --initlabel  
  19. #Partition clearing information  
  20. part /boot --fstype ext4 --size=100 
  21. part swap --size=2048 
  22. part / --fstype ext4 --size=10000 
  23. network --bootproto static --device eth0 --ip 192.168.1.30 --netmask 255.255.255.0 --gateway=192.168.1.1 --noipv6 --hostname cobbler  
  24. firewall --disabled  
  25. selinux --disabled  
  26. skipx  
  27. # Network information  
  28. #--- Reboot the host after installation is done    
  29. reboot  
  30.  
  31. #Root password  
  32. rootpw 111111  
  33.  
  34. %pre  
  35. $SNIPPET('log_ks_pre')  
  36. $SNIPPET('kickstart_start')  
  37. $SNIPPET('pre_install_network_config')  
  38. %packages  
  39. @base  
  40. @core  
  41. %post  
  42. $SNIPPET('log_ks_post')  
  43. # Start yum configuration   
  44. $yum_config_stanza  
  45. # End yum configuration  
  46. $SNIPPET('post_install_kernel_options')  
  47. #$SNIPPET('post_install_network_config')  
  48. echo "NETWORKING=yes>/etc/sysconfig/network  
  49. echo "NETWORKING_IPV6=no>>/etc/sysconfig/network  
  50. echo "HOSTNAME=cobbler>>/etc/sysconfig/network  
  51. echo "nameserver  192.168.1.1" >/etc/resolv.conf  
  52. echo "nameserver  202.106.0.20" >>/etc/resolv.conf  
  53. for service in `chkconfig --list|awk '{print $1}'|egrep -v "^$"|awk -F ":" '{print $1}'`; do chkconfig $service off;done  
  54. for service in crond  sshd syslog network; do chkconfig $service on;done  
  55. ulimit -HSn 65535  
  56. # Start final steps  
  57. $SNIPPET('kickstart_done')  
  58. # 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来进行自动化安装

 
  1. [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  
  2. [root@cobbler images]# cobbler list  
  3. distros:  
  4.    centos6.3-i386  
  5.    rhel-5.3-i386  
  6.    rhel-5.3-xen-i386  
  7.  
  8. profiles:  
  9.    centos6.3-i386  
  10.    rhel-5.3-i386  
  11.    rhel-5.3-xen-i386  
  12.  
  13. systems:  
  14.    centos6.3-i386  
  15.  
  16. repos:  
  17.    rhel-5.3  
  18.  
  19. images:  
  20.  
  21. mgmtclasses:  
  22.  
  23. packages:  
  24.  
  25. files:  
  26. [root@cobbler images]# cobbler sync  
  27. task started: 2012-09-23_104149_sync  
  28. task started (id=Synctime=Sun Sep 23 10:41:49 2012)  
  29. running pre-sync triggers  
  30. cleaning trees  
  31. removing: /var/www/cobbler/images/rhel-5.3-xen-i386  
  32. removing: /var/www/cobbler/images/rhel-5.3-i386  
  33. removing: /var/www/cobbler/images/centos6.3-i386  
  34. removing: /tftpboot/pxelinux.cfg/01-00-0c-29-a0-26-7f  
  35. removing: /tftpboot/pxelinux.cfg/default  
  36. removing: /tftpboot/grub/grub-x86_64.efi  
  37. removing: /tftpboot/grub/grub-x86.efi  
  38. removing: /tftpboot/grub/efidefault  
  39. removing: /tftpboot/grub/images  
  40. removing: /tftpboot/grub/01-00-0C-29-A0-26-7F  
  41. removing: /tftpboot/s390x/profile_list  
  42. copying bootloaders  
  43. trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /tftpboot/grub/grub-x86_64.efi  
  44. trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /tftpboot/grub/grub-x86.efi  
  45. copying distros to tftpboot  
  46. copying files for distro: rhel-5.3-i386  
  47. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/vmlinuz -> /tftpboot/images/rhel-5.3-i386/vmlinuz  
  48. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/initrd.img -> /tftpboot/images/rhel-5.3-i386/initrd.img  
  49. copying files for distro: centos6.3-i386  
  50. trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/vmlinuz -> /tftpboot/images/centos6.3-i386/vmlinuz  
  51. trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/initrd.img -> /tftpboot/images/centos6.3-i386/initrd.img  
  52. copying files for distro: rhel-5.3-xen-i386  
  53. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/vmlinuz -> /tftpboot/images/rhel-5.3-xen-i386/vmlinuz  
  54. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/initrd.img -> /tftpboot/images/rhel-5.3-xen-i386/initrd.img  
  55. copying images  
  56. generating PXE configuration files  
  57. generating: /tftpboot/pxelinux.cfg/01-00-0c-29-a0-26-7f  
  58. generating: /tftpboot/grub/01-00-0C-29-A0-26-7F  
  59. generating PXE menu structure  
  60. copying files for distro: rhel-5.3-i386  
  61. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/vmlinuz -> /var/www/cobbler/images/rhel-5.3-i386/vmlinuz  
  62. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/pxeboot/initrd.img -> /var/www/cobbler/images/rhel-5.3-i386/initrd.img  
  63. copying files for distro: centos6.3-i386  
  64. trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos6.3-i386/vmlinuz  
  65. trying hardlink /var/www/cobbler/ks_mirror/centos6.3/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos6.3-i386/initrd.img  
  66. copying files for distro: rhel-5.3-xen-i386  
  67. trying hardlink /var/www/cobbler/ks_mirror/rhel-5.3/images/xen/vmlinuz -> /var/www/cobbler/images/rhel-5.3-xen-i386/vmlinuz  
  68. 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  
  69. rendering DHCP files  
  70. generating /etc/dhcpd.conf  
  71. rendering TFTPD files  
  72. generating /etc/xinetd.d/tftp  
  73. cleaning link caches  
  74. running post-sync triggers  
  75. running python triggers from /var/lib/cobbler/triggers/sync/post/*  
  76. running python trigger cobbler.modules.sync_post_restart_services  
  77. running: dhcpd -t -q  
  78. received on stdout:   
  79. received on stderr:   
  80. running: service dhcpd restart  
  81. received on stdout: Shutting down dhcpd: [  OK  ]  
  82. Starting dhcpd: [  OK  ]  
  83.  
  84. received on stderr:   
  85. running shell triggers from /var/lib/cobbler/triggers/sync/post/*  
  86. running python triggers from /var/lib/cobbler/triggers/change/*  
  87. running python trigger cobbler.modules.scm_track  
  88. running shell triggers from /var/lib/cobbler/triggers/change/*  
  89. *** TASK COMPLETE ***  
下面是在vmware里安装系统出现的界面(选择几个重要的内容截图)
如果想知道对方的mac地址,可以查看网络适配器——高级——MAC地址查看

在打开虚拟机的时候,由于在cobble服务端通过mac制定了系统,所以开始的界面为

之后就完全的是自动化安装了,没有什么好说的
10分钟左右,系统安装成功,下面是登录界面

输入账号与密码
可以看到分区大小、类型、ip都是我们配置的

hostname与dns正确

现在cobbler自动化安装系统完成。

 

六、 FAQ
1、在RHEL 5.4安装 cobbler完的时候需要重启http,但重启发现错误如下

 
  1. [root@cobbler cobbler]# service httpd start  
  2. Starting httpd: Syntax error on line 10 of /etc/httpd/conf.d/cobbler.conf:  
  3. Invalid command 'WSGIScriptAliasMatch', perhaps misspelled or defined by a module not included in the server configuration  
  4.                                                            [FAILED]  
问题在于模块 mod_wsgi.so未启动,手工开启下:编辑/etc/httpd/conf.d/wsgi.conf ,取消注释"LoadModule wsgi_module modules/mod_wsgi.so"即可

 
  1. [root@cobbler cobbler]# cat /etc/httpd/conf.d/wsgi.conf   
  2. #################################################################################  
  3. # mod_python and mod_wsgi compatibility note  
  4. #################################################################################  
  5. # mod_wsgi will deadlock if run in daemon mode while mod_python is enabled  
  6. # do not enable both mod_python and mod_wsgi if you are going to use the  
  7. # WSGIDaemonProcess directive  
  8. # In previous version of mod_wsgi, apache would segfault when both mod_wsgi  
  9. # and mod_python were enabled.  This update does not guarantee that will not  
  10. # happen.    
  11. #################################################################################  
  12. # Do not enable mod_python and mod_wsgi in the same apache process.  
  13. #################################################################################  
  14.  
  15. LoadModule wsgi_module modules/mod_wsgi.so  
重启 httpd

 
  1. [root@cobbler cobbler]# service httpd restart  
  2. Stopping httpd:                                            [FAILED]  
  3. 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.  
  4.                                                            [  OK  ]  
查看端口是否监听

 
  1. [root@cobbler cobbler]# lsof -i:80  
  2. COMMAND  PID   USER   FD   TYPE DEVICE SIZE NODE NAME  
  3. httpd   3128   root    3u  IPv6 437066       TCP *:http (LISTEN)  
  4. httpd   3130 apache    3u  IPv6 437066       TCP *:http (LISTEN)  
  5. httpd   3131 apache    3u  IPv6 437066       TCP *:http (LISTEN)  
  6. httpd   3132 apache    3u  IPv6 437066       TCP *:http (LISTEN)  
  7. httpd   3133 apache    3u  IPv6 437066       TCP *:http (LISTEN)  
  8. httpd   3134 apache    3u  IPv6 437066       TCP *:http (LISTEN)  
  9. httpd   3135 apache    3u  IPv6 437066       TCP *:http (LISTEN)  
  10. httpd   3136 apache    3u  IPv6 437066       TCP *:http (LISTEN)  
  11. httpd   3137 apache    3u  IPv6 437066       TCP *:http (LISTEN)  
2、 RHEL5.4启动cobbler的时候出现

 
  1. [root@cobbler ~]# /etc/init.d/cobblerd start  
  2. Starting cobbler daemon: No module named ctypes  
  3. Traceback (most recent call last):  
  4.   File "/usr/bin/cobblerd", line 76, in main  
  5.     api = cobbler_api.BootAPI(is_cobblerd=True)  
  6.   File "/usr/lib/python2.4/site-packages/cobbler/api.py", line 127, in __init__  
  7.     module_loader.load_modules()  
  8.   File "/usr/lib/python2.4/site-packages/cobbler/module_loader.py", line 62, in load_modules  
  9.     blip =  __import__("modules.%s" % ( modname), globals(), locals(), [modname])  
  10.   File "/usr/lib/python2.4/site-packages/cobbler/modules/authn_pam.py", line 53, in ?  
  11.     from ctypes import CDLL, POINTER, Structure, CFUNCTYPE, cast, pointer, sizeof  
  12. ImportError: No module named ctypes  
  13.                                                            [  OK  ]  
同时 cobbler锁住

 
  1. [root@cobbler ~]# /etc/init.d/cobblerd status  
  2. cobblerd dead but subsys locked  
原因是python-ctypes没有安装
解决方法是 yum install python-ctypes
然后再运行 cobbler

 
  1. [root@cobbler ~]# /etc/init.d/cobblerd start  
  2. Starting cobbler daemon:                                   [  OK  ]  
  3. [root@cobbler ~]# /etc/init.d/cobblerd status  
  4. cobblerd (pid 30812) is running...  
3、 启动apache发现

 
  1. [root@cobbler tmp]# /etc/init.d/httpd restart  
  2. Stopping httpd:                                            [  OK  ]  
  3. Starting httpd: httpd: apr_sockaddr_info_get() failed for cobbler  
  4. httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName  
  5.                                                            [  OK  ]  
解决方法是在/etc/hosts里,把ip与主机名对应上

 
  1. [root@cobbler tmp]# cat /etc/hosts  
  2. # Do not remove the following line, or various programs  
  3. # that require network functionality will fail.  
  4. 127.0.0.1       localhost.localdomain localhost  
  5. ::1     localhost6.localdomain6 localhost6  
  6. 192.168.1.205   cobbler  
  7.  
  8. [root@cobbler tmp]# /etc/init.d/httpd restart  
  9. Stopping httpd:                                            [  OK  ]  
  10. Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.205 for ServerName  
  11.                                                            [  OK  ]  
4 、如果在安装cobbler的web,打开界面的时候,出现404错误,如下图

说明httpd或者cobbler没有重启,解决方法,重启这2个服务即可
成功后如下图

5 、在centos 6.3系统里,进行cobbler get-loaders获得镜像的时候,发现问题如下

 
  1. [root@centos-6 centos-6.3]# cobbler get-loaders  
  2. task started: 2012-09-21_004402_get_loaders  
  3. task started (id=Download Bootloader Content, time=Fri Sep 21 00:44:02 2012)  
  4. path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update  
  5. path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update  
  6. downloading http://dgoodwin.fedorapeople.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot  
  7. Exception occured: <class 'urlgrabber.grabber.URLGrabError'> 
  8. Exception value: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'dgoodwin.fedorapeople.org'"  
  9. Exception Info:  
  10.   File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 89, in run  
  11.     rc = self._run(self)  
  12.    File "/usr/lib/python2.6/site-packages/cobbler/remote.py", line 183, in runner  
  13.     return self.remote.api.dlcontent(self.options.get("force",False), self.logger)  
  14.    File "/usr/lib/python2.6/site-packages/cobbler/api.py", line 689, in dlcontent  
  15.     return grabber.run(force)  
  16.    File "/usr/lib/python2.6/site-packages/cobbler/action_dlcontent.py", line 80, in run  
  17.     urlgrabber.grabber.urlgrab(src, filename=dstproxiesproxies=proxies)  
  18.    File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 618, in urlgrab  
  19.     return default_grabber.urlgrab(url, filename, **kwargs)  
  20.    File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 985, in urlgrab  
  21.     return self._retry(opts, retryfunc, url, filename)  
  22.    File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 886, in _retry  
  23.     r = apply(func, (opts,) + args, {})  
  24.    File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 971, in retryfunc  
  25.     fo = PyCurlFileObject(url, filename, opts)  
  26.    File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 1066, in __init__  
  27.     self._do_open()  
  28.    File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 1360, in _do_open  
  29.     self._do_grab()  
  30.    File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 1490, in _do_grab  
  31.     self._do_perform()  
  32.    File "/usr/lib/python2.6/site-packages/urlgrabber/grabber.py", line 1347, in _do_perform  
  33.     raise err  
  34.  
  35. !!! TASK FAILED !!!  
解决方法是修改/etc/resolv.conf,增加内容如下:

 
  1. [root@centos-6 yum.repos.d]# cat /etc/resolv.conf   
  2. # Generated by NetworkManager  
  3. #search 3  
  4.  
  5.  
  6. # No nameservers found; try putting DNS servers into your  
  7. # ifcfg files in /etc/sysconfig/network-scripts like so:  
  8. #  
  9. DNS1=xxx.xxx.xxx.xxx  
  10. DNS2=xxx.xxx.xxx.xxx  
  11. DOMAIN=lab.foo.com bar.foo.com  
  12. nameserver 8.8.8.8  
  13. nameserver 202.106.0.20  

 

相关文章:

  • 凯易讯的笔试
  • 高清电影下载推荐
  • Linux系统启动5个阶段
  • 初学tcp/ip协议
  • hrbeu 哈工程 Who Is In Front of Me
  • Linux命令行下常用svn命令
  • 一个form中对应多个动作
  • 关于技术
  • C语言中堆内存、栈内存、静态数据存储区的理解
  • 对IoC DI的理解
  • Red5/FMS视频直播带宽计算
  • linux系统命令su和su - 区别验证
  • http异步
  • fcntl
  • 注意!ASP.NET MVC 3 的一个 OutputCache 问题
  • [iOS]Core Data浅析一 -- 启用Core Data
  • 《深入 React 技术栈》
  • 【node学习】协程
  • 【翻译】babel对TC39装饰器草案的实现
  • JavaSE小实践1:Java爬取斗图网站的所有表情包
  • js操作时间(持续更新)
  • js递归,无限分级树形折叠菜单
  • JS实现简单的MVC模式开发小游戏
  • leetcode378. Kth Smallest Element in a Sorted Matrix
  • linux学习笔记
  • Node + FFmpeg 实现Canvas动画导出视频
  • React16时代,该用什么姿势写 React ?
  • springMvc学习笔记(2)
  • SQLServer之创建显式事务
  • thinkphp5.1 easywechat4 微信第三方开放平台
  • Transformer-XL: Unleashing the Potential of Attention Models
  • Travix是如何部署应用程序到Kubernetes上的
  • ucore操作系统实验笔记 - 重新理解中断
  • Wamp集成环境 添加PHP的新版本
  • 测试如何在敏捷团队中工作?
  • 从 Android Sample ApiDemos 中学习 android.animation API 的用法
  • 关于List、List?、ListObject的区别
  • 基于阿里云移动推送的移动应用推送模式最佳实践
  • 开源中国专访:Chameleon原理首发,其它跨多端统一框架都是假的?
  • 免费小说阅读小程序
  • 入门级的git使用指北
  • 什么软件可以剪辑音乐?
  • 与 ConTeXt MkIV 官方文档的接驳
  • ​linux启动进程的方式
  • #13 yum、编译安装与sed命令的使用
  • #周末课堂# 【Linux + JVM + Mysql高级性能优化班】(火热报名中~~~)
  • (1)(1.8) MSP(MultiWii 串行协议)(4.1 版)
  • (C语言版)链表(三)——实现双向链表创建、删除、插入、释放内存等简单操作...
  • (Matlab)遗传算法优化的BP神经网络实现回归预测
  • (ZT) 理解系统底层的概念是多么重要(by趋势科技邹飞)
  • (附源码)spring boot基于小程序酒店疫情系统 毕业设计 091931
  • (附源码)springboot高校宿舍交电费系统 毕业设计031552
  • (附源码)计算机毕业设计SSM疫情居家隔离服务系统
  • (一)基于IDEA的JAVA基础1
  • (一)使用Mybatis实现在student数据库中插入一个学生信息