运维自动化之系统安装

2018-07-17 03:55:45来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

本章内容系统安装过程配置anaconda自动化安装系统制作引导光盘和U盘DHCP服务PXE安装系统  cobbler企业级应用

安装程序

? CentOS系统安装

系统启动流程:

bootloader-->kernel(initramfs)-->rootfs-->/sbin/init

? anaconda: 系统安装程序

gui:图形窗口

tui: 基于图形库curses的文本窗口

安装程序启动过程

? MBR:isolinux/boot.cat

? stage2: isolinux/isolinux.bin

? 配置文件:isolinux/isolinux.cfg

每个对应的菜单选项:

加载内核:isolinuz/vmlinuz

向内核传递参数:append initrd=initrd.img ...

? 装载根文件系统,并启动anaconda

默认启动GUI接口

若是显式指定使用TUI接口:向内核传递text参数即可

(1)按tab键,在后面增加text

(2)按ESC键:boot: linux text “纯字符方式安装系统,不需要图形界面“

 

手动安装界面

 

 

anaconda工作过程

Anaconda安装系统分成三个阶段:

1、安装前配置阶段

  • 安装过程使用的语言
  • 键盘类型
  • 安装目标存储设备
      • Basic Storage:本地磁盘
      • 特殊设备:iSCSI
  • 设定主机名
  • 配置网络接口
  • 时区
  • 管理员密码
  • 设定分区方式及MBR的安装位置
  • 创建一个普通用户
  • 选定要安装的程序包

2、安装阶段

  • 在目标磁盘创建分区,执行格式化操作等
  • 将选定的程序包安装至目标位置
  • 安装bootloader和initramfs

3、图形模式首次启动

  • iptables
  • selinux(安全机制)
  • core dump

anaconda

anaconda负责安装系统向导,默认为GUI界面,如果我们使用ks自动应答安装的话建议使用TUI界面来安装,在安装启动界面我们可以按esc键来自己手动指定安装启动选项anaconda选项:

1)boot:linux askmethod 在稍后的安装中手动选择安装源

本地光盘、硬盘、NFS、FTP、HTTP

2)linux dd 加载驱动盘

3)linux ks=xxx   指定安装ks文件

  • DVD drive: ks=cdrom:/PATH/TO/KICKSTART_FILE
  • Hard drive: ks=hd:device:/directory/KICKSTART_FILE
  • HTTP server: ks=http://host:port/path/to/KICKSTART_FILE
  • FTP server: ks=ftp://host:port/path/to/KICKSTART_FILE
  • HTTPS server: ks=https://host:port/path/to/KICKSTART_FILE
  • NFS server:ks=nfs:host:/path/to/KICKSTART_FILE

4)linux nonet 不启用网络

5)linux noprobe 不装载其他的硬件设备

6)linux rescue 进入救援模式

7)linux 正常安装

8)local 从硬盘启动

9)linux text 以字符界面安装

10)linux ip={DHCP | 192.168.0.1} netmask=255.255.255.0 gateway=192.168.0.1 dns=114.114.114.114 ks=http://192.168.0.1/ks.cfg 设置IP并从网络获取ks文件

11)linux ip={DHCP | 192.168.0.1} netmask=255.255.255.0 gateway=192.168.0.1 dns=114.114.114.114 repo=http://192.168.0.1  设置IP地址并指定从repo源安装

  • ip=IPADDR
  • netmask=MASK
  • gateway=GW
  • dns=DNS_SERVER_IP
  • ifname=NAME:MAC_ADDR

12)linux vnc vncpassword="PASSWORD" 使用vnc调用安装界面

在光盘下的isolinux/文件夹为anaconda的工作目录文件存放位置

# ls -1 isolinux/ boot.cat 模拟mbr文件 boot.msg grub.conf grub的配置文件 initrd.img ramdisk文件 isolinux.bin grub的第二阶段 isolinux.cfg 配置文件(启动菜单定制文件) memtest 内存测试文件 splash.jpg 背景图片 TRANS.TBL vesamenu.c32 光盘启动的图形界面菜单风格 vmlinuz 内核文件

启动菜单的配置文件isolinux/isolinux.cfg

 

