程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> JAVA綜合教程 >> 自動化運維之cobbler批量部署操作系統(一)

自動化運維之cobbler批量部署操作系統(一)

編輯:JAVA綜合教程

自動化運維之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.
  1. yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes -y
2.
  1. cobbler check 檢驗cobbler,根據提示一步步解決問題
[root@bogon yum.repos.d]# cobbler check
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,提示如下:

  1. [root@bogon yum.repos.d]# cobbler check
  2. The following are potential configuration items that you may want to fix:

  3. 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.
  4. 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.
  5. 3 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
  6. https://github.com/cobbler/cobbler/wiki/Selinux
  7. 4 : change 'disable' to 'no' in /etc/xinetd.d/tftp
  8. 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.
  9. 6 : change 'disable' to 'no' in /etc/xinetd.d/rsync
  10. 7 : file /etc/xinetd.d/rsync does not exist
  11. 8 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked
  12. 9 : debmirror package is not installed, it will be required to manage debian deployments and repositories
  13. 10 : ksvalidator was not found, install pykickstart
  14. 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
  15. 12 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

  16. Restart cobblerd and then run 'cobbler sync' to apply changes.
除了第9.10.12這三個不用特別關注外,其他都需要修改,根據提示很簡單。

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查看一下

  1. [root@bogon ~]# cobbler report
  2. distros:
  3. ==========
  4. Name : CentOS5.8-xen-x86_64
  5. Architecture : x86_64
  6. TFTP Boot Files : {}
  7. Breed : redhat
  8. Comment :
  9. Fetchable Files : {}
  10. Initrd : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/xen/initrd.img
  11. Kernel : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/xen/vmlinuz
  12. Kernel Options : {}
  13. Kernel Options (Post Install) : {}
  14. Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS5.8-xen-x86_64'}
  15. Management Classes : []
  16. OS Version : rhel5
  17. Owners : ['admin']
  18. Red Hat Management Key : <<inherit>>
  19. Red Hat Management Server : <<inherit>>
  20. Template Files : {}

  21. Name : CentOS5.8-x86_64
  22. Architecture : x86_64
  23. TFTP Boot Files : {}
  24. Breed : redhat
  25. Comment :
  26. Fetchable Files : {}
  27. Initrd : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/pxeboot/initrd.img
  28. Kernel : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/pxeboot/vmlinuz
  29. Kernel Options : {}
  30. Kernel Options (Post Install) : {}
  31. Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS5.8-x86_64'}
  32. Management Classes : []
  33. OS Version : rhel5
  34. Owners : ['admin']
  35. Red Hat Management Key : <<inherit>>
  36. Red Hat Management Server : <<inherit>>
  37. Template Files : {}


  38. profiles:
  39. ==========
  40. Name : CentOS5.8-xen-x86_64
  41. TFTP Boot Files : {}
  42. Comment :
  43. DHCP Tag : default
  44. Distribution : CentOS5.8-xen-x86_64
  45. Enable gPXE? : 0
  46. Enable PXE Menu? : 1
  47. Fetchable Files : {}
  48. Kernel Options : {}
  49. Kernel Options (Post Install) : {}
  50. Kickstart : /var/lib/cobbler/kickstarts/sample.ks kickstart路徑
  51. Kickstart Metadata : {}
  52. Management Classes : []
  53. Management Parameters : <<inherit>>
  54. Name Servers : []
  55. Name Servers Search Path : []
  56. Owners : ['admin']
  57. Parent Profile :
  58. Internal proxy :
  59. Red Hat Management Key : <<inherit>>
  60. Red Hat Management Server : <<inherit>>
  61. Repos : []
  62. Server Override : <<inherit>>
  63. Template Files : {}
  64. Virt Auto Boot : 1
  65. Virt Bridge : xenbr0
  66. Virt CPUs : 1
  67. Virt Disk Driver Type : raw
  68. Virt File Size(GB) : 5
  69. Virt Path :
  70. Virt RAM (MB) : 512
  71. Virt Type : xenpv

  72. Name : CentOS5.8-x86_64
  73. TFTP Boot Files : {}
  74. Comment :
  75. DHCP Tag : default
  76. Distribution : CentOS5.8-x86_64
  77. Enable gPXE? : 0
  78. Enable PXE Menu? : 1
  79. Fetchable Files : {}
  80. Kernel Options : {}
  81. Kernel Options (Post Install) : {}
  82. Kickstart : /var/lib/cobbler/kickstarts/sample.ks
  83. Kickstart Metadata : {}
  84. Management Classes : []
  85. Management Parameters : <<inherit>>
  86. Name Servers : []
  87. Name Servers Search Path : []
  88. Owners : ['admin']
  89. Parent Profile :
  90. Internal proxy :
  91. Red Hat Management Key : <<inherit>>
  92. Red Hat Management Server : <<inherit>>
  93. Repos : []
  94. Server Override : <<inherit>>
  95. Template Files : {}
  96. Virt Auto Boot : 1
  97. Virt Bridge : xenbr0
  98. Virt CPUs : 1
  99. Virt Disk Driver Type : raw
  100. Virt File Size(GB) : 5
  101. Virt Path :
  102. Virt RAM (MB) : 512
  103. Virt Type : kvm


  104. systems:
  105. ==========

  106. repos:
  107. ==========

  108. images:
  109. ==========

  110. mgmtclasses:
  111. ==========

  112. packages:
  113. ==========

  114. files:
  115. ==========


  1. [root@bogon ~]# cobbler distro list
  2. CentOS5.8-x86_64
  3. CentOS5.8-xen-x86_64
5.客戶端使用pxe網絡啟動即自動進行安裝了。




補充:
#重命名安裝選項名字:
cobbler profile rename --name='old name' –newname='new name'
#冊除選項:
cobbler profile rename --name='old name'




















  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved