第二周做业

1.ignoredisk --only-use=sda
zerombr
text
reboot
clearpart --all --initlable
selinux --disabled
firewall --disabled
url --url=http://10.0.0.8/centos/8/os/x86_64/
keyboard --vckeymap=uc --xlayouts='us'
lang en_US.UTF-8
bootloader --append="net.ifnames=0" --location=mbr --boot-drive=sda
network --bootproto=dhcp --device=eth0 --ipv6=auto --activate
network --hostname=centos8.song.local
rootpw --iscrypted $6$XvK2qMGfbsPTocZG$uobcE/dnt1N87xShkaUnI1gbzJjxmyL7/iUuGxi0yrEJolMojYGD/zZM/BpotAFTxmyrdU1.il82ezSC2IQFe1
firstboot --enable
skipx
services --disabled="chronyd"
timezone Asia/shanghai --isutc --nontp
user --name=song --password=$6$5SRhGLwI4u6ONB9y$BtD2NkanSDI0XAE2Vj6VNEHSrlezOfZkk0jGbM6LA2TlnKhhfik2Mf5UjfsMfahhUyfEfn.Ud.yOsod1qWb.r. --iscrypted --gecos="song"
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=1024br/>%packages
@^minimal-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
%post
useradd gang
echo songgang | passwd --stdin gang &> /dev/null
%endhtml

2.dnf -y install dhcp-server tftp-server httpd syslinux-nonlinux
systemctl enable --now httpd tftp dhcpd
cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf
option domain-name "example.com";
option domain-name-sercers 180.76.76.76,223.6.6.6;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.1 10.0.0.200;
option routers 10.0.0.1;
next-server 10.0.0.100;
filename "pxelinux.0";
}linux

systemctl start dhcpd
 mkdir -pv /var/www/html/centos/{6,7}/os/x86_64/
 mount /dev/sr0 /var/www/html/centos/6/os/x86_64/
 mount /dev/sr1 /var/www/html/centos/7/os/x86_64/
 mkdir /var/www/html/ks/
 vim /var/www/html/ks/centos6.cfg
 grep -vE '^#|^$' /var/www/html/ks/centos6.cfg
 install
 text
 reboot
 url --url=http://10.0.0.100/centos/6/os/x86_64/
 lang en_us.UTF-8
 keyboard us
 network --onboot yes --device eth0 --bootproto dhcp --noipv6
 rootpw --iscrypted $6$XvK2qMGfbsPTocZG$uobcE/dnt1N87xShkaUnI1gbzJjxmyL7/iUuGxi0yrEJolMojYGD/zZM/BpotAFTxmyrdU1.il82ezSC2IQFe1
 firewall --disabled
 authconfig --enableshadow --passalgo=sha512
 selinux --disabled
 timezone Asia/Shanghai
 bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
 zerombr
 clearpart --all --initlabel
 part /boot --fstype=ext4 --size=1024
 part / --fstype=ext4 --size=50000
 part /data --fstype=ext4 --size=30000
 part swap --size=2048
 %packages
 @core
 @server-policy
 @workstation-policy
 autofs
 vim-enhanced
 %end
 %post
 useradd song
 echo songgang | passwd --stdin song &> /dev/null
 mkdir /etc/yum.repos.d/bak
 mv /etc/yum.repos.d/* /etc/yum.repos.d/bak
 cat > /etc/yum.repos.d/base.repo <<EOF
 [base]
 name=base
 baseurl=file:///misc/cd
 gpgcheck=0
 EOF
 %end

 vim /var/www/html/ks/centos7.cfg
 grep -vE '^#|^$' /var/www/html/ks/centos7.cfg
 install
 xconfig --startxonboot
 keyboard --vckeymap=us --xlayouts='us'
 rootpw --iscrypted $6$XvK2qMGfbsPTocZG$uobcE/dnt1N87xShkaUnI1gbzJjxmyL7/iUuGxi0yrEJolMojYGD/zZM/BpotAFTxmyrdU1.il82ezSC2IQFe1
 url --url="http://10..0.100/centos/7/os/x86_64"
 lang en_US
 auth --useshadow --passalgo=sha512
 text
 firstboot --enable
 selinux --disabled
 skipx
 services --disabled="chronyd"
 ignoredisk --only-use=sda
 firewall --disabled
 network --bootproto=dhcp --device=eth0
 network --hostname=centos7.song.local
 reboot
 timezone Asia/Shanghai --nontp
 bootloader --append="net.ifnames=0" --location=mbr --boot-drive=sda
 zerombr
 clearpart --all --initlabel
 part swap --fstype="swap" --ondisk=sda --size=3072
 part / --fstype="xfs" --ondisk=sda --size=51200
 part /boot --fstype="xfs" --ondisk=sda --size=1024
 part /data --fstype="xfs" --ondisk=sda --size=30720
 %post
 useradd song
 %end
 %packages
 @core
 %end

 mkdir /var/lib/tftpboot/centos{6,7}
 cp /var/www/html/centos/6/os/x86_64/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/centos6
 cp /var/www/html/centos/7/os/x86_64/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/centos7
 vim /var/lib/tftpboot/pexlinux.cfg/default
 default menu.c32
 timeout 600
 menu title Install Centos Linux
 label linux7
     menu label Auto Install Centos Linux ^7
         kernel centos7/vmlinuz
         append initrd=centos7/initrd.img ks=http://10.0.0.100/ks/centos7.cfg

 label linux6
     menu label Auto Install Centos Linux ^6
         kernel centos6/vmlinuz
         append initrd=centos6/initrd.img ks=http://10.0.0.100/ks/centos6.cfg

 label rescue
     menu label ^Rescue a Centos Linux system 7
         kernel centos7/vmlinuz
         append initrd=centos7/initrd.img
inst.repo=http://10.0.0.100/centos/7/os/x86_64/  rescue

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