Cobbler and cobbler

Source: Internet
Author: User

Cobbler and cobbler


Introduction:

For the automation of operating system installation, we used Kickstart launched by RedHat to install the operating system in batches. In recent years, RedHat has released a Cobbler.

Cobbler is developed using Python, which is small and lightweight and can complete system installation and even manage some services. (It is known as a tool that can be learned by shoe supplements)

Cobbler supports command line management, web interface management, and API interfaces to facilitate second-step activation.

# Disable SELinux and iptables !!!

1. Support Environment Installation

Shell> yum-y install epel-release # install epel source shell> yum-y install cobbler httpd rsync tftp-server xinetd dhcp pykickstart fence-agents

2. Configure Tftp and Rsync

Shell> vim/etc/xinetd. d/tftpservice tftp {socket_type = dgramprotocol = udpwait = yesuser = rootserver =/usr/sbin/in. tftpdserver_args =-s/var/lib/tftpbootdisable = no # originally yesper_source = 11cps = 100 2 flags = IPv4} shell> vim/etc/xinetd. d/rsyncservice rsync {disable = no # original yesflags = IPv6socket_type = streamwait = nouser = rootserver =/usr/bin/rsyncserver_args = -- users + = USERID} shell> vim/etc/ httpd/confServerName 127.0.0.1: 80

# Everyone knows this.

2. Configure Cobbler

shell > openssl passwd -1 -salt 'random-phrase-here' '123456'$1$random-p$mzxQ/Sx848sXgvfwJCoZM0

# Generate the root password (this password is the root password of the newly installed client)

Shell> vim/etc/cobbler/settingsmanage_dhcp: 1 # original 0manage_tftpd: 1manage_rsync: 1 # original 0next_server: 192.168.214.10 # local IPserver: 192.168.214.10 # local region: "$1 $ random-p $ mzxQ/Sx848sXgvfwJCoZM0" # generated root Password

3. Configure DHCP

Shell> vim/etc/cobbler/dhcp. template # directly modify this file to subnet 192.168.214.0 netmask 255.255.255.0 {option routers 192.168.214.2; option subnet-mask 255.255.255.255.0; range dynamic-bootp 192.168.214.100 192.168.214.120; default-lease-time 21600; max-lease-time 43200; next-server $ next_server;

# Only modify the IP address of this region as the appropriate IP Address

Shell> chkconfig -- add httpdshell> chkconfig -- add xinetdshell> chkconfig -- add dhcpdshell> chkconfig -- add cobblerdshell> service httpd start is starting httpd: shell> service xinetd start is starting xinetd: [OK] shell> service dhcpd start is starting dhcpd: [failed] shell> service cobblerd startStarting cobbler daemon: [OK] shell> cobbler check # check Configuration Traceback (most recent call last): File "/usr/bin/cobbler", line 36, In <module> sys. exit (app. main () File "/usr/lib/python2.6/site-packages/cobbler/cli. py ", line 655, in mainrc = cli. run (sys. argv) File "/usr/lib/python2.6/site-packages/cobbler/cli. py ", line 270, in runself. token = self. remote. login ("", self. shared_secret) 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 _ requestverbose = self. _ verboseFile "/usr/lib64/python2.6/xmlrpclib. py ", line 1253, in requestreturn self. _ parse_response (h. getfile (), sock) File "/usr/lib64/python2.6/xmlrpclib. py ", line 1392, in _ parse_responsereturn u. close () File "/usr/lib64/python2.6/xmlrpclib. py ", line 838, in closeraise Fault (** self. _ stack [0]) xmlrpclib. fault: <Fault 1: "<class 'cobbler. cexceptions. CX '>: 'login failed '"> Shell> cobbler get-loaders (solution) [shell> cobbler check # check again The following are potential configuration items that you may have to fix: 1: service dhcpd is not running2: debmirror package is not installed, it will be required to manage debian deployments and repositoriesRestart cobblerd and then run 'cobbler sync' to apply changes. #1: The system prompts that dhcpd is not running. Ignore it first #2: The system prompts that debmirror is not installed. If you are not installing a system such as debian, ignore this prompt. (If you need to install, for: http://rpmfind.net/linux/rpm2html/search.php? Query = debmirror) shell> cobbler sync # synchronization task started: 2015-05-27_012756_synctask started (id = Sync, time = Wed May 27 01:04:56 2015) running pre-sync triggerscleaning treesmkdir: /var/lib/tftpboot/pxelinux. export mkdir:/var/lib/tftpboot/grubmkdir:/var/lib/tftpboot/s390xmkdir:/var/lib/tftpboot/ppcmkdir:/var/lib/tftpboot/etcremoving: /var/lib/tftpboot/grub/imagescopying bootloaderstrying hardlink/var/lib/cobbler/loaders/pxelinux.0->/var/lib/tftpboot/javashardlink/var/lib/cobbler/ loaders/menu. c32->/var/lib/tftpboot/menu. c32trying hardlink/var/lib/cobbler/loaders/yunct->/var/lib/tftpboot/yuncttrying hardlink/var/lib/cobbler/loaders/grub-x86.efi->/var/lib/ tftpboot/grub/grub-x86.efitrying hardlink/var/lib/cobbler/loaders/grub-x86_64.efi->/var/lib/tftpboot/grub/grub-x86_64.eficopying distros to define imagesgenerating PXE configuration filesgenerating PXE menu Using DHCP filesgenerating /etc/dhcp/dhcpd. confrendering TFTPD filesgenerating/etc/xinetd. d/tftpcleaning link cachesrendering Rsync filesrunning post-sync triggersrunning python triggers from/var/lib/cobbler/triggers/sync/post/* running python trigger cobbler. modules. sync_post_restart_servicesrunning: dhcpd-t-qreceived on stdout: received on stderr: running: service dhcpd restartreceived 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_trackrunning shell triggers from/var/lib/cobbler/triggers/change/*** task complete *** shell> service xinetd restart stop xinetd: [OK] xinetd is being started: [OK] shell> service cobblerd restartStopping cobbler daemon: [OK] Starting cobbler daemon: [OK]

3. Import the installation Source

shell > mount /dev/cdrom /mnt/shell > cobbler import --path=/mnt/ --arch=x86_64 --name=Centos-6.6-minimal

# Output information omitted (Cobbler copies the image to the/var/www/cobbler/ks_mirror/Centos-6.6-minimal-x86_64 directory)
(A release and profile file named Centos-6.6-minimal-x86_64 will also be created)

shell > cobbler listdistros:Centos-6.6-minimal-x86_64profiles:Centos-6.6-minimal-x86_64systems:repos:images:mgmtclasses:packages:files:

4. Create ks files

Shell> vim/var/lib/cobbler/kickstarts/Centos-6.6_minimal-x86_64.ks # platform = x86, AMD64, or Intel EM64T # version = DEVEL # Firewall configurationfirewall -- disabled # Install OS instead of upgradeinstall # Use network installationurl -- url = "http: // 192.168.214.10/cobbler/ks_mirror/Centos-6.6-minimal-x84_64/"# Root passwordrootpw -- iscrypted $1 $ hk0MvN4A $ Dz. login # System authorization informationauth -- useshadow -- passalgo = sha512 # Use text mode installtext # System authentication us # System authentication agelang zh_CN # SELinux configurationselinux -- disabled # Do not configure the X Window Systemskipx # Installation logging levellogging -- level = info # Reboot after installationreboot # System timezonetimezone -- isUtc Asia/Shanghai # Network informationnetwork -- bootproto = dhcp -- device = eth0 -- onboot = on # System bootloader configurationbootloader -- location = mbr # Clear the Master Boot Recordzerombr # Partition clearing informationclearpart -- all -- initlabel # Disk partitioning informationpart/boot -- fstype = "ext4" -- size = 200 part swap -- fstype = "swap" -- size = 1024 part/-- fstype = "ext4" -- grow -- size = 1

# This is the ks file generated on the GUI by installing system-config-kickstart.
# Do I see a Chinese character in the comment line of the first line? This is the Chinese character that left me stuck for two days... (do not include Chinese characters in the file)

5. Associate ks files

shell > cobbler distro listCentos-6.6-minimal-x86_64

# There is an image

shell > cobbler profile report --name Centos-6.6-minimal-x86_64Name : Centos-6.6-minimal-x86_64TFTP Boot Files : {}Comment :DHCP Tag : defaultDistribution : Centos-6.6-minimal-x86_64Enable gPXE? : 0Enable PXE Menu? : 1Fetchable Files : {}Kernel Options : {}Kernel Options (Post Install) : {}Kickstart : /var/lib/cobbler/kickstarts/sample_end.ksKickstart Metadata : {}Management Classes : []Management Parameters : <<inherit>>Name Servers : []Name Servers Search Path : []Owners : ['admin']Parent Profile :Proxy :Red Hat Management Key : <<inherit>>Red Hat Management Server : <<inherit>>Repos : []Server Override : <<inherit>>Template Files : {}Virt Auto Boot : 1Virt Bridge : xenbr0Virt CPUs : 1Virt Disk Driver Type : rawVirt File Size(GB) : 5Virt Path :Virt RAM (MB) : 512Virt Type : kvm

# The default ks file used for this image is/var/lib/cobbler/kickstarts/sample_end.ks.

shell > cobbler profile add --name=Centos-6.6-minimal --distro=Centos-6.6-minimal-x86_64 --kickstart=/var/lib/cobbler/kickstarts/Centos-6.6_minimal-x86_64.ks

# Check whether the association is successful again after Association

shell > cobbler profile report --name Centos-6.6-minimalName : Centos-6.6-minimalTFTP Boot Files : {}Comment :DHCP Tag : defaultDistribution : Centos-6.6-minimal-x86_64Enable gPXE? : 0Enable PXE Menu? : 1Fetchable Files : {}Kernel Options : {}Kernel Options (Post Install) : {}Kickstart : /var/lib/cobbler/kickstarts/Centos-6.6_minimal-x86_64.ksKickstart Metadata : {}Management Classes : []Management Parameters : <<inherit>>Name Servers : []Name Servers Search Path : []Owners : ['admin']Parent Profile :Proxy :Red Hat Management Key : <<inherit>>Red Hat Management Server : <<inherit>>Repos : []Server Override : <<inherit>>Template Files : {}Virt Auto Boot : 1Virt Bridge : xenbr0Virt CPUs : 1Virt Disk Driver Type : rawVirt File Size(GB) : 5Virt Path :Virt RAM (MB) : 512Virt Type : xenpv

# Associated successfully!

shell > cobbler --helpusage=====cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ...[add|edit|copy|getks*|list|remove|rename|report] [options|--help]cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version|signature|get-loaders|hardlink> [options|--help]shell > cobbler profile --helpusage=====cobbler profile addcobbler profile copycobbler profile dumpvarscobbler profile editcobbler profile findcobbler profile getkscobbler profile listcobbler profile removecobbler profile renamecobbler profile report

# There are multiple ways to add, edit, and remove a file. (when using this tool, consider it yourself ).

shell > cobbler sync

# Synchronize configurations and test the client startup

# After booting from the network, there will be a selection list. Select to install profile to automatically complete the installation.

# After modifying the ks. cfg file, it will take effect without sync!

# Open TCP (69, 80, 25151) ports if you do not want to disable the firewall.

# If you encounter any problem, check that ks. cfg cannot contain Chinese characters, and the comment line cannot be used!

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.