KVM under kick start installation

Source: Internet
Author: User
Tags ldap

VMS are easy to install automatically, how do we automate the installation of these KVM?

We have a virtual machine, choose PXE default down, we will see the boot, this virtual machine automatically obtained a 122 network segment IP address, WTF ... But I didn't configure DHCP.

Rpm-q dhcppackage DHCP is not installed

Aw, I didn't even have DHCP installed. Look at the port.

netstat -luntp |grep 67tcp         0      0 :::46367                     :::*                           LISTEN      1893/rpc.statd       udp        0      0 0.0.0.0:67                    0.0.0.0:*                                2378/DNSMASQ 

Oh? Is DNSMASQ, that is, he played the role of DHCP under my virtual machine. Baidu is never find out good things, about the content of this service is particularly chaotic.

DNSMASQ The main configuration file is opened under etc. Take a look. All of them are comment lines? All right..

Keep looking, we finally found the culprit under the/var/lib/libvirt/network/. Back up and make a change to the default!

Ls/var/lib/libvirt/network/default.xml DEFAULT.XML.BK

File contents

warning: this is an auto-generated file. changes to it are  likely to beoverwritten and lost. changes to this xml  configuration should be made using:  virsh net-edit defaultor  Other application using the libvirt api.--><network>  <name> default</name>  <uuid>fe111cda-e2f6-4891-a8b3-0c90e0663ef0</uuid>  < Forward mode= ' Nat '/>  <bridge name= ' virbr0 '  stp= ' on '  delay= ' 0 '  />   <mac address= ' 52:54:00:37:8a:9c '/>  <ip address= ' 192.168.122.1 '   netmask= ' 255.255.255.0 ' >    <dhcp>      <range  start= ' 192.168.122.2 '  end= ' 192.168.122.254 '  />    </dhcp>   </ip></network&gT 

We commented out 3 lines of DHCP:

Restart Service: Failed to create listening socket:address already on use

I......

netstat -lnutp |grep dnstcp        0       0 192.168.122.1:53             0.0.0.0:*                    LISTEN      2378/dnsmasq         udp        0      0  192.168.122.1:53            0.0.0.0:*                                 2378/dnsmasq         udp        0       0 0.0.0.0:67                  0.0.0.0:*                                 2378/dnsmasq

We kill 2378 and then reboot. OK, this time.  

kill 2378service dnsmasq restartstarting dnsmasq:                                            [   OK  ]netstat -lnutp |grep dnstcp         0      0 0.0.0.0:53                   0.0.0.0:*                    LISTEN       3052/dnsmasq        tcp         0      0 :::53                        :::*                          listen       3052/dnsmasq        udp         0      0 0.0.0.0:53                   0.0.0.0:*                                 3052/dnsmasq         udp        0       0 :::53                        :::*                                       3052/dnsmasq

Well. 67 did not listen. Again a virtual machine, sure enough not to assign the address. Okok.

This service is not directly chkconfig off because he listens to 53 has a DNS role. We also have useful.


============================= is just getting ready for work, ==========================================.


Now it's really about the kick start.


1 must be installing the appropriate package.

Yum Install DHCP Syslinux tftp-server-y

There is a conf file under 2/etc/dhcp, we cat

Cat dhcpd.conf## DHCP Server Configuration file.# see/usr/share/doc/dhcp*/dhcpd.conf.sample# See ' Mans 5 dhcpd.conf '

Oh. All right. It's a trick of me. There is no configuration required to go to the above directory to copy.


3 Copy Here, let us vim edit it.

cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf cp:overwrite '/etc/dhcp/dhcpd.conf '? Yvim/etc/dhcp/dhcpd.conf

After going beyond the clutter of unnecessary advanced features and comment lines, the configuration is approximately as follows

