Use cobbler to automatically deploy Linux in batches

Source: Internet
Author: User

Cobbler is a fast network-based linux installation service. It also supports windows installation on the network after adjustment. This tool is developed in python and is small and lightweight. You can use simple commands to configure the PXE network installation environment, and manage DHCP, DNS, and yum package images. Let's implement it step by step.

Lab platform: rhel 6.3 x86_64
 
 
  1. cobbler.laoguang.me     192.168.1.23 
I. Prepare the environment1.1 install dhcp
 
 
  1. yum -y install dhcp 
1.2 install other required services, such as tftp xinetd httpd # transfer files by tftp. tftp depends on xinetd. I am not sure about httpd.
 
 
  1. yum -y install tftp xinetd httpd 
1.3 disable selinux iptables
 
 
  1. setenforce 0 
  2. service iptables stop 
2. Install cobbler2.1 Download and install cobbler with the dependent package python-yaml: http://www.kuaipan.cn/file/id_33139203151758501.html, other platforms can go to http://rpm.pbone.net/find, you can not forget this website
 
 
  1. yum -y --nogpgcheck localinstall cobbler-2.2.2-1.el6.rf.noarch.rpm \
  2. python-yaml-3.09-3.el6.rf.x86_64.rpm 
2.2 start cobbler
 
 
  1. service cobblerd start 
2.3 start httpd
 
 
  1. service httpd start 
2.4 enable xinetd
 
 
  1. service xinetd start 
2.4 cobbler Check Configuration
 
 
  1. cobbler check 
 
 
  1. --------------------------------------------
  2. The following are potential configuration items that you may be want to fix:
  3.  
  4. 1: The 'server' field in/etc/cobbler/settings must be set to something other than localhost,
  5. Or kickstarting features will not work. This shoshould be a resolvable hostname the or IP for boot
  6. Server as reachable by all machines that will use it.
  7.  
  8. Modify the server option in/etc/cobbler/settings:
  9. Server: 192.168.1.23
  10.  
  11. 2: For PXE to be functional, the 'next _ Server' field in/etc/cobbler/settings must be set
  12. Something other than 127.0.0.1, and shoshould match the IP of the boot server on the PXE network.

  13. Modify the next_server option in/etc/cobbler/settings:
  14. Next_server: 192.168.1.23
  15.  
  16. 3: Must enable a selinux boolean to enable vital web services components, run: setsebool-P httpd _
  17. Can_network_connect true
  18.  
  19. Disable selinux
  20.  
  21. 4: you need to set some SELinux content rules to ensure cobbler serves content correctly in your
  22. SELinux environment, run the following:/usr/sbin/semanage fcontext-a-t public_content_t "/var/
  23. Lib/tftpboot/. * "&/usr/sbin/semanage fcontext-a-t public_content_t"/var/www/cobbler "/images /.*
  24.  
  25. Disable selinux
  26.  
  27. 5: you need to set some SELinux rules if you want to use cobbler-web (an optional package), run the following:
  28. /Usr/sbin/semanage fcontext-a-t httpd_sys_content_rw_t "/var/lib/cobbler/webui_sessions /.*"
  29.  
  30. Disable selinux
  31.  
  32. 6: some network boot-loaders are missing from/var/lib/cobbler/loaders, you may run 'cobbler get-loaders'
  33. To download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed
  34. A * recent * version of the syslinux package installed and can ignore this message entirely. Files in this directory,
  35. Shocould you want to support all ubuntures, shocould include pxelinux.0, menu. c32, elilo. efi, and yaboot.
  36. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
  37.  
  38. Run cobbler get-loaders
  39. Cobbler get-loaders # If you can access the Internet, *** task complete *** indicates OK.
  40.  
  41. 7: change 'disable' to 'no' in/etc/xinetd. d/rsync
  42.  
  43. We do not need to use rysnc to synchronize files. If so, modify/etc/xinetd. d/rsync.
  44. Vi/etc/xinetd. d/rsync
  45. Disable = no
  46.  
  47. 8: reposync is not installed, need for cobbler reposync, install/upgrade yum-utils?
  48.  
  49. You can ignore this because rsync is not used to synchronize ISO.
  50.  
  51. 9: yumdownloader is not installed, needed for cobbler repo add with -- rpm-list parameter, install/upgrade yum-utils?
  52.  
  53. Same as above
  54.  
  55. 10: debmirror package is not installed, it will be required to manage debian deployments and repositories
  56.  
  57. We don't need to worry about debian.
  58.  
  59. 11: ksvalidator was not found, install pykickstart
  60.  
  61. Install pykickstart
  62. Yum-y install pykickstart
  63.  
  64. 12: The default password used by the sample templates for newly installed machines (default_password_crypted
  65. In/etc/cobbler/settings) is still set to 'jobbler' and shoshould be changed, try: "openssl passwd-1-salt 'random-phrase-here'
  66. 'Your-password-here '"to generate new one
  67.  
  68. Modify the cobbler password to prevent other normal hosts from installing the system after being started by pxe.
  69. Openssl passwd-1-salt 51cto laoguang # generate a password
  70. $1 $ 51cto $ nTnuekFUB6sByi97bt7df/# copy it to setting
  71. Vi/etc/cobbler/settings
  72. Default_password_crypted: "$1 $ 51cto $ nTnuekFUB6sByi97bt7df /"
  73. -----------------------------------------
