1.搭建yum倉庫:
[root@bogon ~]# vim /etc/yum.repos.d/serverl.repo
[base]
name=server
baseurl=file:///mnt
enabled=1
gpgcheck=0
[root@bogon ~]# mount /dev/cdrom /mnt
[root@bogon ~]# yum clean all
[root@bogon ~]# yum repolisthtml
2.安裝dhcp,修改配置文件及開啓服務:linux
[root@bogon ~]# yum install -y dhcp
[root@bogon ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcp.confios
[root@bogon ~]# vi /etc/dhcp/dhcpd.confvim
[root@bogon ~]# systemctl enable dhcpd
[root@bogon ~]# systemctl restart dhcpd
[root@bogon ~]# systemctl stop firewalld
[root@bogon ~]# setenforce 0app
3.配置tftp:ide
[root@bogon ~]# yum install tftp tftp-server xinetd -y
[root@bogon ~]# vi /etc/xinetd.d/tftpurl
把yes改爲norest
[root@bogon ~]# systemctl enable xinetd.service
[root@bogon ~]# systemctl restart xinetd.serviceserver
yum install -y syslinux* 安裝開機引導文件 pxelinux.0文件 安裝這個是爲了獲得pxelinux.0文件
[root@bogon ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/htm
[root@bogon ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@bogon ~]# cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@bogon ~]# cp /mnt/isolinux/vmlinuz /var/lib/tftpboot/
[root@bogon ~]# cp /mnt/isolinux/initrd.img /var/lib/tftpboot/
[root@bogon ~]# cp /mnt/isolinux/vesamenu.c32 /var/lib/tftpboot/
4.配置ftp:
[root@bogon ~]# yum install vsftpd –y
[root@bogon ~]# systemctl enable vsftpd
[root@bogon ~]# systemctl start vsftpd.service
[root@bogon ~]# cd /var/ftp/pub/
[root@bogon pub]# vi ks.cfg加入內容
[root@bogon pub]# vi /var/lib/tftpboot/pxelinux.cfg/default
檢查ks文件是否存在語法錯誤:
[root@bogon pub]# yum install pykickstart -y
[root@bogon pub]# ksvalidator /var/ftp/pub/ks.cfg
[root@bogon pub]#
5.安裝httpd
[root@bogon ftp]# yum install -y httpd
[root@bogon pub]# cd /var/www/html
[root@bogon pub]# mkdir mnt
[root@bogon pub]# cp -r /mnt/* /var/www/html/mnt/
[root@bogon pub]# systemctl restart dhcpd
[root@bogon pub]# systemctl restart xinetd
[root@bogon pub]# systemctl restart vsftpd
[root@bogon pub]#
ks.cfg內容:
install
url --url=http://192.168.43.220/mnt/ #鏡像文件位置
lang en_US.UTF-8
keyboard us
#network --bootproto=dhcp --device=eth0 --noipv6 --activate
network --onboot yes --device bootif --bootproto dhcp --noipv6
rootpw --iscrypted $6$K0zTFxJD9bPOGC9m$bXGAVJTKyxj.vO33sIv1h5iMLwEwKKv96WTDtzDMMM5Wl7.NSaYGLDgxB2DKibtYs21HL8ezDk/rq5ANmMDtm/
firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone --utc America/New_York
text
reboot
zerombr
bootloader --location=mbr --append="console=tty0 net.ifname=0 biosdevname=0 audit=0 selinux=0"
clearpart --all --initlabel
part /boot --fstype=ext4 --size=200
part swap --size=4096
part / --fstype=ext4 --size=1 --grow
%packages --ignoremissingbr/>@base
@core
%end
#密碼:SX3edc@W