复习之kickstart无人职守安装脚本

news2024/9/22 13:38:02

一、kickstart简介

kickstart是红帽发行版中的一种安装方式,它通过以配置文件的方式来记录linux系统安装的各项参数和想要安装的软件。只要配置正确,整个安装过程中无需人工交互参与,达到无人值守安装的目的。

二、kickstar文件的生成

  • 进入/root目录找到模板:anaconda-ks.cfg
  • 根据模板编辑kickstar文件
  • 检测kickstar语法错误
[root@westosa ~]# cat westos.cfg 
#version=RHEL8
#ignoredisk --only-use=vda
autopart --type=lvm

# Partition clearing information
clearpart --all --initlabel

# Use graphical install
#graphical
text

# Use CDROM installation media
#cdro
url --url=http://172.25.254.100/westos

# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'

# System language
lang en_US.UTF-8 

# Network information
network  --bootproto=dhcp --device=enp1s0 --onboot=no --ipv6=auto --no-activate
network  --hostname=localhost.localdomain
repo --name="AppStream" --baseurl=http://172.25.254.100/westos/AppStream

# Root password
#rootpw --plant westos
rootpw --iscrypted $6$xPOQGqf3UsUPjuV5$wMByLsY60INgTbIO.VgyD8lawrmDlzXTaVkHeSiFjYxywVxzvfLX9uprA66CnugTo5m9mzW9fgAio3fkR1Bih/

# X Window System configuration information
xconfig  --startxonboot

# Run the Setup Agent on first boot
#firstboot --enable
firstboot --disable

# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp

reboot

%packages
@base
firefox
%end

%post
touch /mnt/westosfile{1..10}
%end
[root@westosa ~]# 

1. 进目录找模板

[root@westosa ~]# cd /root/
[root@westosa ~]# ls
anaconda-ks.cfg  Documents  fstab                 Music     Public     Videos
Desktop          Downloads  initial-setup-ks.cfg  Pictures  Templates
[root@westosa ~]# cp anaconda-ks.cfg westos.cfg
[root@westosa ~]# ls
anaconda-ks.cfg  Documents  fstab                 Music     Public     Videos
Desktop          Downloads  initial-setup-ks.cfg  Pictures  Templates  westos.cfg
[root@westosa ~]# vim westos.cfg 

2. 编辑kickstar文件

具体编辑步骤如下:

一定要仔细,否则后续无法安装!

注意:加密密码如何生成?

ps:所有文件连接必须都可以在浏览器打开!

例如:

 

 3.检测kickstar语法错误

  • 安装检测软件
  • 检测:没有反应则语法正确
[root@westosa ~]# dnf search kickstar
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:43:22 ago on Sun 30 Jul 2023 06:52:16 PM CST.
================================= Name & Summary Matched: kickstar ==================================
pykickstart.noarch : Python utilities for manipulating kickstart files.
python3-kickstart.noarch : Python 3 library for manipulating kickstart files.
[root@westosa ~]# dnf install -y pykickstart.noarch
Updating Subscription Management repositories.

检测方法:ksvalidator + 脚本名

[root@westosa ~]# ksvalidator westos.cfg 
The following problem occurred on line 21 of the kickstart file:

Unexpected arguments to lang command: ['--addaupport=zh_CN.UTF-8']

出现错误,修改脚本,再次检测!没有错误了!ps:只能检测出语法错误

[root@westosa ~]# ksvalidator westos.cfg 
[root@westosa ~]# 

三、 部署安装所需环境

  • 搭建好软件仓库:建立共享目录:/var/www/html/westos
  • 共享镜像资源:安装httpd和dhcp服务;关闭火墙
  • 共享ks脚本:复制ks脚本到共享目录,修改权限
  • 配置dhcp服务:之前学过

以上全部在虚拟机westosa上完成!!

1. 搭建软件仓库

首先要有镜像资源,从主机发送到虚拟机,发现虚拟机内存不够,因此可以通过挂载设备发送!

首先需要一块10G的硬盘,镜像为7.9G。然后分区

 将该设备挂载在/iso目录

 然后发送镜像,成功!

[root@westosa ~]# cd /iso/
[root@westosa iso]# ls
rhel-8.2-x86_64-dvd.iso
[root@westosa iso]#

新建共享目录,将镜像挂载在该目录上!

 249  mkdir /var/www/html/westos
  250  mount /iso/rhel-8.2-x86_64-dvd.iso /var/www/html/westos/

编辑配置文件,保证文件都可以打开!!则软件仓库配置成功!

[root@westosa ~]# cd /etc/yum.repos.d/
[root@westosa yum.repos.d]# ls
redhat.repo  westos.repo
[root@westosa yum.repos.d]# cat westos.repo 
[AppStream]
name=AppStream
baseurl=http://172.25.254.100/westos/AppStream
gpgcheck=0
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1