2.5 restart cobbler
 
 
  1. service cobblerd restart 
3. cobbler Configuration3.1 import the image file of the system to be installed and mount the redhat 6.3 x86_64 ISO/cdrom
 
 
  1. mount /dev/cdrom /cdrom 
Import the required installation file to/var/www/cobbler/ks_mirrors of cobbler and generate a profile. This process takes some time and waits patiently.
 
 
  1. cobbler import --path=/cdrom --name=RedHat-6.3-x86_64 
3.2 configure the dhcp service to allow cobbler to manage
 
 
  1. vi /etc/cobbler/settings 
  2. manage_dhcp: 1 
3.3 modify the configuration in the/etc/cobbler/dhcp. template file. Use the default settings for other settings.
 
 
  1. Vi/etc/cobbler/dhcp. template
  2.  
  3. Subnet 192.168.1.0 netmask 255.255.255.0 {# modify as needed
  4. Option routers 192.168.1.1; # Route ip
  5. # Option domain-name-servers 192.168.1.1; # ip address of dns, which is not used
  6. Option subnet-mask limit 255.0; # mask
  7. Range dynamic-bootp 192.168.1.100 192.168.1.254; # ip address range allocated by dhcp
  8. Filename "/pxelinux.0 ";
  9. Default-lease-time 21600; # default dhcp release time
  10. Max-lease-time 43200; # maximum time
  11. Next-server $ next_server; # ip address used by pxe. Do you forget what $ next_server defines in setting?
  12. }
3.4 synchronize cobbler configurations
 
 
  1. cobbler sync 
Cobbler automatically performs initialization, removes existing startup items, and copies the loader file according to the template. Then generate the pxe configuration file, generate the dhcp configuration file, and then restart the dhcp service. Check whether dhcp or tftp is successfully started. Iv. test and install the system4.1 create a new virtual machine and remember brige on the network. The new Virtual Machine network is nat by default, so I cannot install it and start the virtual machine, adjust the startup sequence to start from the Network (I use vmware. If you do not have cd iso, it is also possible to directly start a new virtual machine), as shown in

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/03003S040-0.jpg "border =" 0 "alt =" "data-pinit =" registered "/>

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/03003V437-1.jpg "border =" 0 "alt =" "data-pinit =" registered "/>

5. Customize your own kickstart FileCustomizes your own kickstart file instead of using the default one. the kickstart file cobbler is stored in/var/lib/cobbler/kickstarts/to check which one is used by cobbler by default.
 
 
  1. Vi/etc/cobbler/settings
  2. Default_kickstart:/var/lib/cobbler/kickstarts/default. ks # Now, use default. ks.
5.1 customize the kickstart file. If you have a thorough understanding of the kickstart file, you can directly modify or create a new one. If you are still proficient, use the gui tool.
 
 
  1. yum -y install system-config-kickstart 
Open the software after installation
 
 
  1. system-config-kickstart 
According to your need to modify, save after modification, modify settings, restart cobbler can be referred to in this article: http:// OS .51cto.com/art/201109/288604.htm

This article from the "Free Linux, Share Linux" blog, please be sure to keep this source http://laoguang.blog.51cto.com/6013350/1097874

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.