linux 基础 PEX

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux 基础 PEX相关的知识,希望对你有一定的参考价值。



#####PXE######

 

PXE的工作过程:

1.PXE Client 从自己的PXE网卡启动,向本网络中的DHCP服务器索取IP;

2.DHCP服务器返回分配给客户机的IP以及PXE文件的放置位置(该文件一般是放在一台TFTP服务器上);

3.PXE Client向本机网络中的TFTP服务器索取pxelinux.0文件;

4.PXE Client取得pxelinux.0文件后执行该文件;

5.根据pxelinux.0的执行结果,通过TFTP服务器加载内核和文件系统;

 

#####1.kickstart文件共享,配置http安装方式#####

1.

[[email protected] ~]# yum install httpd -y

[[email protected] ~]# systemctl start httpd

[[email protected] ~]# systemctl stop firewalld.service

 

[[email protected] ~]# mkdir /var/www/html/rhel7.1

[[email protected] ~]# mount /dev/sr0 /var/www/html/rhel7.1

mount: /dev/sr0 is write-protected, mounting read-only

 

2.关机重启后依旧挂载

[[email protected] ~]# vim /etc/fstab

 

/dev/sr0  /var/www/html/rhel7.1    defaults   0   0


技术分享

[[email protected] ~]# mount -a

#####2配置tftp#######

[[email protected] ~]# yum install tftp-server -y    ####安装tftp服务

[[email protected] ~]# vim /etc/xinetd.d/tftp         ####启动tftp服务

 


技术分享


[[email protected] ~]# systemctl restart xinetd.service

[[email protected] ~]# chkconfig --list

 

Note: This output shows SysV services only and does not include native

      systemd services. SysV configuration data might be overridden by native

      systemd configuration.

 

      If you want to list systemd services use ‘systemctl list-unit-files‘.

      To see services enabled on particular target use

      ‘systemctl list-dependencies [target]‘.

 

iprdump        0:off1:off2:on3:on4:on5:on6:off

iprinit        0:off1:off2:on3:on4:on5:on6:off

iprupdate      0:off1:off2:on3:on4:on5:on6:off

netconsole     0:off1:off2:off3:off4:off5:off6:off

network        0:off1:off2:on3:on4:on5:on6:off

rhnsd          0:off1:off2:on3:on4:on5:on6:off

 

xinetd based services:

chargen-dgram: off

chargen-stream:off

daytime-dgram: off

daytime-stream:off

discard-dgram: off

discard-stream:off

echo-dgram:    off

echo-stream:   off

tcpmux-server: off

tftp:          on

time-dgram:    off

time-stream:   off

 

#######配置ks.cfg文件######

 

 

Kickstart:是一种无人值手的安装方式。Kickstart脚本是自动应答系统在安装过程中一切问题的脚本文件,这个文件可以实现系统的自动安装。在系统安装完成后会在系统的root家目录中生成anaconda-ks.cfg,这个文件就是以此系统为模板生成的kickstart脚本。

 

#####kickstart脚本的制作####

手动编写kickstart的难度大,系统中system-config-kickstart工具可以以图形的方式制作kickstart脚本。

 

 

[[email protected] ~]# yum provides */system-config-kickstart                        ####找出有此工具的安装包

 

[[email protected] ~]# yum install system-config-kickstart-2.9.2-4.el7.noarch -y     ###安装图形制作工具

[[email protected] ~]# system-config-kickstart                                        ###打开图形ks制作工具

/usr/share/system-config-kickstart/kickstartGui.py:104: GtkWarning: GtkSpinButton: setting an adjustment with non-zero page size is deprecated

  xml = gtk.glade.XML ("/usr/share/system-config-kickstart/system-config-kickstart.glade", domain="system-config-kickstart")

Loaded plugins: langpacks


技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享

技术分享


ks.cfg文将保存到/var/www/html/中

[[email protected] ~]# cd /var/www/html/

[[email protected] html]# ls

ks.cfg  rhel7.1

[[email protected] html]# vim ks.cfg

 

%packages

@base

lftp

%end

 