# cat isolinux/isolinux.cfg default vesamenu.c32 提供图形菜单风格 #prompt 1 timeout 600 菜单选择超时时间 display boot.msg menu background splash.jpg 背景图片 menu title Welcome to CentOS 6.9! 菜单上方提示信息 menu color border 0 #ffffffff #00000000 menu color sel 7 #ffffffff #ff000000 menu color title 0 #ffffffff #00000000 menu color tabmsg 0 #ffffffff #00000000 menu color unsel 0 #ffffffff #00000000 menu color hotsel 0 #ff000000 #ffffffff menu color hotkey 7 #ffffffff #ff000000 menu color scrollbar 0 #ffffffff #00000000 label linux 一条菜单 menu label ^Install or upgrade an existing system menu default 默认选择 kernel vmlinuz append initrd=initrd.img 向内核传递参数

 

 

实验:如果想加图形界面,方法如下

1:配好yum 源:按装包yum grouplistall "gonme desktop" yum grouplist:查看包组

2:yum install bash-completion 如果是最小化安装的系统则安装补全包 用 rmp -qa "bash" 查找出

如果已经装好,则exit重新登录,只有从新登录装的包会生效

3:systemctl isolate graphical.target --------- 或者init5

4:修改开机启动运行模式,

 

kickstart自动应答文件

kickstart为anaconda安装系统过程中自动应答已配置好的选项,实现无人值守安装系统。

事先把我们手动安装时的那些设置,如分区,语言,口令之类的安装的包存在应答文件中,安装向导读取应答文件内容自动安装,

ks文件格式:三部分

命令段

---必须指定---

authconfig: 认证方式配置

  authconfig --useshadow --passalgo=sha512

bootloader:bootloader的安装位置及相关配置

   bootloader --location=mbr --driveorder=sda – append="crashkernel=auto rhgb quiet"

keyboard

lang

timezone

rootpw

authconfig --enableshadow

bootloader --location=mbr --password=******

driverdisk 指定驱动盘

firewall --enable --ssh,--disabled

firstboot --disbaled

halt 完成后关机

reboot 完成后重启

text|graphical(default) 文本|图像

key --skip 跳过安装号码,适用于rhel版本

keyboard: 设定键盘类型

lang: 语言类型

part: 创建分区

rootpw: 指明root的密码

timezone: 时区

---可选命令---

clearpart --all,--linux,--none(default) --initlabel(初始化分区标记)

autopart 自动分区

     ignoredisk --drives=drive1,drive2忽略硬盘

     autostep 跳过可选项,付默认值

     part or partition /boot --fstype ext4 --size=200

     install OR upgrade

     text: 文本安装界面

     network

     firewall

     selinux

     halt

     poweroff

     reboot

     repo

     user:安装完成后为系统创建新用户

     url: 指明安装源

     key –skip 跳过安装号码,适用于rhel版本

命令段:指明各种安装前配置,如键盘类型等
程序包段:指明要安装的程序包组或程序包,不安装的程序包等
软件包选择段%package
     @group_name 包组名
     package 一个个包
     -package 不装的包
     %end
脚本段
预安装脚本%pre
后安装脚本%post
准备应答文件:
方法一通过现成系统拷贝一个文件直接参考 /root/anaconda-ks.cfg  来编辑, ,然后使用ksvalidator命令来检查是否有语法错误,但是这文件的格式有一定的要求,麻烦
方法二使用system-config-kickstart 图形界面工具生成ks文件。

 

 
使用 system-config-kickstart 来创建ks文件(CentOS6.x)
检查ks文件的语法错误:ksvalidator ksvalidator /PATH/TO/KICKSTART_FILE
1、配置yum源、安装软件并启动,需要安装图形界面
2、按需配置
注意在centos7上的选择安装包的那一项默认不出来选项,我们可以把base的仓库名改为development
[root@centos7 ~]# systemctl start httpd      启动http服务
[root@centos7 ~]# ss -ntl 80端口打开就可以访问了
[root@centos7 ~]# cd /var/www/html 默认存放页面的文件 [root@centos7 /var/www/html]# ls [root@centos7 /var/www/html]# mkdir -pv centos/7/os/x8_64/ 模仿阿里云yum源以创建文件夹方式把centos光盘放到这个页面上 mkdir: created directory ‘centos’ mkdir: created directory ‘centos/7’ mkdir: created directory ‘centos/7/os’ mkdir: created directory ‘centos/7/os/x8_64/’ [root@centos7 /var/www/html]# mount /dev/sr0 centos/7/os/x8_64/ 挂载光盘到这个centos/7/os/x8_64/目录中 mount: /dev/sr0 is write-protected, mounting read-only [root@centos7 /var/www/html]# ls centos

