我是用http协议传送安装源给客户机(我服务器的ip是192.168.10.103)
下面的centos6不能安装,在这里就是做比较,当然,用centos7不同版本也可以比较
这里上传的镜像都是完整版的,如果不想安装带桌面的,也可以上传centos7minimal版的,比较小点,步骤是一样的,kickstart文件只需要写最小安装的就行
我这里自动安装的centos7客户端的登录名是root 密码是yegoo@123
TFTP服务器
Kickstart HTTP
yum -y install httpd xinetd syslinux tftp-server system-config-kickstart dhcp
3.将iso文件上传到/tmp/iso(这里我用Windows自带的cmd上传,以前的文章有介绍cmd传文件的)
pscp CentOS-7-x86_64-DVD-1810.iso root@192.168.10.103:/tmp/iso
mkdir -p /var/www/html/centos{6,7}
mount -o loop /tmp/iso/CentOS-6.10-x86_64-bin-DVD1.iso /var/www/html/centos6/
mount -o loop /tmp/iso/CentOS-7-x86_64-DVD-1810.iso /var/www/html/centos7/
这是临时挂载 也可以开机自动挂载(写fstab文件,我写后会出错,这里不写了 )
6.创建 /var/lib/tftpboot/pxelinux.cfg
mkdir /var/lib/tftpboot/pxelinux.cfg
创建/var/lib/tftpboot/centos{6,7}
mkdir -p /var/lib/tftpboot/centos{6,7}
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
cp /var/www/html/centos7/isolinux/vesamenu.c32 /var/lib/tftpboot/
cp /var/www/html/centos7/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
cp /var/www/html/centos6/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/centos6/
cp /var/www/html/centos7/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/centos7/
vim /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
timeout 600
display boot.msg
# Clear the screen when exiting the menu, instead of leaving the menu displayed.
# For vesamenu, this means the graphical background is still displayed without
# the menu itself for as long as the screen remains in graphics mode.
label 1
menu label ^Install CentOS 6-GUI
menu default
kernel centos6/vmlinuz
append initrd=centos6/initrd.img text ks=http://192.168.10.103/ks/6.cfg
label 2
menu label ^Install CentOS 6-minimal
menu default
kernel centos6/vmlinuz
append initrd=centos6/initrd.img text ks=http://192.168.10.103/ks/6-minimal.cfg
label 3
menu label ^Install CentOS 7-GUI
menu default
kernel centos7/vmlinuz
append initrd=centos7/initrd.img text ks=http://192.168.10.103/ks/7.cfg
label 4
menu label ^Install CentOS 7-minimal
menu default
kernel centos7/vmlinuz
append initrd=centos7/initrd.img text ks=http://192.168.10.103/ks/7-minimal.cfg
# version=DEVEL
# X Window System configuration information
xconfig --startxonboot
# License agreement
eula --agreed
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use network installation
url --url="http://192.168.10.103/centos6"
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
# System services
services --enabled="chronyd"
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
ignoredisk --only-use=sda
# Root password
rootpw --iscrypted $6$QmzXBTCUJU1ANz4F$KKI3NS400dVdUL1PkQDumqUPLbq8wfyULZ0m0Mx7/C3l1.d8a8Moq6sTNP2Qfjgc.DydeHhQHlzscvaZerZk1.
# System timezone
timezone Asia/Shanghai --isUtc
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%packages
@^graphical-server-environment
@base
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@hardware-monitoring
@input-methods
@internet-browser
@multimedia
@print-client
@x11
chrony
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
# version=DEVEL
# X Window System configuration information
xconfig --startxonboot
# License agreement
eula --agreed
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use network installation
url --url="http://192.168.10.103/centos6"
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
# System services
services --enabled="chronyd"
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
ignoredisk --only-use=sda
# Root password
rootpw --iscrypted $6$QmzXBTCUJU1ANz4F$KKI3NS400dVdUL1PkQDumqUPLbq8wfyULZ0m0Mx7/C3l1.d8a8Moq6sTNP2Qfjgc.DydeHhQHlzscvaZerZk1.
# System timezone
timezone Asia/Shanghai --isUtc
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%packages
@^minimal
%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
# version=DEVEL
# X Window System configuration information
xconfig --startxonboot
# License agreement
eula --agreed
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use network installation
url --url="http://192.168.10.103/centos7"
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
# System services
services --enabled="chronyd"
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
ignoredisk --only-use=sda
# Root password
rootpw --iscrypted $6$QmzXBTCUJU1ANz4F$KKI3NS400dVdUL1PkQDumqUPLbq8wfyULZ0m0Mx7/C3l1.d8a8Moq6sTNP2Qfjgc.DydeHhQHlzscvaZerZk1.
# System timezone
timezone Asia/Shanghai --isUtc
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%packages
@^graphical-server-environment
@base
@desktop-debugging
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@hardware-monitoring
@input-methods
@internet-browser
@multimedia
@print-client
@x11
chrony
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
# version=DEVEL
# X Window System configuration information
xconfig --startxonboot
# License agreement
eula --agreed
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use network installation
url --url="http://192.168.10.103/centos7"
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
# System services
services --enabled="chronyd"
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8
ignoredisk --only-use=sda
# Root password
rootpw --iscrypted $6$QmzXBTCUJU1ANz4F$KKI3NS400dVdUL1PkQDumqUPLbq8wfyULZ0m0Mx7/C3l1.d8a8Moq6sTNP2Qfjgc.DydeHhQHlzscvaZerZk1.
# System timezone
timezone Asia/Shanghai --isUtc
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%packages
@^minimal
%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
cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.2 192.168.10.254;
option domain-name-servers 192.168.10.103;
option domain-name "PXEserver";
option routers 192.168.10.1;
option broadcast-address 192.168.10.255;
next-server 192.168.10.103;
default-lease-time 600;
max-lease-time 7200;
filename "pxelinux.0";
}
systemctl restart httpd
systemctl enable httpd
systemctl restart xinetd
systemctl enable xinetd
systemctl restart dhcpd
systemctl enable dhcpd
systemctl stop firewalld.service
systemctl disable firewalld.service
把SELINUX=enforcing改为SELINUX=disabled
service tftp status
service httpd status