Ddns-update-style interim;ignore client-updates;allow bootp;allow booting;option domain-name "haha.com"; option Domain-name-servers 192.168.122.1;default-lease-time 600;max-lease-time 7200;log-facility local7;subnet  192.168.122.0 netmask 255.255.255.0 {range 192.168.122.200 192.168.122.250;  Option Domain-name-servers 192.168.122.1;  Option Domain-name "haha.com";  Option routers 192.168.122.1;  Option broadcast-address 192.168.122.255;  Default-lease-time 600;  Max-lease-time 7200; Next-server 192.168.122.1 filename= "pxelinux.0";

The last next-server meaning is your next server, which is the TFTP server, which I use myself to point to myself.

FileName is the file name that the TFTP automatically looks for. Default pxelinux.0



4 We start DHCP and TFTP separately, note that TFTP is xinetd controlled, chkconfig on restart xinetd.

Service DHCPD startstarting dhcpd: [FAILED]

I....

Look at the log.

2 05:13:55 localhost dhcpd:internet Systems Consortium DHCP Server 4.1.1-p1

2 05:13:55 localhost dhcpd:copyright 2004-2010 Internet Systems Consortium.

2 05:13:55 localhost dhcpd:all rights reserved.

2 05:13:55 localhost dhcpd:for info, please visit https://www.isc.org/software/dhcp/

2 05:13:55 localhost dhcpd:not searching LDAP since Ldap-server, Ldap-port and LDAP-BASE-DN were not specified in th e config file

2 05:13:55 localhost dhcpd:internet Systems Consortium DHCP Server 4.1.1-p1

2 05:13:55 localhost dhcpd:copyright 2004-2010 Internet Systems Consortium.

2 05:13:55 localhost dhcpd:all rights reserved.

2 05:13:55 localhost dhcpd:for info, please visit https://www.isc.org/software/dhcp/

2 05:13:55 localhost dhcpd:can ' t chown new lease File:operation not permitted

2 05:13:55 localhost dhcpd:

2 05:13:55 localhost dhcpd:this version of ISC DHCP is based on the release available

2 05:13:55 localhost dhcpd:on ftp.isc.org. Features has been added and other changes

2 05:13:55 localhost dhcpd:have been made to the base software release on order to make

2 05:13:55 localhost dhcpd:it work better with this distribution.

2 05:13:55 localhost dhcpd:

2 05:13:55 localhost dhcpd:please report for this software via the CentOS Bugs Database:

2 05:13:55 localhost dhcpd:http://bugs.centos.org/

2 05:13:55 localhost dhcpd:

2 05:13:55 localhost dhcpd:exiting.


Well a bunch of inside we easily see Can ' t chown new lease File:operation not permitted is the problem, Baidu a bit ... The method is to change the execution script under/etc/init.d/, and change the user and group to root ...

Action ... Sure enough, OK ...

service dhcpd startstarting dhcpd:                                              [   ok  ]chkconfig tftp on[[email protected] dhcp]# service xinetd  restartstopping xinetd:                                             [FAILED]Starting xinetd:                                               [  ok  ] 

5. The key directories for TFTP are different in different locations. Now in the

Pwd/var/lib/tftpboot

Temporarily he is still empty, we want to copy some things, the first step pack we installed a syslinux, rpm-ql syslinux a bit. We'll find us before we specify file pxelinux.0 in DHCP

RPM-QL syslinux/usr/bin/gethostip# ... Omit 10,000 characters/usr/share/syslinux/pexlinux.0cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/

We also need to copy two key files to that directory, which they all can find on the installation CD.

Initrd.img Vmlinuz
mount centos-6.5-x86_64-bin-dvd1.iso /mnt -o loopcd /mnt/lscentos_buildtag   EULA  images    Packages                   repodata               RPM-GPG-KEY-CentOS-Debug-6      rpm-gpg-key-centos-testing-6efi               GPL   isolinux  RELEASE-NOTES-en-US.html  RPM-GPG-KEY-CentOS-6   rpm-gpg-key-centos-security-6  trans. tblcd isolinux/lsboot.cat  boot.msg  grub.conf  initrd.img   Isolinux.bin  isolinux.cfg  memtest  splash.jpg  trans. tbl  vesamenu.c32  vmlinuzcp initrd.img /var/lib/tftpboot/cp vmlinuz /var/lib/tftpboot/ 

6 There are 3 files under this tftpoot, and we also need to create a folder and create the simplest default configuration

Lsinitrd.img pxelinux.0 vmlinuzmkdir pxelinux.cfgvim defaultdefault localprompt 1timeout 60label locallocalboot 1label I Nstallkernel vmlinuzappend initrd=initrd.img ramdisk_size=8192 ks=http://192.168.122.1/ks/ks.cfg

7 Installing httpd and System-config-kickstart

Create a new directory under/var/www/html Centos.iso mount the CD here, long-term use also write fstab ah.

mount/var/ftp/pub/centos-6.5-x86_64-bin-dvd1.iso/var/www/html/centos.iso/-O loop

Create a directory under/var/www/html KS

command to open System-config-kickstart is a graphical interface that modifies some options.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/C6/wKioL1W-GdDSdj7rAALQGE0tgvo882.jpg "style=" float: none; "title=" QQ picture 20150802210808.png "alt=" Wkiol1w-gddsdj7raalqge0tgvo882.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/C9/wKiom1W-F9zQFOo8AAGv_YKwDgs998.jpg "style=" float: none; "title=" 2.png "alt=" Wkiom1w-f9zqfoo8aagv_ykwdgs998.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/C6/wKioL1W-GdCBgNjOAAJjc4Q3Cok356.jpg "style=" float: none; "title=" 3.png "alt=" Wkiol1w-gdcbgnjoaajjc4q3cok356.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/C9/wKiom1W-F9zgm472AAHAvRenx48131.jpg "style=" float: none; "title=" 4.png "alt=" Wkiom1w-f9zgm472aahavrenx48131.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/C6/wKioL1W-GdGgB8KQAAK6Wuzea3U512.jpg "style=" float: none; "title=" 5.png "alt=" Wkiol1w-gdggb8kqaak6wuzea3u512.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/C9/wKiom1W-F9yA5uJ2AAGpaK90XyI207.jpg "style=" float: none; "title=" 6.jpg "alt=" Wkiom1w-f9ya5uj2aagpak90xyi207.jpg "/>


A little look, it should be silly, the key is to add the HTTP server and directory name, to hit the right, the last script to add a user authentication, I divided a few directories, that is, the minimum disk I have to give 6 G.


When you're done, export a ks.cfg copy to/var/www/html/ks


8 DHCPD xinetd httpd all restarted.

Open a virtual machine to more than 6G of space, PXE

You can see that you got the address. It was written from our DHCP, starting from 200.

In the boot: we enter the label that we just wrote in default, which is the install carriage return.

If everything is OK, next, start installing automatically! (Any need for manual intervention is a problem ~ ~)

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/70/C9/wKiom1W-Gp_gCNqtAAIEOS4xgGc844.jpg "style=" float: none; "title=" 7.png "alt=" Wkiom1w-gp_gcnqtaaieos4xggc844.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/70/C6/wKioL1W-HJSAiomcAAFFaRubPvg946.jpg "style=" float: none; "title=" 8.png "alt=" Wkiol1w-hjsaiomcaaffarubpvg946.jpg "/>


9. Finally enter the system. You can see that the Bob user already exists.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/70/C6/wKioL1W-HiPDlb9nAADY3eDp32M229.jpg "title=" 10.png "alt=" Wkiol1w-hipdlb9naady3edp32m229.jpg "/>

This article is from the "private plots" blog, make sure to keep this source http://bob244.blog.51cto.com/7008351/1681067

KVM under kick start installation

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.