PXE + kickstart-- batch installed for network

The experiment: the use of network software installed automatic batch

Experimental environment: a linux desktop version, more than one new virtual machines in the same local area network

Experimental Procedure:

1. The system is installed on the desktop software dependencies

[root@localhost ~]# yum -y install dhcp tftp tftp-server vsftpd syslinux system-config-kickstart

2. Modify tftp configuration file, modify the tftp root directory is / tftpboot

[root@localhost ~]# vim /etc/xinetd.d/tftp
 1 service tftp
 2 {
 3         socket_type             = dgram
 4         protocol                = udp
 5         wait                    = yes
 6         user                    = root
 7         server                  = /usr/sbin/in.tftpd
 8         server_args             = -s /tftpboot   #改为/tftpboot
 9         disable                 = no      #yes改为no
10         per_source              = 11
11         cps                     = 100 2
12         flags                   = IPv4
13 }

3. Create tftp root directory and subdirectories

[root@localhost ~]# mkdir -p /tftpboot/pxelinux.cfg

4. Mount the installation CD into anonymous login directory of vsftp

[the root @ localhost ~] # mkdir / var / FTP / Pub / CD 
[the root @ localhost ~] # Mount / dev / SR0 / / var / FTP / Pub / CD # Note that the optical disk mounted position copy the kernel and the boot files to the tftp directory under

5. Copy the file to the core and the guide tftp directory

[the root @ localhost ~] # CP / var /ftp/pub/cd/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/ default 
[the root @ localhost ~] # the chmod 644 /tftpboot/pxelinux.cfg/ default     # imparting file write permissions

  Copy the file to install the boot tftp root directory :

[root@localhost ~]# cp -a /var/ftp/pub/cd/isolinux/vmlinuz /tftpboot/
[root@localhost ~]# cp -a /var/ftp/pub/cd/isolinux/initrd.img /tftpboot/
[root@localhost ~]# cp -a /usr/share/syslinux/pxelinux.0 /tftpboot/

6. generate DHCP configuration file and edit

[root@localhost ~]# cp /usr/share/doc/dhcp-4.*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
Subnet 192.168 . 135.0 Netmask 255.255 . 255.0 {# network address and subnet mask 
  Range 192.168 . 135.100  192.168 . 135.200 ; # statement dhcp assigned IP range 
  Option Domain -name NSl-Servers. Internal .example.org; #dhcp assigned the domain name default -lease-Time 600 ; 
  max -lease-Time 7200 ; 
  filename " the pxelinux.0 " ; # this declaration file allocation dhcp 
  Next -server 192.168 . 135.50 ; dhcp tells the location of the file, that is, native IP 
}

 Start related services

[root@localhost ~]# service dhcpd start
[root@localhost ~]# service vsftpd start
[root@localhost ~]# service xinetd start

7. Edit default file, modify the boot parameters

/tftpboot/pxelinux.cfg/ Vim default
  
. 1 # default vesamenu.c32 first comment line #
 2 #prompt . 1 
. 3 timeout 600 
. 4  the display the boot.msg
 . 5  default Linux add this line #

8. Start the network configuration software installed batch

[Root @ localhost ~] # system-config-kickstart # configured as a graphical interface, it is necessary to use the mouse to click

Basic configuration: set the time zone and the current location of the root user password

Installation Methods: FTP, server address ftp: // the local IP, directory mount point created earlier

Partition information: select to clear the master boot record, delete all partitions, initialize the disk label and manually create a new partition, click on the red box Add to create a partition

 

Network Configuration: adding a network device in the device information named eth0, network type as DHCP

Firewall Configuration: You can disable the firewall

Package Selection: Selects

After the installation script: write modify the local script yum source

rm -rf /etc/yum.repos.d/*
echo "
[a]
name=a
baseurl=ftp://192.168.1.101/pub/cd
enabled=1
gpgcheck=0" > /etc/yum.repos.d/a.repo

Save the configuration file to the / var / ftp / pub directory (the top left click the mouse to pop up the save)

9. Modify ks.cfg, add a line at the end of the file reboot

[the root @ localhost ~] # / Vim var /ftp/pub/ks.cfg # reboot by adding a line to the end

10. Edit boot file location of the client to automatically inform the mounting configuration

[root@localhost ~]# vim /tftpboot/pxelinux.cfg/default
label linux #找到此标签
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append initrd=initrd.img ks=ftp://192.168.135.50/pub/ks.cfg #此行添加ftpks.cfg文件路径

11.开启新建的虚拟机测试即可

 

Guess you like

Origin www.cnblogs.com/shenshuilong/p/11141360.html