欧拉系统及其发行版实现半自动化安装

半自动化安装

简介:不需要准备tftp,pxe,dhcp等服务,需要手动指定kickstart文件的位置

对比 全自动化安装: 操作系统的全自动化安装,需要配置tftp,dhcpd,pxe等服务

 

需求:使用本地镜像安装方式,同时指定ks文件,自动完成磁盘分区、用户设置、软件包选择等,直接开始安装

 

准备:

两台虚拟机:一台搭建httpd服务提供ks文件,另一台用户测试安装

一份ks.cfg文件配置

测试镜像:openEuler-20.03-LTS-SP3-x86_64-dvd.iso

 

操作步骤:

1、在已安装系统的机器上启动httpd服务,并上传ks.cfg

#机器ip假设为192.168.88.23

yum install httpd

cd /var/www/html

vim ks.cfg

#version=DEVEL
# Use graphical install
graphical


%packages
@^server-product-environment
@container-management
@development
@dns-server
@file-server
@ftp-server
@hardware-monitoring
@headless-management
@infiniband
@legacy-unix
@mail-server
@network-file-system-client
@network-server
@performance
@remote-system-management
@scientific
@security-tools
@smart-card
@smb-server
@system-tools
@virtualization-hypervisor
@web-server

%end

# Keyboard layouts
keyboard --xlayouts='cn'
# System language
lang zh_CN.UTF-8

# Network information
network  --bootproto=static --device=ens33 --gateway=192.168.122.2 --ip=192.168.122.25 --nameserver=192.168.122.2 --netmask=255.255.255.0 --ipv6=auto --activate
network  --hostname=localhost

# Use hard drive installation media
harddrive --dir= --partition=LABEL=openEuler-20.03-LTS-SP3-x86_64

# Run the Setup Agent on first boot
firstboot --enable
# System services
services --enabled="chronyd"

ignoredisk --only-use=sda
autopart
# Partition clearing information
clearpart --none --initlabel

# System timezone
timezone Asia/Shanghai --utc

# Root password
rootpw --iscrypted $6$1g26vpirqhZETA14$QrTLqoEy8yM5p.NkqbwOlLXor5ZEuBsjfOFmv/8S9Z8NFUtE8U1X3igBG2EWUBHzRYZ8TNY4KYA7i7IN50zfW0
user --groups=wheel --name=rocky --password=$6$8OaCe2R1hWwUS/Mr$5hZWqtX5bogsOjFo7lTiBpTYVAkuhgDPX6LKofols8Sh2/gJ..6oorxSPjnAOVonIqNvUVzmg/peoZZMUs0kA0 --iscrypted --gecos="rocky"

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

%end

%anaconda
pwpolicy root --minlen=8 --minquality=1 --strict --nochanges --notempty
pwpolicy user --minlen=8 --minquality=1 --strict --nochanges --emptyok
pwpolicy luks --minlen=8 --minquality=1 --strict --nochanges --notempty
%end

#ks.cfg文件中需要关注的

网络配置

root和普通用户密码配置

安装系统的磁盘配置

systemctl enable –now httpd

测试访问:curl http://192.168.88.23/ks.cfg,输出ks.cfg内容

 

2、另一台虚拟机挂载iso,安装时调整启动参数,加入ks.cfg配置

#以下演示的是uefi方式安装,bios方式安装类似,编辑grub时,按tab键,编辑完成直接回车启动

从光盘启动,安装系统,选择第一项

按e键,进入grub编辑,linuxefi所在行尾 添加inst.ks=http://192.168.88.23/ks.cfg

按ctrl+x,引导安装系统,安装界面配置会自动设置,自动完成安装

 

3、更进一步,可以不使用cdrom的系统,从网络下载系统镜像,配合ks完成自动化安装。在深入学了pxe后,这些都是很容易实现的。按需求来实现它们

posted on 2025-06-12 17:36  赛博狗尾草  阅读(104)  评论(0)    收藏  举报

导航