设为首页 收藏本站
查看: 995|回复: 0

[经验分享] linux 基础 PEX

[复制链接]

尚未签到

发表于 2018-5-18 13:36:50 | 显示全部楼层 |阅读模式
  

  

  #####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.
  [root@localhost ~]# yum install httpd -y
  [root@localhost ~]# systemctl start httpd
  [root@localhost ~]# systemctl stop firewalld.service
  
  [root@localhost ~]# mkdir /var/www/html/rhel7.1
  [root@localhost ~]# mount /dev/sr0 /var/www/html/rhel7.1
  mount: /dev/sr0 is write-protected, mounting read-only
  
  2.关机重启后依旧挂载
  [root@localhost ~]# vim /etc/fstab
  
  /dev/sr0  /var/www/html/rhel7.1    defaults   0   0
  

DSC0000.png

  [root@localhost ~]# mount -a

  #####2配置tftp#######
  [root@localhost ~]# yum install tftp-server -y    ####安装tftp服务
  [root@localhost ~]# vim /etc/xinetd.d/tftp         ####启动tftp服务
  
  

DSC0001.png

  

  [root@localhost ~]# systemctl restart xinetd.service

  [root@localhost ~]# 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脚本。
  
  
  [root@localhost ~]# yum provides */system-config-kickstart                        ####找出有此工具的安装包
  
  [root@localhost ~]# yum install system-config-kickstart-2.9.2-4.el7.noarch -y     ###安装图形制作工具
  [root@localhost ~]# 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
  

DSC0002.png

DSC0003.png

DSC0004.png

DSC0005.png

DSC0006.png

DSC0007.png

DSC0008.png

DSC0009.png

DSC00010.png

  

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

  [root@localhost ~]# cd /var/www/html/
  [root@localhost html]# ls
  ks.cfg  rhel7.1
  [root@localhost html]# vim ks.cfg
  
  %packages
  @base
  lftp
  %end
  
  [root@localhost html]# ksvalidator ks.cfg             ####检验ks.cfg语法
  
  #######配置支持PXE的启动程序########
  
  
  [root@localhost 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
  [root@localhost html]# yum install syslinux-4.05-12.el7.x86_64  -y
  [root@localhost html]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
  [root@localhost html]# cd /var/lib/tftpboot
  [root@localhost tftpboot]# ls
  pxelinux.0
  [root@localhost ~]# mount /dev/sr0 /mnt/
  mount: /dev/sr0 is write-protected, mounting read-only
  [root@localhost ~]# 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
  [root@localhost ~]# cd /mnt/
  [root@localhost 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
  [root@localhost mnt]# cd isolinux/
  [root@localhost isolinux]# ls
  boot.cat  grub.conf   isolinux.bin  memtest     TRANS.TBL    vesamenu.c32
  boot.msg  initrd.img  isolinux.cfg  splash.png  upgrade.img  vmlinuz
  [root@localhost tftpboot]# cp -r /mnt/isolinux/* /var/lib/tftpboot/
  [root@localhost 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
  [root@localhost tftpboot]# mkdir pxelinux.cfg
  [root@localhost tftpboot]# cp isolinux.cfg pxelinux.cfg/default
  [root@localhost 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
  [root@localhost tftpboot]# cd pxelinux.cfg/
  [root@localhost pxelinux.cfg]# ls
  default
  [root@localhost pxelinux.cfg]# vim default
  可在此文件中改标题等
  
  
  #########配置dhcp服务########
  
  
  root@localhost ~]# yum install dhcp -y
  [root@localhost ~]# cd /etc/dhcp
  [root@localhost dhcp]# ls
  dhclient.d  dhcpd6.conf  dhcpd.conf
  [root@localhost dhcp]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
  cp: overwrite ‘/etc/dhcp/dhcpd.conf’? yes
  [root@localhost dhcp]# vim dhcpd.conf
  

DSC00011.png

DSC00012.png

  

  

  [root@localhost dhcp]# systemctl restart dhcpd
  
  
  #########检测是否搭建成功######
  
  新建虚拟机
  

   DSC00013.png
DSC00014.png

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-461769-1-1.html 上篇帖子: linux 基础9 下篇帖子: linux rm 命令
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表