其他分享
首页 > 其他分享> > Pxe自动安装脚本配置方法

Pxe自动安装脚本配置方法

作者:互联网

Pxe自动安装脚本配置方法:

yum安装system-config-kickstart

[root@localhost ~]# yum -y install system-config-kickstart

修改/var/lib/tftpboot/pxelinux.cfg/default文件:

在append initrd 的最后添加ks路径,用空格隔开: ks=ftp://192.168.140/ks.cfg

[root@localhost ~]#  system-config-kickstart

出现图形化界面,进行配置:

保存后的脚本内容如下:

[root@localhost ~]# more  ks.cfg

#platform=x86, AMD64, 或 Intel EM64T

#version=DEVEL

# Install OS instead of upgrade

install

# Keyboard layouts

keyboard 'us'

# Root password

rootpw --iscrypted $1$Mj6m4JG0$AatHUEmSlz0rAiH4K.bSc/

# System language

lang zh_CN

# System authorization information

auth  --useshadow  --passalgo=sha512

# Use text mode install

text

firstboot --disable

# SELinux configuration

selinux --disabled

# Firewall configuration

firewall --disabled

# Network information

network  --bootproto=dhcp --device=ens33

# Reboot after installation

reboot

# System timezone

timezone Asia/Shanghai

# Use network installation

url --url="ftp://192.168.193.128/centos7"

# System bootloader configuration

bootloader --location=mbr

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --all

# Disk partitioning information

part /boot --fstype="ext4" --size=200

part swap --fstype="swap" --size=2048

part / --fstype="ext4" --grow --size=1

%post --interpreter=/bin/bash

service network restart

%end

PS:以上脚本只是基础安装,没有桌面等工具包,以下脚本为带桌面的自动化安装脚本:

PXE客户机自动安装脚本ks.cfg

#platform=x86, AMD64, 或 Intel EM64T

#version=DEVEL

# Install OS instead of upgrade

install

# Keyboard layouts

keyboard 'us'

# Root password

rootpw --iscrypted $1$u5JRzFEu$WvZhM8b2xvFbFQ6.qIIh70

# System language

lang zh_CN

# System authorization information

auth  --useshadow  --passalgo=sha512

# Use graphical install

graphical

firstboot --disable

# SELinux configuration

selinux --disabled

# Firewall configuration

firewall --disabled

# Network information

network  --bootproto=dhcp --device=ens33

# Reboot after installation

reboot

# System timezone

timezone Asia/Shanghai

# Use network installation

url --url="ftp://192.168.128.140/centos7"

# System bootloader configuration

bootloader --location=mbr

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --linux --initlabel

# Disk partitioning information

part pv.313 --fstype="lvmpv" --ondisk=sda --size=30724

part /boot --fstype="xfs" --ondisk=sda --size=1024

part biosboot --fstype="biosboot" --ondisk=sda --size=2

volgroup centos --pesize=4096 pv.313

logvol /home  --fstype="xfs" --size=5120 --name=home --vgname=centos

logvol /  --fstype="xfs" --size=10240 --name=root --vgname=centos

logvol swap  --fstype="swap" --size=1024 --name=swap --vgname=centos

%packages

@^graphical-server-environment

@base

@compat-libraries

@core

@desktop-debugging

@development

@dial-up

@fonts

@gnome-desktop

@guest-agents

@guest-desktop-agents

@hardware-monitoring

@input-methods

@internet-browser

@multimedia

@print-client

@security-tools

@x11

chrony

kexec-tools

%end

标签:脚本,information,--,System,fstype,configuration,安装,Pxe,size
来源: https://blog.csdn.net/vio4677/article/details/122472261