码迷,mamicode.com
首页 > 其他好文 > 详细

pxe批量装机

时间:2019-08-26 21:24:52      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:sign   def   tftp服务   use   inetd   无人值守安装   rsa   挂载   数据库   

关闭防火墙
[root@localhost ~]# iptables -F
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
挂载光盘
[root@localhost ~]# mkdir /media/cdrom
[root@localhost ~]# mount /dev/cdrom /media/cdrom/
mount: /dev/sr0 写保护,将以只读方式挂载
安装并开启ftp服务
[root@localhost ~]# rpm -ivh /media//cdrom/Packages/vsftpd*.rpm
警告:/media//cdrom/Packages/vsftpd-3.0.2-25.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:vsftpd-3.0.2-25.el7              ################################# [100%]
[root@localhost ~]# umount /dev/cdrom
[root@localhost ~]# mount /dev/cdrom/ /var/ftp/centos
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[root@localhost yum.repos.d]# vim local.repo
[root@localhost yum.repos.d]# cat local.repo
[cdrom]
name=cdrom
baseurl=ftp://192.168.200.113/centos
enabled=1
gpgcheck=0
[root@localhost yum.repos.d]# yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源: cdrom
Cleaning up list of fastest mirrors
[root@localhost yum.repos.d]# yum makecache
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
cdrom                                                    | 3.6 kB     00:00    
(1/4): cdrom/group_gz                                      | 166 kB   00:00    
(2/4): cdrom/filelists_db                                  | 3.2 MB   00:00    
(3/4): cdrom/primary_db                                    | 3.1 MB   00:00    
(4/4): cdrom/other_db                                      | 1.3 MB   00:00    
元数据缓存已建立
安装TFTP服务默认通过xinetd管理
[root@localhost ~]# yum -y install tftp-server xinetd
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 tftp-server.x86_64.0.5.2-22.el7 将被 安装
---> 软件包 xinetd.x86_64.2.2.3.15-13.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
 Package             架构           版本                    源             大小
================================================================================
正在安装:
 tftp-server         x86_64         5.2-22.el7              cdrom          47 k
 xinetd              x86_64         2:2.3.15-13.el7         cdrom         128 k
事务概要
================================================================================
安装  2 软件包
总下载量:175 k
安装大小:325 k
Downloading packages:
(1/2): xinetd-2.3.15-13.el7.x86_64.rpm                     | 128 kB   00:00    
(2/2): tftp-server-5.2-22.el7.x86_64.rpm                   |  47 kB   00:00    
--------------------------------------------------------------------------------
总计                                               294 kB/s | 175 kB  00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
  正在安装    : 2:xinetd-2.3.15-13.el7.x86_64                               1/2
  正在安装    : tftp-server-5.2-22.el7.x86_64                               2/2
  验证中      : tftp-server-5.2-22.el7.x86_64                               1/2
  验证中      : 2:xinetd-2.3.15-13.el7.x86_64                               2/2
已安装:
  tftp-server.x86_64 0:5.2-22.el7         xinetd.x86_64 2:2.3.15-13.el7       