[BaseOS]
name=BaseOS
baseurl=http://172.25.254.100/westos/BaseOS
gpgcheck=0
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1

[root@westosa yum.repos.d]# 

2. 共享镜像资源

安装httpd和dhcp服务!并且关闭火墙,开启httpd服务!

245  dnf install httpd dhcp-server -y
  246  systemctl enable --now httpd
  247  systemctl status httpd
  248  systemctl disable --now firewalld

3. 共享ks脚本+修改权限

共享ks脚本到共享目录,保证主机都可以看见!

252  cp westos.cfg /var/www/html/
  253  chmod 644 /var/www/html/westos.cfg 

共享结果如下:

 4. 配置dhcp服务

在westosa为dhcp服务器,在上面配置dhcp服务,保证其他主机有ip可以访问共享目录!

254  dnf search dhcp
  255  cat /etc/dhcp/dhcpd.conf 
  256  cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf
  257  vim /etc/dhcp/dhcpd.conf
  258  systemctl restart dhcpd
  259  systemctl enable --now dhcpd

dhcp的配置文件如下:认真不要写错!

[root@westosa dhcp]# cat dhcpd.conf 
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option domain-name "westos.org";
option domain-name-servers 172.25.254.100;

default-lease-time 600;
max-lease-time 7200;

# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.

#subnet 10.152.187.0 netmask 255.255.255.0 {
#}

# This is a very basic subnet declaration.

subnet 172.25.254.0 netmask 255.255.255.0 {
  range 172.25.254.10 172.25.254.20;
  #option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
}


[root@westosa dhcp]# 

四、测试

测试ks脚本!

在虚拟机管理界面创建新的虚拟机!

1. 选择创建方式

2. 填写镜像及ks脚本目录

 

 后续就是分配内存大小等和之前创建虚拟机一样

填写完成后等待加载。。。。。如果出现错误检查ks脚本和dhcp配置!

加载完成后,可以登陆用户!进入/mnt目录,发现有10个文件!

证明成功!

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/815082.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

销售易和管易云接口打通对接实战

销售易和管易云接口打通对接实战 来源系统:销售易 销售易CRM支持企业从营销、销售到服务的全流程自动化业务场景,创新性地利用AI、大数据、物联网等新型互联网技术打造双中台型CRM;既能帮助B2B企业连接外部经销商、服务商、产品以及最终用户,…

提升稳定性与动态响应,深入探究PID串级多闭环控制的应用价值

引言: PID(比例-积分-微分)控制作为自动控制系统中常用的控制算法,可以通过对系统的反馈进行调整,实现目标状态的稳定控制。而PID串级多闭环控制是在基本PID控制的基础上,引入多个PID控制器,形成…

某coin数据加密接口分析

新建项目,然后添加frida代码提示 frida 代码提示安装--vscode / node npm i types/frida-gum 任务 : sign 和 data,止于mobilekey是设备号,测试可以随机 sign 加密在 native 层 动态调试配置: 把ida 的 dbsgv 文件下的 android_server 复…

SFL218、SFL214、SFL216、SFL218B双喷嘴挡板两级电液伺服阀

SFZ141直接驱动式伺服阀 SFL317电反馈三级伺服阀 SFL316电反馈三级伺服阀 SFL218A双喷嘴挡板两级电液伺服阀 SFL218双喷嘴挡板两级电液伺服阀 SFL214双喷嘴挡板两级电液伺服阀 SFL216双喷嘴挡板两级电液伺服阀 SFL218B双喷嘴挡板两级电液伺服阀 SFL212B双喷嘴挡板两级电…

HTSA101伺服流量阀放大器

电液伺服阀放大器HTSA101特点: 可用拨码方式选择比例、积分(PI)控制前面板有电源、阀电流和继电器指示灯可开关选择阀电流的输出电流范围可选输出电流或者电压信号来匹配伺服阀或者比例阀采用标准 DIN rail 规格带有颤振信号、颤振信号的幅值和频率可调标准的DIN 导…

Day05-作业(SpringBootWeb请求响应)

作业1:联网创建SpringBoot工程,完成如下需求 测试接口数据,提取码:5555(将上述json文件,下载并导入postman)https://pan.baidu.com/s/1rwUfKTCgncB_xxarzOUpfA 需求: springboot的版本选择 2…

ALLEGRO之View

本文主要介绍ALLEGRO中的View菜单。 (1)Zoom By Points:按照选型区域放大; (2)Zoom Fit:适合窗口放大; (3)Zoom In:放大; &#xf…

Java---Shiro框架

