网络安装OS(配置文件)

●无人值守安装KS文件(redhat用,删除下面中文)。

#LinuxIParm Config File
#Generated by LinuxIParm Configurator
#Boot Model UEFI
#System language
lang en_US
#System keyboard
keyboard jp106
#System timzone
timezone --utc Asia/ShaiHang
#System password
rootpw --iscrypted $1$MnJHnXr8$C/yT9HAX/wM3XjxlkabXW0
#Reboot after installation
reboot
#install Linux intead of upgrade
install
#Use NFS installation media
nfs --server 192.168.0.20 --dir /(替换为NFS共享目录)/redhat7
#System bootloader configulation
bootloader --location=mbr
#Clear the Master Boot Record
zerombr
#Clear Partitions from the disk
clearpart --all --initlabel
#Disk partition information
part /boot/efi --fstype ext3 --size 200
part / --fstype ext3 --size 20000
part /boot --fstype ext3 --size 500
#Use dhcp networking
network --bootproto dhcp --hostname redhat7UEFI
#System authorization information
auth --useshadow --enablemd5
#Firewall configuration
firewall --disabled
#XWindows configuration information
skipx
#Package install information
%packages 
@ Core
@ X Window System
@ Development Tools
@ Network File System Client
glibc-*.i686
libgcc-*.i686
nss-softokn-freebl-*.i686
%end
#Script Command after install
%post

#Auto Add APP Client
#Auto Add IA-32 Mode
NFSSERVER=192.168.0.20
APPServer=192.168.0.20 //TFTP所在服务器
#Dir Making
APPHOME=/opt/APPclient
mkdir -p $APPHOME
mkdir $APPHOME/APP
mkdir $APPHOME/APP/etc
mkdir $APPHOME/APP/bin
mkdir $APPHOME/APP/log
mkdir $APPHOME/APP/obj
#Mount /mnt/(替换为NFS共享目录)
mkdir /mnt
mkdir /mnt/test_For
/bin/mount -o nolock -t nfs $NFSSERVER:/(替换为NFS共享目录) /mnt/test_For
#File Copy(要做的处理)
rm -f $APPHOME/APP/bin/test.sh
cp -p /mnt/(替换为NFS共享目录)/某个文件夹/test.sh $APPHOME/bin
chmod 0755 $APPHOME/APP/bin/test.sh

#UnMount /mnt/test_For
/bin/umount /mnt/test_For
#Delete MountPoint
rmdir /mnt/test_For
/bin/systemctl enable test-rc.service
/bin/systemctl daemon-reload
cp -p /etc/test-rc /etc/test-rc.org
sed -i '/^exit 0$/d' /etc/test-rc
echo "" >> /etc/test-rc
echo "chown root /etc/systemd/system/test.service" >> /etc/test-rc
echo "chgrp root /etc/systemd/system/test.service" >> /etc/test-rc
echo "chown root /usr/local/bin/testcancel" >> /etc/test-rc
echo "chgrp root /usr/local/bin/testcancel" >> /etc/test-rc
echo "chown -R root $APPHOME/APP" >> /etc/test-rc
echo "chgrp -R root $APPHOME/APP" >> /etc/test-rc
echo "cd $APPHOME/APP/bin" >> /etc/test-rc
echo "$APPHOME/APP/bin/test.sh -a" $APPServer >> /etc/test-rc
echo "exit 0" >> /etc/test-rc
chown root /etc/test-rc
chgrp root /etc/test-rc
chown root /etc/systemd/system/test-rc.service
chgrp root /etc/systemd/system/test-rc.service
%end

 

●ansfile应答文件(redhat用)

#LinuxIParm Config File
#LinuxOs Red Hat Enterprise Linux 7
#Boot Model UEFI
image=/TFTP目录/redhat7/vmlinuz
label=linux
initrd=/TFTP目录/redhat7/initrd.img
append="ks=nfs:192.168.0.20:/(替换为NFS共享目录)/ks/redhat7.cfg ksdevice=bootif IPAPPEND2"

 

posted @ 2018-06-26 08:25  山的那一边  阅读(373)  评论(0编辑  收藏  举报