部署准备
服务器
操作系统:rhel7.7
软件准备: rhel-server-7.5-x86_64-dvd.iso、rhel-server-7.7-x86_64-dvd.iso
客户机
硬件配置:至少2G以上内存
基础环境准备
关闭selinux
关闭防火墙
配置网络
安装yum软件环境
准备镜像源
已将rhel-server-7.5-x86_64-dvd.iso和rhel-server-7.7-x86_64-dvd.iso传入服务器
配置yum源
[base]
name=Redhat-$releasever
failovermethod=priority
baseurl=file:///mnt/rhel77/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
EOF
安装httpd服务
http源配置
配置repo文件
[base]
name=Redhat-$releasever
failovermethod=priority
baseurl=http://192.168.100.1/yum/rhel77/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
EOF
[base]
name=Redhat-$releasever
failovermethod=priority
baseurl=http://192.168.100.1/yum/rhel75/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
EOF
安装PXE网络环境
安装软件包
配置xinetd
修改/etc/xinet.d/tftp,将 disabled 参数从 yes 改为 no
配置dhcp
修改/etc/dhcp/dhcpd.conf
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
option architecture-type code 93 = unsigned integer 16;
subnet 192.168.100.0 netmask 255.255.255.0 {
option routers 192.168.100.1;
range 192.168.100.2 192.168.100.250;
class “pxeclients” {
match if substring (option vendor-class-identifier, 0, 9) = “PXEClient”;
next-server 192.168.100.1;
if option architecture-type = 00:07 {
filename “uefi/shim.efi”;
} else {
filename “pxelinux/pxelinux.0”;
}
}
}
配置tftp
为使用BIOS的系统配置
提取配置文件
提取内核文件
配置文件:/var/lib/tftpboot/pxelinux/pxelinux.cfg/default
default vesamenu.c32
prompt 1
timeout 600
label rhel77
menu label ^Install system
menu default
kernel images/rhel77/vmlinuz
append initrd=images/rhel77/initrd.img ip=dhcp inst.repo=http://192.168.100.1/yum/rhel77/ inst.ks=http://192.168.100.1/ksstart/ks77.cfg
label rhel75
menu label ^Install system
menu default
kernel images/rhel75/vmlinuz
append initrd=images/rhel75/initrd.img ip=dhcp inst.repo=http://192.168.100.1/yum/rhel75/ inst.ks=http://192.168.100.1/ksstart/ks75.cfg
为使用UEFT的系统配置
提取配置文件
提取内核文件
配置文件 /var/lib/tftpboot/uefi/grub.cfg
set timeout=60
menuentry ‘RHEL 7.7’ {
linuxefi images/rhel77/vmlinuz ip=dhcp inst.repo=http://192.168.100.1/yum/rhel77/ inst.ks=http://192.168.100.1/ksstart/ks77efi.cfg
initrdefi images/rhel77/initrd.img
}
menuentry ‘RHEL 7.5’ {
linuxefi images/rhel75/vmlinuz ip=dhcp inst.repo=http://192.168.100.1/yum/rhel75/ inst.ks=http://192.168.100.1/ksstart/ks75efi.cfg
initrdefi images/rhel75/initrd.img
}
kickstart配置
创建配置文件
配置文件示例:ks77efi.cfg
auth --enableshadow --passalgo=sha512
url --url=http://192.168.100.1/yum/rhel77/
text
firstboot --disable
firewall --disabled
selinux --disabled
ignoredisk --only-use=sda
reboot
keyboard --vckeymap=us --xlayouts=‘us’
lang en_US.UTF-8
network --bootproto=dhcp --device=ens33 --onboot=on --activate
rootpw --plaintext 12345678
services --disabled=“chronyd”
timezone Asia/Shanghai
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
clearpart --none --initlabel --drives=sda
part /boot/efi --fstype=“efi” --size=200 --ondisk=sda --fsoptions=“defaults,uid=0,gid=0,umask=0077,shortname=winnt”
part /boot --fstype=“xfs” --size=1024 --ondisk=sda
part pv.01 --ondisk=sda --grow --asprimary
volgroup rhel pv.01
logvol swap --fstype=“swap” --name=“swap” --vgname=“rhel” --size=32768
logvol / --fstype=“xfs” --name=“root” --vgname=“rhel” --size=409600
logvol /home --fstype=“xfs” --name=“home” --vgname=“rhel” --size=204800
logvol /var/log --fstype=“xfs” --name=“var_log” --vgname=“rhel” --size=204800
logvol /var/lib/docker --fstype=“xfs” --name=“var_lib_docker” --vgname=“rhel” --size=204800
%pre
parted -s /dev/sda mklabel gpt
%end
%packages
@^minimal
@core
kexec-tools
wget
net-tools
%end
%post
cd /etc/yum.repos.d/
rm -rf /etc/yum.repos.d/*
wget http://192.168.100.1/repo/rhel75.repo
%end
服务启动
客户端引导安装
按照默认方式启动服务器,选择启动项,按PXE启动服务器,选择相应的安装软件 rhel75或者rhel75 即可自行安装操作系统