[[email protected] html]# ksvalidator ks.cfg             ####检验ks.cfg语法

 

#######配置支持PXE的启动程序########

 

 

[[email protected] html]# yum whatprovides */pxelinux.0

Loaded plugins: langpacks

syslinux-4.05-12.el7.x86_64 : Simple kernel loader which boots from a FAT filesystem

Repo        : rhel_dvd

Matched from:

Filename    : /usr/share/syslinux/pxelinux.0

[[email protected] html]# yum install syslinux-4.05-12.el7.x86_64  -y

[[email protected] html]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

[[email protected] html]# cd /var/lib/tftpboot

[[email protected] tftpboot]# ls

pxelinux.0

[[email protected] ~]# mount /dev/sr0 /mnt/

mount: /dev/sr0 is write-protected, mounting read-only

[[email protected] ~]# df

Filesystem     1K-blocks    Used Available Use% Mounted on

/dev/vda1       10473900 3377228   7096672  33% /

devtmpfs          927072       0    927072   0% /dev

tmpfs             942660     140    942520   1% /dev/shm

tmpfs             942660   17080    925580   2% /run

tmpfs             942660       0    942660   0% /sys/fs/cgroup

/dev/sr0         3798292 3798292         0 100% /mnt

[[email protected] ~]# cd /mnt/

[[email protected] mnt]# ls

addons  GPL       LiveOS      release-notes            RPM-GPG-KEY-redhat-release

EFI     images    media.repo  repodata                 TRANS.TBL

EULA    isolinux  Packages    RPM-GPG-KEY-redhat-beta

[[email protected] mnt]# cd isolinux/

[[email protected] isolinux]# ls

boot.cat  grub.conf   isolinux.bin  memtest     TRANS.TBL    vesamenu.c32

boot.msg  initrd.img  isolinux.cfg  splash.png  upgrade.img  vmlinuz

[[email protected] tftpboot]# cp -r /mnt/isolinux/* /var/lib/tftpboot/

[[email protected] tftpboot]# ls

boot.cat  grub.conf   isolinux.bin  memtest     splash.png  upgrade.img   vmlinuz

boot.msg  initrd.img  isolinux.cfg  pxelinux.0  TRANS.TBL   vesamenu.c32

[[email protected] tftpboot]# mkdir pxelinux.cfg

[[email protected] tftpboot]# cp isolinux.cfg pxelinux.cfg/default

[[email protected] tftpboot]# ls

boot.cat  grub.conf   isolinux.bin  memtest     pxelinux.cfg  TRANS.TBL    vesamenu.c32

boot.msg  initrd.img  isolinux.cfg  pxelinux.0  splash.png    upgrade.img  vmlinuz

[[email protected] tftpboot]# cd pxelinux.cfg/

[[email protected] pxelinux.cfg]# ls

default

[[email protected] pxelinux.cfg]# vim default

可在此文件中改标题等

 

 

#########配置dhcp服务########

 

 

[email protected] ~]# yum install dhcp -y

[[email protected] ~]# cd /etc/dhcp

[[email protected] dhcp]# ls

dhclient.d  dhcpd6.conf  dhcpd.conf

[[email protected] dhcp]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

cp: overwrite ‘/etc/dhcp/dhcpd.conf’? yes

[[email protected] dhcp]# vim dhcpd.conf


技术分享

技术分享



[[email protected] dhcp]# systemctl restart dhcpd

 

 

#########检测是否搭建成功######

 

新建虚拟机


技术分享

技术分享

本文出自 “12112684” 博客,请务必保留此出处http://12122684.blog.51cto.com/12112684/1875191

以上是关于linux 基础 PEX的主要内容,如果未能解决你的问题,请参考以下文章

BitTorrent 的 Peer Exchange (PEX) 协议规范在哪里/是啥?

DHT 和 PEX 跟踪哪些对等点

Pex(测试生成)真的有用吗?

如何告诉 Pex 不要存根具有具体实现的抽象类

BitTorrent 协议中的 PEX 和 DHT 有啥区别?

PEX 批量装机