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

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

镜像准备

Fedora
清华源下载操作系统iso文件;
准备repodatapackages,也可以从清华源下载,需要把2个文件夹全部下载下来(大概会有80G左右,推荐使用wget下载)

下载后将镜像文件解压到/var/www/html/fedora目录下
mkdir /var/www/html/fedora
mount /var/lib/tftpboot/Fedora-Workstation-Live-x86_64-37-1.7.iso /mnt/
cp -ra /mnt/* /var/www/html/fedora
把repodata和packages两个文件夹也放在/var/www/html/fedora目录下

tftp内核准备

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

grub文件准备

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

menuentry 'fedora ws 37' --class fedora --class gnu-linux --class gnu --class os --id=autoinstall {
        echo 'loading frdora vmlinuz'
        linux  /boot/fedora/vmlinuz ip=dhcp inst.repo=http://xx.xx.xx.xx/fedora/ inst.ks=http://xx.xx.xx.xx/autoinstall/fedora_serial.ks
        echo 'loading initrd'
        initrd /boot/fedora/initrd.img
}

###

ks文件准备

网上有通用模板,可以根据实际需要进行定制化更改

vi /var/www/html/autoinstall/fedora_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

#应为前面下载了packages,这里可以直接添加需要安装的工具
#crontabs
                 
%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
#如果有需要可以把系统内repo路径指向刚下载的packages的http路径,这样就实现了内网源的搭建0.0

%end

# Reboot After Installation
reboot --eject


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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值