第一章 入门概述 1.1 什么是shiro Apache Shiro 是一个功能强大且易于使用的 Java 安全(权限)框架。Shiro 可以完成:认证、授权、加密、会话管理、与 Web 集成、缓存 等。借助 Shiro 您可以快速轻地保护任何应用程序——从最小的移动应用程序到最大的 Web 和企业应用程序。 …

释放三年版本:Aspose.Total For NET [21.7/22.7/23.7]

请各位对号入座,选择自己需求范围,你懂的,你懂的,你懂的 Aspose.Total for .NET is the most complete package of all .NET File Format Automation APIs offered by Aspose. It empowers developers to create, edit, render, …

日撸java_day54-55

文章目录 第 54 、55 天: 基于 M-distance 的推荐代码运行截图 第 54 、55 天: 基于 M-distance 的推荐 1.M-distance, 就是根据平均分来计算两个用户 (或项目) 之间的距离. 2.邻居不用 k 控制. 距离小于 radius (即 ϵ ) 的都是邻居. 使用 M-distance 时, 这种方式效果更好. …

tinkerCAD案例:28. Build a Mobile Amplifier 构建移动放大器(3)

tinkerCAD案例:28. Build a Mobile Amplifier 构建移动放大器(3) 原文 step 1 “爵士乐”放大器 Lesson Overview: 课程概述: Now we’re going to decorate our design! 现在我们要装饰我们的设计! step 2 In this step we will ref…

纯CSS实现手风琴效果(常用样式)

【效果图】&#xff1a; 【html代码】&#xff1a; <div class"rowd"><ul class"fold_wrap"><li><a href"#"><div class"pic_auto pic_auto1 trans"></div><div class"adv_intro flex&…

qt子进程和父进程读写数据通信

进程A&#xff08;例如主程序&#xff09;创建了一个QProcess B&#xff0c;这个B就称为A的子进程&#xff0c;而A称为B的父进程。 这也称为进程间通信&#xff0c;有多种方式&#xff1a; TCP/IPLocal Server/Socket共享内存D-Bus &#xff08;Unix库&#xff09;QProcess会…

Java版本企业电子招投标采购系统源码+功能模块功能描述+数字化采购管理 采购招投标

功能模块&#xff1a; 待办消息&#xff0c;招标公告&#xff0c;中标公告&#xff0c;信息发布 描述&#xff1a; 全过程数字化采购管理&#xff0c;打造从供应商管理到采购招投标、采购合同、采购执行的全过程数字化管理。通供应商门户具备内外协同的能力&#xff0c;为外部…

Android复习(Android基础-四大组件)—— Activity

Activity作为四大组件之首&#xff0c;是使用最为频繁的一种组件&#xff0c;中文直接翻译为"活动"&#xff0c;不过如果被翻译为"界面"会更好理解。正常情况&#xff0c;除了Window&#xff0c;Dialog和Toast &#xff0c; 我们能见到的界面只有Activity。…

【phaser微信抖音小游戏开发003】游戏状态state场景规划

经过目录优化后的执行结果&#xff1a; 经历过上001&#xff0c;002的规划&#xff0c;我们虽然实现了helloworld .但略显有些繁杂&#xff0c;我们将做以下的修改。修改后的目录和文件结构如图。 game.js//小游戏的重要文件&#xff0c;从这个开始。 main.js 游戏的初始化&a…

集合框架、多线程、IO流

目录 集合框架 Java迭代器&#xff08;Iterator&#xff09; Java集合类 Collection派生 Map接口派生&#xff1a; Java集合List ArrayList Vector LinkedList Java集合Set HashSet LinkedHashSet TreeSet Java集合Queue&#xff08;队列&#xff09; PriorityQue…

AP5101 高压线性恒流电源驱动 输入 24-36V 输出3串18V LED线性恒流驱动方案

1,输入 24V-36V 输出3串18V 直亮 参考BOM 表如下 2,输入 24V-36V 输出3串18V 直亮 参考线路图 如下​ 3&#xff0c;产品描述 AP5101B 是一款高压线性 LED 恒流芯片&#xff0c;外围简单、内置功率管&#xff0c;适用于6- 60V 输入的高精度降压 LED 恒流驱动芯片。最大…

cloudstack之advanced network

cloudstack网络模式的介绍&#xff0c;可参考【cloudstack之basic network】 一、添加资源 访问UI&#xff0c;默认端口为8080&#xff0c;默认用户民和密码是admin/password。点击【continue with installation】。修改默认密码选择zone type&#xff1a;core 选择advanced模…

python中的单引号、双引号和多引号

目录 python中的单引号 python中的双引号 python中的多引号 三者分别在什么时候使用&#xff0c;有什么区别 总结 python中的单引号 在Python中&#xff0c;单引号&#xff08;&#xff09;可以用来表示字符串。 可以使用单引号创建一个简单的字符串&#xff0c;例如&…