**

文章目录

  • 一、kickstart 自动安装脚本
  • 二、怎样配置pxelinux文件
    • PXE网络安装Linux操作系统原理与详细过程

一、kickstart 自动安装脚本

共享资源的意义:在安装操作系统时,每个被安装的操作系统都要有安装资源,如果使用镜像安装,每个安装的系统都需要加载一个镜像,这样会浪费存储,通过网络来共享镜像中的资源,让安装系统的主机能通过网络访问被共享的资源这样就可以解决多台主机需要多个镜像安装的问题。

需要真机和两个快照node1,node2
在真机里:
[root@localhost yum.repos.d]# mount /isos/rhel-8.2-x86_64-dvd.iso /var/www/html/westos/  #挂载共享镜像
[root@localhost yum.repos.d]# vim /etc/yum.repos.d/westos.repo   #软件仓库指向文件
%操作node2中作
[root@localhost yum.repos.d]# vim /etc/yum.repos.d/westos.repo   #使用真机的共享镜像,软件仓库指向文件
[root@localhost yum.repos.d]# dnf search kickstart
[root@localhost yum.repos.d]# dnf install python3-kickstart.noarch -y
[root@localhost yum.repos.d]# systemctl restart httpd
[root@localhost yum.repos.d]# cd /var/www/html
[root@localhost html]# ls
[root@localhost html]# cp /root/anaconda-ks.cfg westos.cfg
[root@localhost html]# ls
westos.cfg
[root@localhost html]# vim westos.cfg
编辑内容
#version=RHEL8
#ignoredisk --only-use=vda
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
#graphical
text    #无图形
# Use CDROM installation media
#cdrom
url --url=http://172.25.254.250/rhel8.2  #真机内共享的镜像源位置。自己电脑:http://10.4.17.141/westos/
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8 --addsupport=zh_CN.UTF-8# Network information
network  --bootproto=dhcp --device=enp1s0 --onboot=on
#network  --hostname=localhost.localdomain
repo --name="AppStream" --baseurl=http://172.25.254.250/rhel8.2/AppStream  #真机内共享的镜像源位置。自己电脑:http://10.4.17.141/westos/AppStream# Root password   #用 openssl passwd -6 查找加密密码
rootpw --iscrypted $6$j/wAunuZd0masdzO$OhrnyMr8Va4URBOS7Sxpj5N4SowqNxoXJjpIICuoJ8zx6TLmVEqe6yXnbpw6V0ne6D0zmdM7KHzCuZ4FDOUMl1
# X Window System configuration information
#xconfig  --startxonboot
# Run the Setup Agent on first boot
firstboot --disable
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Makassar --isUtc --nontp
user --name=westos --
# Disk partitioning information
part swap --fstype="swap"  --size=500
part /boot --fstype="xfs"  --size=500
part / --fstype="xfs" --grow --size=1  #剩下的填满reboot
%packages
#@^graphical-server-environment
@base  #核心组件
lftp
%end
#%post
#touch /mnt/westosfile{1..3}
#%end
编辑晚餐[root@localhost html]# vim westos.cfg
[root@localhost html]# ksvalidator westos.cfg  #检测语法错误
[root@localhost html]# systemctl restart httpd
[root@localhost html]# systemctl enable --now httpd
[root@localhost html]# systemctl disable --now firewalld
[root@localhost html]# ll
[root@localhost html]# chmod 644 westos.cfg 


%测试创建有两种
1,网络安装virt-manager 小太阳创建新的
选Networt Install(HTTP,HTTPS,or FIP)
http://172.25.254.250/rhel8.2/ #安装源:真机内共享的镜像源位置。自己电脑:http://10.4.17.141/westos/
ks=http://172.25.254.103 #设置好自动安装脚本westos.cfg的虚拟机node2的ip
之后设置,2048,1,10G,test

2,光盘安装 node2关掉运行
新建光驱,设置使用光驱运行,选第一个,tab建,编写ks=http://172.25.254.103/westos.cfg
在系统安装基面选择
Install Red Hat Enterprise Linux 8.0.0
ks=http://172.25.254.20/westos.cfg

