您好,登錄后才能下訂單哦!
是基于VMware虛擬機上安裝實驗的!
#!/bin/bash
#修改IP地址????????????
#sed -i 's/dhcp/static/' /etc/sysconfig/network-scripts/ifcfg-ens32
#echo "
#IPADDR=192.168.100.100
#NETMASK=255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-ens32
#systemctl restart network
#配置本地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
#安裝dhcp,配置dhcp配置文件
[ ! -e /etc/dhcp/dhcpd.conf ] && echo "沒有安裝DHCP服務,現在安裝!"; 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
#安裝tftp和修改配置文件
[ ! -e /etc/xinetd.d/tftp ] && echo "沒有安裝TFTP,現在安裝!";yum -y install tftp-server
sed -i '/disable/s/yes/no/' /etc/xinetd.d/tftp
#安裝syslinux
[ ! -e /usr/share/syslinux/pxelinux.0 ] && yum -y install syslinux
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
#安裝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, 或 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
#配置編輯default啟動菜單
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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。