yum源生成:

 
[root@centos7 ~/.ssh]# ssh-keygen                           在centos7上先生成key   
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:9xImk70qDENHI8D4aJlqNewV2o3/RUGm7njgz6ZIBqs root@centos7
The key's randomart image is:
+---[RSA 2048]----+
| o..      .o     |
|. . ..o   o.     |
| o+ oo+. .  .    |
|.+.=.+...o .     |
|o ooo...S.*      |
|.. .= ..+= =     |
|.  . * o.o+ .    |
|  . o + ++ .     |
| E   . o+o       |
+----[SHA256]-----+
[root@centos7 ~/.ssh]# cat id_rsa.pub        查看公钥文件
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3v5+ZpK3jGAUGv5Yu4tOvPqpftREzI1tzXPjQPSE20mFhFH8H
45DD01IsvcTtoBj6LFQyjJ8T6FPvtBffdAsCfFeBirBy3OASgHn4+6Y6VihSiGoKt0cqVMFCpg136InI9995tCDx
iLA6orMd+VJ4YPXs5IdP9a+xqJTD9WN2YdCttRsWujkUVQEfTJprSFy21xNTsvyTvsiFonta9GuC/72jd+Y8Wr/Y
z4cMHVpEBgRXWYXTVCxNzWOIIpJivVZFXr/sa/kf5v14TDeEJwomeJhwZJ211AsY46f/XWrXeIBvLNZ2Ee36xWOe
I+bqTUlpvR0nqjetF9DaGNWXAitV root@centos7
 
ks.cfg配置文件,以上步骤生成:如下

platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://192.168.1.6/centos/6/os/x86_64/"
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info

