PXE无人值守安装ubuntu22.04 desktop,fedora37,Redhat9.1--第四篇Redhat自动化安装

上一篇介绍了fedora无人值守安装,本文介绍redhat使用kickstart的方式进行安装。

镜像准备

从redhat官网下载ISO镜像(需要账号),与fedora大同小异,但是不需要自己准备Packages,镜像本身会自带

下载后将镜像文件解压到/var/www/html/redhat目录下
mkdir /var/www/html/redhat
mount /var/lib/tftpboot/rhel-baseos-9.1-x86_64-dvd.iso /mnt/
cp -ra /mnt/* /var/www/html/redhat

tftp内核准备

mkdir /var/lib/tftpboot/boot/
mkdir /var/lib/tftpboot/boot/redhat/
cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/boot/redhat/
cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/boot/redhat/
umount  /mnt

grub文件准备

vi /var/lib/tftp/grub/grub.cfg
###
default=autoinstall
timeout=5
timeout_style=menu
d=autoinstall

menuentry 'redhat9_1 os ' --id=autoinstall {
        echo 'loading redhat vmlinuz'
        linux  /boot/redha/vmlinuz inst.repo=http://xx.xx.xx.xx/redhat/ ip=dhcp inst.ks=http://xx.xx.xx.xx/autoinstall/redhat_serial.ks
        echo 'loading initrd'
        initrd /boot/redhat/initrd.img
}


}

###

ks文件准备

ks创建,与fedrora基本一样,可以根据实际情况修改成适合自己的

vi /var/www/html/autoinstall/redhat_serial.ks

#version=F32

# Use graphical install
graphical
# Keyboard layouts
keyboard --xlayouts='us (mac)','de (mac)'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp --device=enp3s0 --ipv6=auto --activate
network  --hostname=test
# X Window System configuration information
# xconfig --defaultdesktop GNOME --startxonboot
# System services
services --enabled=chronyd,sshd

clearpart --all
autopart

# System timezone
timezone Asia/Shanghai --isUtc --ntpservers=xx.xx.xx.xx

# User configuration
user --groups=wheel --name=test --password="test" --gecos="test"		
# Root password
rootpw "test"

# SELinux is enabled, but only logs things that would be denied in enforcing mode.
# selinux --permissive
# No SELinux policy is loaded.
selinux --disabled

%packages
@^workstation-product-environment

smartmontools
evince                   # Document viewer                       

%end

%addon com_redhat_kdump --disable --reserve-mb='128'

%end

#%post --log=/mnt/sysimage/root/ks-post.log --interpreter=/usr/bin/sh --nochroot
%post --log=/root/ks-post.log

sed -i '6iAutomaticLoginEnable=true' /etc/gdm/custom.conf
sed -i '7iAutomaticLogin=test' /etc/gdm/custom.conf
echo -e "test    ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

mount -o username=xxx,password=xxx,vers=2.0 //xx.xx.xx.xx/auto_test /mnt
cp -r /mnt/*   /home/test/Desktop

%end

# Reboot After Installation
reboot --eject


最后需要在DHCP服务器内配置好tftp地址和bootfile名称,网络内电脑就可以通过pxe安装了。

本地源准备

redhat默认没有账号无法安装源,但是可以自定义repo指向镜像内的packages,就可以安装包内的工具,这部分也可以直接加进ks文件,实现自动化操作。

vi /etc/yum.repos.d/redhat_self.repo

[rhel9_base]
name=rhel9_base
baseurl=http://xx.xx.xx.xx/redhat/BaseOS/
enabled=1
gpgcheck=0

[rhel9_appstream]
name=rhel9_appstream
baseurl=http://xx.xx.xx.xx/redhat/AppStream/
enabled=1
gpgcheck=0

####

谢谢浏览。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值