3,注意问题:
%zerombr自己双系统笔记本打开
%[root@localhost ~]# vim /etc/sysconfig/selinux
SELINUX=disabled
然后[root@localhost ~]# reboot
%westos.cfg编写正确;httpd服务start、enable;火墙关
%自己电脑可以用http://172.25.254.27/westos/ #真机所挂载的镜像
%用网页看http://172.25.254.103/westos.cfg#含有westos.cfg的虚拟机ip,是否能打开

二、怎样配置pxelinux文件

安装
dnf seacher tftp
dnf install tftp
rpm -ql tftp-server #看安装包的文件目录
查找文件再那个安装包里,dnf whatprovides */pxelinux.0 #pxelinux.0文件的作用是读取default,default的左右是
去光盘镜像里找,
设置文件
去设置dhcp的

PXE网络安装Linux操作系统原理与详细过程
1,真机里挂镜像,拷贝所需文件
[root@westos_student3 ~]# mount /isos/rhel-8.2-x86_64-dvd.iso /westos/
mount: /westos: WARNING: device write-protected, mounted read-only.
[root@westos_student3 ~]# cd /westos
[root@westos_student3 westos]# ls
[root@westos_student3 westos]# scp isolinux/* root@172.25.254.103://var/lib/tftpboot[root@westos_student3 ~]# cd /usr/share/syslinux
[root@westos_student3 syslinux]# ls
[root@westos_student3 syslinux]# scp pxelinux.0 root@172.25.254.103://var/lib/tftpboot2,虚拟机node2操作
[root@localhost ~]# dnf search tftp
[root@localhost ~]# dnf install tftp-server.x86_64 httpd -y
[root@localhost ~]# systemctl enable --now tftp httpd3,虚拟机node2操作dhcp
[root@localhost ~]# mkdir pxelinux.cfg
[root@localhost ~]# cd pxelinux.cfg/
[root@localhost ~]# ls
[root@localhost ~]# cp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/default[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
[root@localhost ~]# cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
编辑内容
1 # dhcpd.conf2 #3 # Sample configuration file for ISC dhcpd4 #5 6 # option definitions common to all supported networks...7 option domain-name "westos.org";    #--18 option domain-name-servers 114.114.114.114;     #---29 10 default-lease-time 600;11 max-lease-time 7200;12 13 # Use this to enble / disable dynamic dns updates globally.14 #ddns-update-style none;15 16 # If this DHCP server is the official DHCP server for the local17 # network, the authoritative directive should be uncommented.18 #authoritative;19 20 # Use this to send dhcp log messages to a different log file (you also21 # have to hack syslog.conf to complete the redirection).22 log-facility local7;
23 24 # No service will be given on this subnet, but declaring it helps the 25 # DHCP server to understand the network topology.26 27 28 # This is a very basic subnet declaration.29 30 subnet 172.25.254.0 netmask 255.255.254.0 {      #--331   range 172.25.254.70 172.25.254.90;32   option routers 172.25.254.103;33   filename "pxelinux.0";34   next-server 172.25.254.103;}
编辑晚餐
注: vim /var/lib/tftpboot/default  #加了ks就会新建(重庄系统(node1))
%测试是在另外的node1里面,小灯泡,使用光盘启动。正常启动为完成。


