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

Pxe auto-watch script

2025-02-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Is based on the installation experiment on the VMware virtual machine!

#! / bin/bash

# modify IP address

# sed-I's DHCP etc/sysconfig/network-scripts/ifcfg-ens32 DHCP Universe StaticUniverse'/ DHCP

# echo "

# IPADDR=192.168.100.100

# NETMASK=255.255.255.0 "> > / etc/sysconfig/network-scripts/ifcfg-ens32

# systemctl restart network

# configure local yum

# mount / dev/cdrom / mnt

# mkdir / etc/yum.repos.d/bak & & mv / etc/yum.repos.d/C* / etc/yum.repos.d/bak

# echo "

# [base]

# name=base

# baseurl= file:///mnt

# gpgcheck=0

# enabled=1 "> > / etc/yum.repos.d/base.repo

# yum clean all & & yum list

# install dhcp and configure dhcp configuration file

[!-e / etc/dhcp/dhcpd.conf] & & echo "DHCP service is not installed, install it now!"; yum-y install dhcp

Echo "subnet 192.168.220.0 netmask 255.255.255.0 {

Range 192.168.220.10 192.168.220.20

Option routers 192.168.220.115

# option domain-name-servers 114.114.114.114

Next-server 192.168.220.115

Filename\ "pxelinux.0\"

} "> / etc/dhcp/dhcpd.conf

# install tftp and modify configuration files

[!-e / etc/xinetd.d/tftp] & & echo "TFTP is not installed, install now!"; yum-y install tftp-server

Sed-I'/ disable/s/yes/no/' / etc/xinetd.d/tftp

# install syslinux

[!-e / usr/share/syslinux/pxelinux.0] & & yum-y install syslinux

Cp / usr/share/syslinux/pxelinux.0 / var/lib/tftpboot/

# install ftp

[!-e / etc/vsftpd/vsftpd.conf] & & yum-y install vsftpd

Mkdir / var/ftp/centos7

# umount / mnt & & mount / dev/cdrom / var/ftp/centos7/

Mount / dev/cdrom / var/ftp/centos7/

Cp / var/ftp/centos7/images/pxeboot/vmlinuz / var/lib/tftpboot/

Cp / var/ftp/centos7/images/pxeboot/initrd.img / var/lib/tftpboot/

Echo "

# platform=x86, AMD64, or Intel EM64T

# version=DEVEL

# Install OS instead of upgrade

Install

# Keyboard layouts

Keyboard 'us'

# Root password

Rootpw-plaintext 123

# System language

Lang zh_CN

# Firewall configuration

Firewall-disabled

# System authorization information

Auth-useshadow-passalgo=sha512

# Use CDROM installation media

Cdrom

# Use graphical install

Graphical

Firstboot-disable

# SELinux configuration

Selinux-disabled

# Network information

Network-bootproto=dhcp-device=ens32

# Reboot after installation

Reboot

# System timezone

Timezone Asia/Shanghai

# System bootloader configuration

Bootloader-location=mbr

# Partition clearing information

Clearpart-all

# Disk partitioning information

Part / boot-fstype= "xfs"-size=500

Part / home-fstype= "xfs"-size=2048

Part swap-fstype= "swap"-size=2048

Part /-- fstype= "xfs"-- grow-- size=1

% packages

@ gnome-desktop-environment

@ base

@ core

@ desktop-debugging

@ dial-up

@ directory-client

@ fonts

@ gnome-desktop

@ guest-agents

@ guest-desktop-agents

@ input-methods

@ internet-browser

@ java-platform

@ multimedia

@ network-file-system-client

@ networkmanager-submodules

@ print-client

@ x11

Chrony

Kexec-tools

End "> / var/ftp/ks.cfg

# configuration Editing default Startup menu

Mkdir / var/lib/tftpboot/pxelinux.cfg

Echo "

Default auto

Prompt 1

Label auto

Kernel vmlinuz

Append initrd=initrd.img method= ftp://192.168.220.115/centos7 ks= ftp://192.168.220.115/ks.cfg

Label linux text

Kernel vmlinuz

Append text initrd=initrd.img method= ftp://192.168.220.115/centos7

Label linux rescue

Kernel vmlinuz

Append rescue initrd=initrd.img method= ftp://192.168.220.115/centos7

"> / var/lib/tftpboot/pxelinux.cfg/default

Setenforce 0

Systemctl stop firewalld

Systemctl start tftp

Systemctl start dhcpd

Systemctl start vsftpd

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

Servers

Wechat

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

12
Report