完毕!
修改配置文件
[root@localhost ~]# vim /etc/xinetd.d/tftp
[root@localhost ~]# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol.  The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
 socket_type  = dgram
 protocol  = udp
 wait   = yes
 user   = root
 server   = /usr/sbin/in.tftpd
 server_args  = -s /var/lib/tftpboot
 disable   = no
 per_source  = 11
 cps   = 100 2
 flags   = IPv4
}ts.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
开启服务
[root@localhost ~]# systemctl start tftp
[root@localhost ~]# systemctl enable tftp
Created symlink from /etc/systemd/system/socke
准备linux内核。初始化镜像
[root@localhost ~]# cd /var/ftp/centos/images/pxeboot/
[root@localhost pxeboot]# cp vmlinuz initrd.img /var/lib/tftpboot/
[root@localhost pxeboot]# cd
[root@localhost ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@localhost ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
[root@localhost ~]# cat /var/lib/tftpboot/pxelinux.cfg/default
default 1
prompt 1
label linux
 kernel vmlinuz
 append initrd=initrd.img method=ftp://192.168.200.113/centos
[root@localhost ~]#
安装syslinux用于引导启动
[root@localhost ~]# yum -y install syslinux
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 syslinux.x86_64.0.4.05-15.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
 Package           架构            版本                    源              大小
================================================================================
正在安装:
 syslinux          x86_64          4.05-15.el7             cdrom          990 k
事务概要
================================================================================
安装  1 软件包
总下载量:990 k
安装大小:2.3 M
Downloading packages:
syslinux-4.05-15.el7.x86_64.rpm                            | 990 kB   00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : syslinux-4.05-15.el7.x86_64                                 1/1
  验证中      : syslinux-4.05-15.el7.x86_64                                 1/1
已安装:
  syslinux.x86_64 0:4.05-15.el7                                                
完毕!
[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

安装并启用DHCP服务
[root@localhost ~]# yum -y install dhcp
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 dhcp.x86_64.12.4.2.5-68.el7.centos.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
 Package     架构          版本                              源            大小
================================================================================
正在安装:
 dhcp        x86_64        12:4.2.5-68.el7.centos.1          cdrom        513 k
事务概要
================================================================================
安装  1 软件包
总下载量:513 k
安装大小:1.4 M
Downloading packages:
dhcp-4.2.5-68.el7.centos.1.x86_64.rpm                      | 513 kB   00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : 12:dhcp-4.2.5-68.el7.centos.1.x86_64                        1/1
  验证中      : 12:dhcp-4.2.5-68.el7.centos.1.x86_64                        1/1
已安装:
  dhcp.x86_64 12:4.2.5-68.el7.centos.1                                         
完毕!
完毕!
[root@localhost ~]# /bin/cp -f /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
修改配置文件
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
[root@localhost ~]# cat /etc/dhcp/dhcpd.conf
option domain-name "baobao";
option domain-name-servers 192.168.200.113;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.200.0  netmask 255.255.255.0 {
  range 192.168.200.10 192.168.200.100;
  option routers 192.168.200.1;
 next-server 192.168.200.113;
filename "pxelinux.0";
}
[root@localhost ~]# systemctl start dhcpd  //开启
 

================================================
无人值守安装
[root@localhost ~]# yum -y install system-config-kickstart
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 system-config-kickstart.noarch.0.2.9.7-1.el7 将被 安装
--> 正在处理依赖关系 system-config-keyboard >= 1.3.1,它被软件包 system-config-kickstart-2.9.7-1.el7.noarch 需要
--> 正在处理依赖关系 system-config-language,它被软件包 system-config-kickstart-2.9.7-1.el7.noarch 需要
--> 正在处理依赖关系 system-config-date,它被软件包 system-config-kickstart-2.9.7-1.el7.noarch 需要
--> 正在检查事务
---> 软件包 system-config-date.noarch.0.1.10.6-3.el7.centos 将被 安装
--> 正在处理依赖关系 system-config-date-docs,它被软件包 system-config-date-1.10.6-3.el7.centos.noarch 需要
--> 正在处理依赖关系 gnome-python2-canvas,它被软件包 system-config-date-1.10.6-3.el7.centos.noarch 需要
---> 软件包 system-config-keyboard.noarch.0.1.4.0-5.el7 将被 安装
--> 正在处理依赖关系 system-config-keyboard-base = 1.4.0-5.el7,它被软件包 system-config-keyboard-1.4.0-5.el7.noarch 需要
---> 软件包 system-config-language.noarch.0.1.4.0-9.el7 将被 安装
--> 正在处理依赖关系 usermode-gtk,它被软件包 system-config-language-1.4.0-9.el7.noarch 需要
--> 正在检查事务
---> 软件包 gnome-python2-canvas.x86_64.0.2.28.1-14.el7 将被 安装
--> 正在处理依赖关系 gnome-python2(x86-64) = 2.28.1-14.el7,它被软件包 gnome-python2-canvas-2.28.1-14.el7.x86_64 需要
--> 正在处理依赖关系 libgnomecanvas(x86-64) >= 2.8.0,它被软件包 gnome-python2-canvas-2.28.1-14.el7.x86_64 需要
--> 正在处理依赖关系 libgnomecanvas-2.so.0()(64bit),它被软件包 gnome-python2-canvas-2.28.1-14.el7.x86_64 需要
--> 正在处理依赖关系 libart_lgpl_2.so.2()(64bit),它被软件包 gnome-python2-canvas-2.28.1-14.el7.x86_64 需要
---> 软件包 system-config-date-docs.noarch.0.1.0.11-4.el7 将被 安装
--> 正在处理依赖关系 rarian-compat,它被软件包 system-config-date-docs-1.0.11-4.el7.noarch 需要
---> 软件包 system-config-keyboard-base.noarch.0.1.4.0-5.el7 将被 安装
---> 软件包 usermode-gtk.x86_64.0.1.111-5.el7 将被 安装
--> 正在检查事务
---> 软件包 gnome-python2.x86_64.0.2.28.1-14.el7 将被 安装
---> 软件包 libart_lgpl.x86_64.0.2.3.21-10.el7 将被 安装
---> 软件包 libgnomecanvas.x86_64.0.2.30.3-8.el7 将被 安装
---> 软件包 rarian-compat.x86_64.0.0.8.1-11.el7 将被 安装
--> 正在处理依赖关系 rarian = 0.8.1-11.el7,它被软件包 rarian-compat-0.8.1-11.el7.x86_64 需要
--> 正在处理依赖关系 rarian,它被软件包 rarian-compat-0.8.1-11.el7.x86_64 需要
--> 正在处理依赖关系 librarian.so.0()(64bit),它被软件包 rarian-compat-0.8.1-11.el7.x86_64 需要
--> 正在检查事务
---> 软件包 rarian.x86_64.0.0.8.1-11.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
 Package                        架构      版本                   源        大小
================================================================================
正在安装:
 system-config-kickstart        noarch    2.9.7-1.el7            cdrom    348 k
为依赖而安装:
 gnome-python2                  x86_64    2.28.1-14.el7          cdrom     47 k
 gnome-python2-canvas           x86_64    2.28.1-14.el7          cdrom     34 k
 libart_lgpl                    x86_64    2.3.21-10.el7          cdrom     67 k
 libgnomecanvas                 x86_64    2.30.3-8.el7           cdrom    226 k
 rarian                         x86_64    0.8.1-11.el7           cdrom     98 k
 rarian-compat                  x86_64    0.8.1-11.el7           cdrom     66 k
 system-config-date             noarch    1.10.6-3.el7.centos    cdrom    591 k
 system-config-date-docs        noarch    1.0.11-4.el7           cdrom    527 k
 system-config-keyboard         noarch    1.4.0-5.el7            cdrom     33 k
 system-config-keyboard-base    noarch    1.4.0-5.el7            cdrom    103 k
 system-config-language         noarch    1.4.0-9.el7            cdrom    133 k
 usermode-gtk                   x86_64    1.111-5.el7            cdrom    109 k
事务概要
================================================================================
安装  1 软件包 (+12 依赖软件包)
总下载量:2.3 M
安装大小:8.3 M
Downloading packages:
(1/13): gnome-python2-canvas-2.28.1-14.el7.x86_64.rpm      |  34 kB   00:00    
(2/13): gnome-python2-2.28.1-14.el7.x86_64.rpm             |  47 kB   00:00    
(3/13): libart_lgpl-2.3.21-10.el7.x86_64.rpm               |  67 kB   00:00    
(4/13): libgnomecanvas-2.30.3-8.el7.x86_64.rpm             | 226 kB   00:00    
(5/13): rarian-compat-0.8.1-11.el7.x86_64.rpm              |  66 kB   00:00    
(6/13): rarian-0.8.1-11.el7.x86_64.rpm                     |  98 kB   00:00    
(7/13): system-config-date-1.10.6-3.el7.centos.noarch.rpm  | 591 kB   00:00    
(8/13): system-config-date-docs-1.0.11-4.el7.noarch.rpm    | 527 kB   00:00    
(9/13): system-config-keyboard-base-1.4.0-5.el7.noarch.rpm | 103 kB   00:00    
(10/13): system-config-keyboard-1.4.0-5.el7.noarch.rpm     |  33 kB   00:00    
(11/13): system-config-kickstart-2.9.7-1.el7.noarch.rpm    | 348 kB   00:00    
(12/13): system-config-language-1.4.0-9.el7.noarch.rpm     | 133 kB   00:00    
(13/13): usermode-gtk-1.111-5.el7.x86_64.rpm               | 109 kB   00:00    
--------------------------------------------------------------------------------
总计                                               4.0 MB/s | 2.3 MB  00:00    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : libart_lgpl-2.3.21-10.el7.x86_64                           1/13
  正在安装    : libgnomecanvas-2.30.3-8.el7.x86_64                         2/13
  正在安装    : gnome-python2-2.28.1-14.el7.x86_64                         3/13
  正在安装    : gnome-python2-canvas-2.28.1-14.el7.x86_64                  4/13
  正在安装    : usermode-gtk-1.111-5.el7.x86_64                            5/13
  正在安装    : system-config-language-1.4.0-9.el7.noarch                  6/13
  正在安装    : rarian-0.8.1-11.el7.x86_64                                 7/13
  正在安装    : rarian-compat-0.8.1-11.el7.x86_64                          8/13
  正在安装    : system-config-date-docs-1.0.11-4.el7.noarch                9/13
  正在安装    : system-config-date-1.10.6-3.el7.centos.noarch             10/13
  正在安装    : system-config-keyboard-base-1.4.0-5.el7.noarch            11/13
  正在安装    : system-config-keyboard-1.4.0-5.el7.noarch                 12/13
  正在安装    : system-config-kickstart-2.9.7-1.el7.noarch                13/13
  验证中      : libgnomecanvas-2.30.3-8.el7.x86_64                         1/13
  验证中      : system-config-keyboard-base-1.4.0-5.el7.noarch             2/13
  验证中      : system-config-date-docs-1.0.11-4.el7.noarch                3/13
  验证中      : system-config-language-1.4.0-9.el7.noarch                  4/13
  验证中      : system-config-date-1.10.6-3.el7.centos.noarch              5/13
  验证中      : system-config-keyboard-1.4.0-5.el7.noarch                  6/13
  验证中      : system-config-kickstart-2.9.7-1.el7.noarch                 7/13
  验证中      : gnome-python2-canvas-2.28.1-14.el7.x86_64                  8/13
  验证中      : rarian-compat-0.8.1-11.el7.x86_64                          9/13
  验证中      : rarian-0.8.1-11.el7.x86_64                                10/13
  验证中      : usermode-gtk-1.111-5.el7.x86_64                           11/13
  验证中      : libart_lgpl-2.3.21-10.el7.x86_64                          12/13
  验证中      : gnome-python2-2.28.1-14.el7.x86_64                        13/13
已安装:
  system-config-kickstart.noarch 0:2.9.7-1.el7                                 
作为依赖被安装:
  gnome-python2.x86_64 0:2.28.1-14.el7                                         
  gnome-python2-canvas.x86_64 0:2.28.1-14.el7                                  
  libart_lgpl.x86_64 0:2.3.21-10.el7                                           
  libgnomecanvas.x86_64 0:2.30.3-8.el7                                         
  rarian.x86_64 0:0.8.1-11.el7                                                 
  rarian-compat.x86_64 0:0.8.1-11.el7                                          
  system-config-date.noarch 0:1.10.6-3.el7.centos                              
  system-config-date-docs.noarch 0:1.0.11-4.el7                                
  system-config-keyboard.noarch 0:1.4.0-5.el7                                  
  system-config-keyboard-base.noarch 0:1.4.0-5.el7                             
  system-config-language.noarch 0:1.4.0-9.el7                                  
  usermode-gtk.x86_64 0:1.111-5.el7                                            
完毕!
[root@localhost ~]# system-config-kickstart   进入桌面

pxe批量装机

标签:sign   def   tftp服务   use   inetd   无人值守安装   rsa   挂载   数据库   

原文地址:https://www.cnblogs.com/CAPF/p/11414674.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!