# System timezone
timezone  Africa/Abidjan
# Network information
network  --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --location=partition
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
%post
rm -rf /etc/yum.repo.d/*
cat > /etc/yum.repo.d/media.repo <<EOF
[base]
name=base
baseurl=file:///media/
gpgcheck=0
EOF

useradd wang
echo 111111|passwd --stdin wang
%end

%packages
@base
%end

ks文件中LVM逻辑卷分区格式

 
part /boot --fstype xfs --size=200 --ondisk=sda
part pv.2 --size=0 --grow --ondisk=sda
volgroup myvg --pesize=4096 pv.2
logvol / --fstype xfs --name=lv_root --vgname=myvg --size=10240 --grow
logvol swap --fstype swap --name=lv_swap --vgname=myvg --size=1024 --grow --maxsize=2048
 

ks文件中使用系统自动分区格式

# Partition clearing information
clearpart --all --initlabel 
autopartc

 

实验:在centos7上通过应答文件配合ftp 服务实现自动化安装

1:yum install vsftpd    systemctl start vsftpd 启动该服务  安装ftp服务,
将会自动在这个目录下生成相应的文件夹
2:cd /var/ftp/pub 将会自动在这个目录下生成相应的文件夹, 3:[root@centos7 /var/ftp/pub]# mkdir centos7 创建该文件夹
4:[root@centos7 /var/ftp/pub]# mount /dev/sr0 centos7/ 将光盘挂载到
centos7上
5:[root@centos7 /var/ftp/pub]# setenforce 0 关闭安全机制
6:访问
7:[root@centos7 /var/ftp/pub]# mv /root/ks7.cfg 将拷贝的应答文件
复制到当前目录下,并且进行修改
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
url --url=ftp//192.168.1.7/pub/centos7/      yum 源的路径
# Use graphical install
graphical                  graphical(图形安装)改为text(文本安装)
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp --device=ens33 --onboot=off --ipv6=auto --activate
network  --bootproto=dhcp --device=ens33--onboot=on --ipv6=auto
network  --hostname=centos7                    网卡设为on,开机启动网卡

# Root password
rootpw --iscrypted $6$B5k2WAcdZ9Grkfsj$NbP5RSVlO7haAyskX45HT0cNXbGqve7yWQD.ZnZ
qxhUWdVr88.T1uQr7cffimrAP0u3hVXaQYFz5mrTZGKvHX. # System services services --enabled="chronyd" selinux --disabled 禁用安全机制 firewall --disabled 禁用防火墙 # System timezone timezone America/New_York --isUtc user --name=tom --password=$6$PxcNWD/nhZKlFo7e$fqBt4W.KPk87WM/Y0EyzpvzjQZ6heJ6
651uTuCWYY49yZG/v5eN9Vg.uJmiMYHT6GARtQlBCZV/e4dpZmA.7.1 --iscrypted --gecos="tom" # X Window System configuration information xconfig --startxonboot
reboot # System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --all --initlabel
zerombr 清除老硬盘上面的信息
eula --agreed 在安装启动的时候法律许可,设为同意
# Disk partitioning information
part /boot --fstype="xfs" --ondisk=sda --size=300
part pv.197 --fstype="lvmpv" --ondisk=sda --size=32776
volgroup centos --pesize=4096 pv.197
logvol /app  --fstype="xfs" --size=10240 --name=app --vgname=centos
logvol /  --fstype="xfs" --size=20480 --name=root --vgname=centos
logvol swap  --fstype="swap" --size=2048 --name=swap --vgname=centos

%packages
@base
@core
antofs
%end
%rost
systrmctl enable antofs 开机自启动
rm -rf /etc/yum.repo.d/* 脚本文件
cat > /etc/yum.repo.d/media.repo <<EOF
[base]
name=base
baseurl=file:///media/
gpgcheck=0
EOF

useradd wang 创建用户
echo 111111|passwd --stdin wang 设置密码

mkird /root/.ssh 基于Kry登录
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+JozTFawnUT1125IPO6C3NIwMuEsb
rKngSIiF9RsiLZ9Kn2kEyZDVtAXD0IGhXrWFqWW8MEPIOxVQwWVsUDvC2gcmqoh5QRxlrsPzZaCj
/z5O7Igqj1bu7HrkQGtBSk+UgxFrCxl8WnhKNssz6OKva3UpPcqmiwvGjEPWbNZrcufW7d2JzU+B
xHoO/748GADIEhYOfxzlRopqNrYtQTlNmx+3fXwdBGJTJfYODJF8zu9SGxnvRYnD/i78pRc7Qv3/
/fzH1AYlML2wdshMzIYQp9to6BGDhqwuN8MO95gTU8yI9Ndwsf7fZhNK8WSzbOWjPwEFgaKAd8DU
95PLG+8D root@centos7' > root/.ssh/authorized_keys

 8:[root@centos7 /var/ftp/pub]# ls 
       centos7  ks7.cfg
      [root@centos7 /var/ftp/pub]# chmod +r ks7.cfg     就可以在网页上打开次文件了

8:用光盘引导启动

 制作自动应答光盘

我们现在已经有一个ks文件了,接下来需要把ks文件加入到光盘文件中来实现自动安装,就不用每次用过光盘引导输入开ks ..........一大长串字符了。

1、准备安装文件

[root@centos6 /data]# mkdir boot
[root@centos6 /data]# cp -r /media/isolinux/ /data/boot
[root@centos6 /data]# mkdir ksdir
[root@centos6 /data]# cp /root/ks6.cfg  ksdir/

2:修改配置文件

label linux     
  menu label ^Auto Install an system
  kernel vmlinuz
  append initrd=initrd.img ks=cdrom:/ksdir/ks6.cfg   应答文件
label vesa
  menu label Install ^Manual centos
  kernel vmlinuz                    dhcp 默认获取地址
  append initrd=initrd.img reop=http://192.168.1.12/centos/6/os/x86_64/  手工安装
label local
  menu label Boot from ^local drive   本地硬盘启动
  menu default
  localboot 0xffff

3、制作ISO文件,

[root@centos7 ~]#mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V "CentOS 6.9 x86_64 boot" -b isolinux/isolinux.bin -c 
isolinux/boot.cat -o /root/boot.iso /data/boot:注意:以上相对路径都是相对于光盘的根,和工作目录无关

一 :制作完整的iso 文件,上面的步骤知识光盘应道,还是要手动安装

1[root@centos6 ~]# cp -r /media/ /data/centos6   复制光盘下所有的内容,包括隐藏文件,复制后命名为centos6
2[root@centos6 /data]# find -name TRANS.TBL 删除文件夹所有的这种文件
[root@centos6 /data]# find -name TRANS.TBL -exec rm {} \; 删除文件夹所有的这种文件
3[root@centos6 /data/centos6]# rm -rf repodata/ 删除此文件夹,重新生成新的
4:[root@centos6 /data/centos6]# createrepo -g /media/repodata/43d8fd068164b0f042845474d6a22262798b9f0d1f49ad1bf9f95b953089777d-c6-x86_64-comps.xml  .
(包的分组) 重新创建yum 源的yuan数据
5:[root@centos6 /data/ksdir]# vim ks6.cfg 修改应答文件中的安装方法,将网络改为cdrom
6:[root@centos6 /data/centos6/isolinux]# vim isolinux.cfg 修改启动菜单
label linux
    menu label ^Auto Install an system
    menu default
    kernel vmlinuz
    append initrd=initrd.img ks=cdrom:/ksdir/ks6.cfg
label manual
    menu label ^Manual installed an system
    kernel vmlinuz
    append initrd=initrd.img
label local
    menu default
    menu label Boot from ^local drive
    localboot 0xffff

7:[root@centos6 ~]# mkisofs -R -J -T -v --no-emul-boot --boot-load-size 4 --boot-info-table -V "CentOS 6.9 x86_64 boot" -b isolinux/isolinux.bin -c
isolinux/boot.cat -o /root/centos6.9.iso /data/centos6/ 刻光盘

5:创建U盘启动盘 dd if=/dev/sr0 of=/dev/sdb

补充:yum安装sz 命令:yum install -y lrzsz

 
系统光盘中isolinux目录列表
? solinux.bin:光盘引导程序,在mkisofs的选项中需要明确给出文件路径,这个 文件属于SYSLINUX项目
  ?  isolinux.cfg:isolinux.bin的配置文件,当光盘启动后(即运行isolinux.bin), 会自动去找isolinux.cfg文件
  ? vesamenu.c32:是光盘启动后的安装图形界面,也属于SYSLINUX项目, menu.c32版本是纯文本的菜单
  ? Memtest:内存检测,这是一个独立的程序
  ? splash.jgp:光盘启动界面的背景图
 ? vmlinuz是内核映像
 ? initrd.img是ramfs (先cpio,再gzip压缩)

mkisofs命令

  • -o 指定映像文件的名称
  • -b 指定在制作可开机光盘时所需的开机映像文件
  • -c 制作可开机光盘时,会将开机映像文件中的 no-eltorito-catalog 全部内容作成一个文件
  • -no-emul-boot 非模拟模式启动
  • -boot-load-size 4 设置载入部分的数量
  • -boot-info-table 在启动的图像中现实信息
  • -R 或 -rock 使用 Rock RidgeExtensions
  • -J 或 -joliet 使用 Joliet 格式的目录与文件名称
  • -v 或 -verbose 执行时显示详细的信息
  • -T 或 -translation-table 建立文件名的转换表,适用于不支持 Rock RidgeExtensions 的系统上

 

 
DHCP服务
 
? 网络配置 静态指定
     动态获取: bootp:boot protocol MAC与IP一一静态对应 bootpIP地址固定
       dhcp:增强的bootp,动态 #用较少的ip给较多的计算机提供使用
? DHCP: (Dynamic Host Configuration Protocol)
  动态主机配置协议 局域网协议,UDP协议
? 主要用途
  用于内部网络和网络服务供应商自动分配IP地址给用户
  用于内部网络管理员作为对所有电脑作集中管理的手段
? 使用场景
  自动化安装系统
   解决IPV4资源不足问题

 

? DHCP共有八种报文

DHCP DISCOVER:客户端到服务器

DHCP OFFER :服务器到客户端
DHCP REQUEST:客户端到服务器
DHCP ACK :服务器到客户端
DHCP NAK:服务器到客户端,通知用户无法分配合适的IP 地址
DHCP DECLINE :客户端到服务器,指示地址已被使用
DHCP RELEASE:客户端到服务器,放弃网络地址和取消 剩余的租约时间
DHCP INFORM:客户端到服务器, 客户端如果需要从DHCP 服务器端获取更为详细的配置信息,则发送Inform报文向 服务器进行请求,极少用到
? 续租
  50% :租赁时间达到50%时来续租,刚向DHCP服务器发向新的DHCPREQUEST 请求。如果dhcp服务没有拒绝的理由,则回应DHCPACK信息。当DHCP客户端 收到该应答信息     后,就重新开始新的租用周期
  87.5%:如果之前DHCP Server没有回应续租请求,等到租约期的7/8时,主机 会再发送一次广播请求
? 同网段多DHCP服务
  DHCP服务必须基于本地
  先到先得的原则
? 跨网段
  RFC(请求入解) 1542 Compliant Routers #可以通过路由器
  dhcrelay: 中继 #可以找代理,事先知道dhcp的服务器,如果发现有客户端的请求通过单播向dhcp服务器要一个地址,然后给客户端
通常情况下 可以在路由器上在网卡接口上配一个代理,启用次功能
? 相关协议
  Arp 免费arp:
  rarp:把mak地址解析成ip地址,当自己的mak地址是固定的,就向dhcp服务器寻求相对应的ip地址,比较固定
? DHCP服务实现
  1Linux DHCP协议的实现程序:dhcp, dnsmasq(dhcp,dns)
   2 Dhcp Server
     /usr/sbin/dhcpd
      /etc/dhcp/dhcpd.conf --> /etc/rc.d/init.d/dhcpd
      /etc/dhcp/dhcpd6.conf--> /etc/rc.d/init.d/dhcpd6
    /usr/sbin/dhcrelay
      /etc/rc.d/init.d/dhcrelay
    dhcp server:67/udp
    dhcp client: 68/udp
    dhcpv6 client:546/udp
3 Dhcp client
    dhclient
    自动获取的IP信息: /var/lib/dhclient
? DHCP配置文件
  dhcpd.conf: 帮助参考:man 5 dhcpd.conf
全局配置
subnet {
...
}
host {
}
  地址分配记录: /var/lib/dhcpd/dhcpd.leases
   其它配置选项:
    filename: 指明引导文件名称
    next-server:提供引导文件的服务器IP地址
  示例:
    filename "pxelinux.0";
    next-server 192.168.100.100;
  检查语法 service dhcpd configtest
? dhcpd.conf示例
   option domain-name "magedu.com";
   option domain-name-servers 192.168.0.1,8.8.8.8;
  default-lease-time 86400;
  max-lease-time 86400;
  subnet 192.168.100.0 netmask 255.255.255.0 {
    range 192.168.100.1 192.168.100.200;
    option routers 192.168.100.1;
  }
 
 
PXE介绍
PXE: Preboot Excution Environment 预启动执行环境 Intel公司研发 基于Client/Server的网络模式,支持远程主机通过网络从远端服务器下载 映像,并由此支持通过网络启动操作系统 PXE可以引导和安装Windows,linux等多种操作系统
 
pxe工作原理
  1. Client向PXE Server上的DHCP发送IP地址请求消息,DHCP检测Client是否合法(主要是检测Client的网卡MAC地址),如果合法则返回Client的IP地址,同时将启动文件pxelinux.0的位置信息一并传送给Client
  2. Client向PXE Server上的TFTP发送获取pxelinux.0请求消息,TFTP接收到消息之后再向Client发送pxelinux.0大小信息,试探Client是否满意,当TFTP收到Client发回的同意大小信息之后,正式向Client发送pxelinux.0
  3. Client执行接收到的pxelinux.0文件
  4. Client向TFTP Server发送针对本机的配置信息文件(在TFTP 服务的pxelinux.cfg目录下),TFTP将配置文发回Client,继而Client根据配置文件执行后续操作。
  5. Client向TFTP发送Linux内核请求信息,TFTP接收到消息之后将内核文件发送给Client
  6. Client向TFTP发送根文件请求信息,TFTP接收到消息之后返回Linux根文件系统
  7. Client启动Linux内核
  8. Client下载安装源文件,读取自动化安装脚本

 

 
 
 
 
 
 
 

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:linux(centos)无中文输入,如何解决

下一篇:Kali入门配置使用(一)