Use PXE to enable self-built dhcp tftp service for unattended centos6 Installation

Source: Internet
Author: User
Tags certmaster
1. Install DHCP TFTP
yum -y install dhcp tftp-server tftp
2. Configure the DHCP File
Cat>/etc/DHCP/DHCPD. conf <EOF # option domain-name "dwhd.org"; # Set dnsoption domain-name-servers 172.16.0.1, 114.114.114.114 for DHCP; # Set the IP address timeout time allocated by DHCP in seconds default-lease-time 86440; # Set dhcplease-time in seconds max-lease-time 100000; log-facility local7; # Set dhcp ip address and mask subnet 192.168.1.0 netmask 255.255.255.0 {# Set DHCP to allocate IP address range 192.168.1.50 192.168.1.70; # Set Route IP Option routers 192.168.1.1; # The following four lines specify the IP address host centos7 {hardware Ethernet 00: 0C: 29: BA: 3C: 76; fixed-address 192.168.1.65;} Based on Mac allocation ;} # If the IP address is obtained from the PXE Nic, the IP address of the server IP address 192.168.1.120 next-server 192.168.1.120 that the NIC will be connected to is displayed; # The PXE Nic contacts the server and tells it to get the pxelinux.0 FILENAME "pxelinux.0";} EOF

650) This. width = 650; "class =" alignnone size-full wp-image-3945 "alt =" 5 "src =" http://www.dwhd.org/wp-content/uploads/2014/07/5.png "width =" 607 "Height =" 290 "/>

3. Check DHCP configuration and start DHCP
[[Email protected] pxelinux. cfg] # service DHCPD configtestsyntax: OK # Check DHCP configuration. If Syntax: OK appears, the configuration is OK # Start Dhcp Service DHCPD start
4. Set TFTP startup
Chkconfig TFTP on [/bash] [bash Highlight = "9,10"] [[email protected] ~] # Netstat-unlactive Internet connections (only servers) proto Recv-Q send-Q local address foreign address stateudp 0 0 0 0.0.0.0: 1005 0.0.0.0: * UDP 0 0 0.0.0.0: 111 0.0.0.0: * UDP 0 0 0.0.0.0: 631 0.0.0.0: * UDP 0 0 0.0.0.0: 776 0.0.0.0: * UDP 0 0 0.0.0.0: 48819 0.0.0.0: * UDP 0 0 0.0.0.0: 67 0.0.0.0: * UDP 0 0 0.0.0.0: 69 0.0.0.0: * UDP 0 0: 1005: * UDP 0 0: 111: * UDP 0 0: 42066:: * ## check whether port 67 69 has been listened on. If yes, It means yes.


I started to prepare for PXE startup. Because I set up the FTP service on the current Windows physical machine, I will directly use the FTP server as the source.

5. Download necessary files to the TFTP directory.
Ftpurl = "ftp: // lookback: [email protected]/centos/6/x86_64/base/" tftpdir = "/var/lib/tftpboot/" for I in vmlinuz initrd. IMG; do wget-o $ {tftpdir} $ I $ {ftpurl} images/pxeboot/$ I; donefor II in splash.jpg vesamenu. c32 boot. MSG isolinux. CFG; do ["$ II" = "isolinux. cfg "] & wget-o $ {tftpdir} default $ {ftpurl}/isolinux/$ iiwget-o $ {tftpdir} $ II $ {ftpurl}/isolinux/$ iidone # install syslinuxyum-y install syslinux # copy pxelinux.0 to the TFTP directory CP $ (rpm-QL syslinux | grep '\ bpxelinux.0 ') /var/lib/tftpboot/# Check the file tree/var/lib/tftpboot/#. The result is the same.

650) This. width = 650; "class =" alignnone size-full wp-image-3943 "alt =" 4 "src =" http://www.dwhd.org/wp-content/uploads/2014/07/4.png "width =" 446 "Height =" 207 "/>

6. Create the KF. cfg file for automatic installation.

Below is my own Ks. cfg. You can change the root password to centos6 based on your needs. This file must be stored in the system during installation. I will store it in FTP on my physical machine.

