centos 8 pxe 网络安装

syslinux-nonlinux

yum install syslinux-nonlinux

要用到syslinux-nonlinux中的pxelinux.0文件 ,放到tftp工作目录下。默认为var/lib/tftpboot。

tftp安装配置

dnf install ftp-server

 tftp配置

[root@localhost tftpboot]# pwd
/var/lib/tftpboot
[root@localhost tftpboot]# tree
.
├── initrd.img
├── ldlinux.c32
├── libcom32.c32
├── libutil.c32
├── menu.c32
├── pxelinux.0
├── pxelinux.cfg
│   └── default
├── vesamenu.c32
└── vmlinuz

1 directory, 9 files

 pxelinux.cfg/default文件内容

default vesamenu.c32
timeout 600

display boot.msg

# Clear the screen when exiting the menu, instead of leaving the menu displayed.
# For vesamenu, this means the graphical background is still displayed without
# the menu itself for as long as the screen remains in graphics mode.
menu clear
menu background splash.png
menu title CentOS Linux 8
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13

# Border Area
menu color border * #00000000 #00000000 none

# Selected item
menu color sel 0 #ffffffff #00000000 none

# Title bar
menu color title 0 #ff7ba3d0 #00000000 none

# Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none

# Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none

# Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 none

# Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none

# Help text
menu color help 0 #ffffffff #00000000 none

# A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none

# Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none

# Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none

# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.

menu tabmsg Press Tab for full configuration options on menu items.

menu separator # insert an empty line
menu separator # insert an empty line

label linux
  menu label ^Install CentOS Linux 8
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=http://192.168.0.21/ksdir/ks8.cfg

label manual
  menu label ^Manual Install CentOS Linux 8.0
  kernel vmlinuz
  append initrd=initrd.img inst.repo=http://192.168.0.21/centos/8/isos/x86_64/

label check
  menu label Test this ^media & install CentOS Linux 8
  menu default
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CentOS-8-1-1911-x86_64-dvd rd.live.check quiet

menu separator # insert an empty line

# utilities submenu
menu begin ^Troubleshooting
  menu title Troubleshooting

label vesa
  menu indent count 5
  menu label Install CentOS Linux 8 in ^basic graphics mode
  text help
        Try this option out if you're having trouble installing
        CentOS Linux 8.
  endtext
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CentOS-8-1-1911-x86_64-dvd nomodeset quiet

label rescue
  menu indent count 5
  menu label ^Rescue a CentOS Linux system
  text help
        If the system will not boot, this lets you access files
        and edit config files to try to get it booting again.
  endtext
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=CentOS-8-1-1911-x86_64-dvd rescue quiet

label memtest
  menu label Run a ^memory test
  text help
        If your system is having issues, a problem with your
        system's memory may be the cause. Use this utility to
        see if the memory is working correctly.
  endtext
  kernel memtest

menu separator # insert an empty line

label local
  menu label Boot from ^local drive
  localboot 0xffff

menu separator # insert an empty line
menu separator # insert an empty line

label returntomain
  menu label Return to ^main menu
  menu exit

menu end

 DHCP服务器配置

 DualServer.ini

#tftp服务器配置
[00:e0:6f:2b:8a:fe]
#this is an example for MacOsX network boot, client specific options
#for client having MAC addr 00:ff:a4:0e:ef:d5
IP=192.168.0.21
#you can omit the comments, these are for guidance only
#Next Server (TFTP Boot Server) and Boot File can be different for this client
BootFileName=pxelinux.0
;BootFileSize=255
;RootPath="/"
;ExtensionFile="/linux/"
NextServer=192.168.0.22
#option mac-nc-client-unknown
;220=00:00:00:00
#option mac-nc-client-id
;221=4D:61:63:20:4E:43:20:23:38
#option mac-username
;232="bootuser"
#option mac-password
;233="bootpassword"
#option mac-machine-name
;237=myComputer
#option mac-client-nb-img
;238="\opt\isv\boot\image.bin"



httpd服务配置

把光盘仓库挂载到web上面 同时做好的应答文件和初始化脚本也可以一起挂载上去

[root@centos8 ~]#cd /var/www/html/

[root@centos8 html]#mkdir centos/{6,7,8}/isos/x86_64/ -pv
mkdir: created directory 'centos'
mkdir: created directory 'centos/6'
mkdir: created directory 'centos/6/isos'
mkdir: created directory 'centos/6/isos/x86_64/'
mkdir: created directory 'centos/7'
mkdir: created directory 'centos/7/isos'
mkdir: created directory 'centos/7/isos/x86_64/'
mkdir: created directory 'centos/8'
mkdir: created directory 'centos/8/isos'
mkdir: created directory 'centos/8/isos/x86_64/'

[root@centos8 html]#tree
.
└── centos
    ├── 6
    │   └── isos
    │       └── x86_64
    ├── 7
    │   └── isos
    │       └── x86_64
    └── 8
        └── isos
            └── x86_64

10 directories, 0 files
[root@centos8 html]#mount /dev/sr0 centos/8/isos/x86_64/
mount: /var/www/html/centos/8/isos/x86_64: WARNING: device write-protected, mounted read-only.
[root@centos8 html]#df
Filesystem     1K-blocks    Used Available Use% Mounted on
devtmpfs          910228       0    910228   0% /dev
tmpfs             924716       0    924716   0% /dev/shm
tmpfs             924716   17508    907208   2% /run
tmpfs             924716       0    924716   0% /sys/fs/cgroup
/dev/nvme0n1p2 104806400 4768644 100037756   5% /
/dev/nvme0n1p3  52403200  398588  52004612   1% /data
/dev/nvme0n1p1    999320  131252    799256  15% /boot
tmpfs             184940       4    184936   1% /run/user/0
/dev/sr0         6967726 6967726         0 100% /var/www/html/centos/8/isos/x86_64
[root@centos8 html]#ls
centos
[root@centos8 html]#mkdir ksdir
[root@centos8 html]#cd ksdir/

ks8内容

[root@localhost ~]# cat anaconda-ks.cfg 
#version=RHEL8
ignoredisk --only-use=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
graphical
# Use CDROM installation media
#cdrom
url --url=http://192.168.0.21/centos/8/isos/x86_64/
# Keyboard layouts
keyboard --vckeymap=cn --xlayouts='cn'
# System language
lang zh_CN.UTF-8

# Network information
network  --bootproto=static --device=ens33 --gateway=192.168.1.1 --ip=192.168.0.21 --nameserver=114.114.114.114 --netmask=255.255.254.0 --ipv6=auto --activate
network  --hostname=localhost.localdomain
repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
# Root password
rootpw --iscrypted $6$kHINYMg/OLLHWfjn$RhI5Ohhe517PZnF.tddLnvdl4BA00hlOlpQ.pPbc2xUgdrYm0i5Y2CRBJ4yFNvY0/bREosRZ5XKLLjST1iVuO1
# X Window System configuration information
xconfig  --startxonboot
# Run the Setup Agent on first boot
firstboot --enable
# System services
services --enabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# Disk partitioning information
part / --fstype="xfs" --ondisk=sda --size=102400
part /data --fstype="xfs" --ondisk=sda --size=51200
part swap --fstype="swap" --ondisk=sda --size=2048
part /boot --fstype="ext4" --ondisk=sda --size=1024
%packages
@^graphical-server-environment
kexec-tools

%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值