<XII>无人值守安装脚本相关推荐

  1. 第二本第七章 Linux无人值守安装脚本kickstart

    目录 ks需更改的内容 实验步骤 ks需更改的内容 实验步骤 ks文件内容 #version=RHEL8 #ignorediska--only-use=vda # Partition clearing ...

  2. 随记:kickstart远程批量无人值守安装linux

    环境:RHEL6.2 组件:dhcp  tftp   vsftp   kickstart 原理:需安装linux的客户机通过PXE方式启动:通过dhcp取得IP地址:通过TFTP下载引导进程文件pxe ...

  3. 酸爽!我用这套无人值守安装系统瞬间搞定上百台服务器

    来自:DBAplus社群 作者介绍: 季城希,甜橙金融运维工程师,多年IDC运维经验.擅长IDC中服务器批量高效快速集成交付,精通各品牌型号服务器硬件产品及维护. 一.前言 为啥要用无人值守安装系统? ...

  4. pxe+kickstart 实现基于网络的无人值守安装操作系统

    基于网络的无人值守安装操作系统 简介: 1.pxe PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的 ...

  5. 烂泥:kickstart无人值守安装CentOS6.5

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 在本次实验进行之前,首先我们要把公司的网络环境进行介绍. 注意这个网络拓扑图,也是生产环境的一个实例.同时服务器192.168.1.214已关闭ipta ...

  6. pxe和kickstart无人值守安装

    1.安装dhcp和tftpserver Yum install dhcp tftp-server 编辑tftp-server的配置文件 Vi /etc/xinetd.d/tftp 修改如下,将yes更 ...

  7. 搭建无人值守安装服务器(CentOS)

    使用PXE+DHCP+TFTP+Kickstart+FTP搭建无人值守安装服务器.一般只有频繁安装系统才会搭建无人值守安装服务器. 虚拟机环境:youxi1,CentOS7系统双网卡,一个网卡桥接模式 ...

  8. Linux PXE批量网络装机与Kickstart 无人值守安装

    Linux PXE批量网络装机与Kickstart 无人值守安装 一.PXE批量网络装机 二.PXE的三个优点 三.搭建PXE的先前条件 四.配置PXE装机服务器 1.安装并启用 TFTP 服务 2. ...

  9. RHEL6   Kickstart 无人值守安装

    方法:FTP+TFTP+DHCP+Kickstart+PXE 从网络引导系统的做法可以不必从硬盘.软盘或者CD-ROM光盘,而是完全通过网络来引导一台计算机.这对于安装来说很方便,因为它意味着你可以坐 ...

最新文章

  1. 总经费8.4亿的上海市脑科学重大专项进展如何?且看2019年度工作汇报会
  2. AndroidManifest Intent-Filter Action android:name属性
  3. 单片机小白学步系列(三) 偶遇51单片机
  4. php 命令执行crud_使用活动记录执行CRUD
  5. “睡服”面试官系列第十六篇之Symbol(建议收藏学习)
  6. 《从零开始学Swift》学习笔记(Day 40)——析构函数
  7. 2天驾驭div+css_老婆竟然只知道几个css伪类,不行得惩罚她了
  8. Android 4.4 NotificationManagerService使用详解与原理分析(二)__原理分析
  9. 为什么要学linux命令以及linux(ubuntu)的文件与目录命令
  10. react privateRoute
  11. Chrome谷歌浏览器插件
  12. OpenGL读取灰度图生成地形
  13. RK3399平台开发系列讲解(电源管理篇)11.10、PMIC(生产者)驱动数据结构体
  14. 如何生成gazebo仿真环境的二维地图真值
  15. 【深度学习之美】LSTM长短记,长序依赖可追忆(入门系列之十四)
  16. 樱桃是樱花的果实吗?
  17. 视频拍摄——视点和视角
  18. seaborn画直方图、条形图、盒图、散点图等常用图形
  19. 近期iOS开发者问题全面答疑(3)
  20. 判断身份证号码的正确性源码

热门文章

  1. web开发---为什么要安装web服务器
  2. windows下枚举串口的方法,超好用,跟设备管理器枚举一样
  3. 数据预处理(四)——数据标准化
  4. MySQL数据库查看时区
  5. 训练误差与泛化误差的说明
  6. java中的POJO是什么意思?
  7. 小本生意,请各位博友多多支持
  8. 4. JSON字符串是如何被解析的?JsonParser了解一下
  9. python自动解析json_JsonParser–使用python编写的json解析器
  10. Scratch如何学习?少儿编程网站如何入手?