Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The installation method of PXE kickstart Automation deployment system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is a detailed introduction to "PXE kickstart automation deployment system installation method" for everyone. The content is detailed, the steps are clear, and the details are properly handled. I hope this article "PXE kickstart automation deployment system installation method" can help you solve your doubts. Let's go deeper and learn new knowledge together with the ideas of Xiaobian.

prepare the environment

System: centos7.4.1708

ip address: eth0: 192.168.10.31; eth2:172.16.1.31 (single network card can be used)

Firewall: Off

selinux: closed

Tool requirements: dhcp;tftp;syslinux;apache;pykickstart

Step 1: Install DHCP service

Installation Services:

[root@kickstart ~]# yum -y install dhcp

Check if the service exists:

[root@kickstart ~]# rpm -qa dhcpdhcp-4.2.5-68.el7.centos.1.x86_64

Configure dhcp profile:

[root@kickstart ~]# cat >>/etc/dhcp/dhcpd.conf range 192.168.10.50 192.168.10.100;> option subnet-mask 255.255.255.0;> default-lease-time 21600;> max-lease-time 43200;> next-server 192.168.10.31;> filename "/pxelinux.0";> }> EOF

Start dhcp service:

[root@kickstart ~]# systemctl start dhcpd.service

View Status:

[root@kickstart ~]# ss -utpln | grep dhcpdudp UNCONN 0 0 *:67 *:* users:(("dhcpd",pid=1643,fd=7)) Step 2: Install tftp service

Installation Services:

[root@kickstart ~]# yum -y install tftp-server

Start tftp service:

[root@kickstart ~]# systemctl start tftp.socket

Install syslinux: If you do not install it, you cannot find the startup file pxelinux.0

[root@kickstart ~]# yum -y install syslinux

Find the pxelinux.0 file:

[root@kickstart ~]# rpm -ql syslinux | grep pxelinux.0/usr/share/syslinux/gpxelinux.0/usr/share/syslinux/pxelinux.0

Copy pxelinux.0 file to tftp root directory

[root@kickstart ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

Create a CD mount directory and mount the CD:

[root@kickstart ~]# mkdir -p /var/www/html/centos7[root@kickstart ~]# mount /dev/cdrom /var/www/html/centos7/mount: /dev/sr0 is write-protected, mounting read-only

Copy everything under isolinux from the CD to tftp:

[root@kickstart ~]# cp /var/www/html/centos7/isolinux/* /var/lib/tftpboot/

Create a directory where pxe configuration files are stored:

[root@kickstart ~]# mkdir -p /var/lib/tftpboot/pxelinux.cfg

And copy the pxe configuration file from the CD to the newly created directory:

[root@kickstart ~]# cp /var/www/html/centos7/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

Go to the directory and backup the default configuration file:

[root@kickstart ~]# mkdir -p /var/www/html/centos7[root@kickstart ~]# mount /dev/cdrom /var/www/html/centos7/mount: /dev/sr0 is write-protected, mounting read-only

Modify default file:

[root@kickstart pxelinux.cfg]# vim default

(Personal preferences, clear configuration files, write abbreviated configurations.) Clear the cursor after the content shortcut key: dG)

The configuration file is as follows:

[root@kickstart pxelinux.cfg]# cat default#yyang centos7 ks installdefault yyang-kstimeout 5prompt 0label yyang-ks kernel vmlinuz append initrd=initrd.img inst.ks=http://192.168.10.31/ks_config/ks.cfg ksdevice=eth0 net.ifnames=0 biosdevname=0

(Note: net.ifnames=0 biosdevname=0 is to replace the version 7 network card with eth name)

Step 3: Install Apache Web Services

Installation Services:

[root@kickstart ~]# yum -y install httpd

Start the service;

[root@kickstart ~]# systemctl start httpd.service

View Status:

[root@kickstart ~]# ss -utpln | grep httpdtcp LISTEN 0 128 :::80 :::* users:(("httpd",pid=2396,fd=4),("httpd",pid=2395,fd=4),("httpd",pid=2394,fd=4),("httpd",pid=2393,fd=4),("httpd",pid=2392,fd=4),("httpd",pid=2391,fd=4))

Login Test: 192.168.10.31/centos7

See the above content shows that the website service configuration is successful

Step 4: Write the KS file

(Refer to anaconda-ks.cfg file for the contents of ks file)

Create ks file storage directory:

[root@kickstart ~]# mkdir -p /var/www/html/ks_config

Go to the directory and write the ks file:

[root@kickstart ~]# cd /var/www/html/ks_config/[root@kickstart ks_config]# vim ks.cfg

The file reads as follows: (The file is an abbreviated version of the reference anaconda-ks.cfg file)

[root@kickstart ks_config]# cat ks.cfg #kickstart config for centos7 by yyanglang en_USkeyboard ustimezone Asia/Shanghairootpw 123123textinstallauth --enableshadow --passalgo=sha512url --url="http://192.168.10.31/centos7"bootloader --location=mbrzerombrclearpart --all --initlabelpart /boot --fstype xfs --size 1024 --ondisk sdapart swap --size 2048 --ondisk sdapart / --fstype xfs --size 1 --grow --ondisk sdaauth --useshadow --enablemd5network --bootproto=dhcp --device=eth0 --onboot=on --ip=192.168.10.50 --netmask=255.255.255.0 --gateway=192.168.10.254 --nameserver=192.168.10.254 --hostname=yyangnetwork --bootproto=static --device=eth2 --onboot=on --ip=172.16.1.50 --netmask=255.255.255.0rebootfirewall --disabledselinux --disabledskipx%packages@compat-libraries@debugging@developmentvimwgettreenmaplrzszdos2unixtelnetbash-completion%end

Install ks file checker:

[root@kickstart ks_config]# yum -y install pykickstart

Check if the KS file is correct:

[root@kickstart ks_config]# ksvalidator ks.cfg

(Not showing anything means correct)

Step 5: Create client and test installation

(Note: The memory of the new virtual machine shall not be less than 2G)

(Note: I use dual network cards, and the LAN segment used by the intranet network card, the experiment can only use one network card)

(If this page appears, there will be no problem with the basic installation.)

Login interface appears, installation is successful

Read here, this article "PXE kickstart automation deployment system installation method" article has been introduced, want to master the knowledge of this article also need to practice to understand, if you want to know more about the content of the article, welcome to pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report