# Platform = x86, amd64, or Intel em64t # version = devel # firewall configurationfirewall -- disabled # Install OS instead of upgradeinstall # Use Network installationurl -- url = "ftp: // lookback: [email protected]/centos/6/x86_64/base "Repo -- name =" centos "-- baseurl = ftp: // lookback: [email protected]/centos/6/x86_64/base # repo -- name = "fedora epel" -- baseurl = ftp: // lookback: [email protected]/Fedora-epel/6/x86_64/-- C Ost = 1000 # Root passwordrootpw -- iscrypted $6 $ w6.dzk. 2 $ users/z/users # the root password is centos6 # System Authorization informationauth -- useshadow -- passalgo = sha512 # use graphical encryption -- disable # system keyboardkeyboard us # system encryption agelang en_us # SELinux configurationselinux -- disabled # installation logging levello Gging -- level = info # reboot after installationreboot # system timezonetimezone Asia/Shanghai # network informationnetwork -- bootproto = DHCP -- device = eth0 -- onboot = on # system bootloader configurationbootloader -- append = "crashkernel = auto crashkernel = auto rhgb quiet "-- location = MBR -- driveorder =" SDA "# Clear the Master Boot recordzerombr # partition clearing ionionclearpart -- all -- initlabe L # disk partitioning informationpart/boot -- fstype = "ext4" -- size = 200 part pv.001 -- size = 61440 volgroup vg0 -- pesize = 8192 pv.001logvol/-- fstype = ext4 -- vgname = vg0 -- size = 20480 -- name = rootlogvol/var -- fstype = ext4 -- vgname = vg0 -- size = 20480 -- name = varlogvol swap -- name = swap -- vgname = vg0 -- size = 2048 logvol/ USR -- fstype = ext4 -- vgname = vg0 -- size = 10240 -- name = USR % postecho-e 'test centos6 \ nhttp: // www.000. Org \ n'>/etc/issuesed-I '1, [email protected]: [0-9]: initdefault: @ ID: 3: initdefault: @ G'/etc/inittab [! -D/root /. SSH] & mkdir/root /. SSH & chmod og = ---/root /. SSH # below is my own password-free login to the automatically installed system for convenience>/root /. SSH/authorized_keys <EOF ssh-RSA keys/keys + ybmk/keys/bikzdjcydp/keys + keys = [email protected] EOF # enable funcd sed-I '[email protected] =. * @ certmaster = [email protected] '/etc/certmaster/minion. conf/sbin/chkconfig funcd off # Set the hostname clientname = 'ifconfig eth0 | awk'/inet ADDR:/{print $2} '| awk-f. '{print $ NF} ''sed-I" [email protected] =. * @ [email protected] "/etc/sysconfig/networks # Set puppet agent sed-I '/\ [main \]/a server = server.dwhd.org'/etc/puppet. conf/sbin/chkconfig puppet off # Set hostsecho '2017. 16.0.1 server.dwhd.org Server>/etc/hosts # Yum repo % end % packages @ base @ basic-desktop @ Chinese-support @ client-mgmt-tools @ core @ desktop-platform @ development @ fonts @ general-desktop @ graphical-admin-tools @ legacy-x @ network-file-system-client @ Perl-runtime @ remote-desktop-clients @ server-platform- devel @ X11 % end

Modify the boot menu after PXE is started.

vi /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32#prompt 1timeout 60 display boot.msg menu background splash.jpgmenu title Welcome to CentOS 6.5! This is test PXE Auto Installmenu color border 0 #ffffffff #00000000menu color sel 7 #ffffffff #ff000000menu color title 0 #ffffffff #00000000menu color tabmsg 0 #ffffffff #00000000menu color unsel 0 #ffffffff #00000000menu color hotsel 0 #ff000000 #ffffffffmenu color hotkey 7 #ffffffff #ff000000menu color scrollbar 0 #ffffffff #00000000 label pxelinux  menu label ^Auto Install or upgrade an existing system  menu default  kernel vmlinuz  append initrd=initrd.img ks=ftp://lookback:[email protected]/centos/6/ks.cfglabel linux  menu label ^Install or upgrade an existing system  kernel vmlinuz  append initrd=initrd.imglabel vesa  menu label Install system with ^basic video driver  kernel vmlinuz  append initrd=initrd.img xdriver=vesa nomodesetlabel rescue  menu label ^Rescue installed system  kernel vmlinuz  append initrd=initrd.img rescuelabel local  menu label Boot from ^local drive  localboot 0xfffflabel memtest86  menu label ^Memory test  kernel memtest  append -

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/42/C0/wKiom1PYt_CClxpjAACkMMTMjA8828.jpg "style =" float: none; "Title =" 9.png" alt = "wkiom1pyt_cclxpjaackmmja8828.jpg"/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/42/C0/wKioL1PYuRKgQhzTAANA0ezzU7g111.jpg "style =" float: none; "Title =" 10.png" alt = "wkiol1pyurkgqhztaana0ezzu7g111.jpg"/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/42/C0/wKiom1PYt_mRbjGMAAIPdyzaoiw090.jpg "style =" float: none; "Title =" 11.png" alt = "wkiom1pyt_mrbjgmaaipdyzaoiw090.jpg"/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/42/C0/wKioL1PYuRPxk6FVAADNBxUnyHA893.jpg "style =" float: none; "Title =" 12.png" alt = "wkiol1pyurpxk6fvaadnbxunyha893.jpg"/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/42/C0/wKiom1PYt_mh2QtAAADjPtz0Osk970.jpg "style =" float: none; "Title =" 13.png" alt = "wkiom1pyt_mh2qtaaadjptz0osk970.jpg"/>

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/42/C0/wKiom1PYuLuTtb-lAAHjZ2Z2nPM248.jpg "Title =" 15.png" alt = "wKiom1PYuLuTtb-lAAHjZ2Z2nPM248.jpg"/>

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.