zoukankan      html  css  js  c++  java
  • dhcp、tftp、httpd、pxe安装CentOS6.9

    虚拟机网络设置

    要xshell连接虚拟机注意设置VMware Network Adapter VMnet2在同一网段

    1、利用光盘配置本地yum源

    [root@ZYB ~]# mount -r /dev/cdrom /mnt/
    [root@ZYB ~]# vim /etc/yum.repos.d/media.repo
    [Media]
    name=hahha
    baseurl=file:///mnt/
    enabled=1
    gpgcheck=0
    cost=100
    

    2、配置dhcp主机ip地址

    [root@ZYB ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE=eth0
    TYPE=Ethernet
    UUID=af5e10e2-2839-47a4-9386-3d1881a57cc9
    ONBOOT=yes
    NM_CONTROLLED=yes
    BOOTPROTO=static
    HWADDR=00:0C:29:E9:26:5F
    DEFROUTE=yes
    PEERDNS=yes
    PEERROUTES=yes
    IPV4_FAILURE_FATAL=yes
    IPV6INIT=no
    NAME="System eth0"
    IPADDR=192.168.0.2
    NETMASK=255.255.255.0
    [root@ZYB ~]# service network restart
    

    3、配置DHCP服务器,并指定tftp server地址
    注意:DHCP主机的iptables关闭

    [root@ZYB ~]# service iptables stop	
    [root@ZYB ~]# yum -y install dhcpd
    [root@ZYB ~]# vim /etc/dhcp/dhcpd.conf
    #option definitions common to all supported networks...
    #option domain-name "zyb-haha";
    #option domain-name-servers 192.168.1.10;
    
    default-lease-time 600;
    max-lease-time 7200;
    
    # Use this to send dhcp log messages to a different log file (you also
    # have to hack syslog.conf to complete the redirection).
    log-facility local7;
    
    # No service will be given on this subnet, but declaring it helps the 
    # DHCP server to understand the network topology.
    
    subnet 192.168.0.0 netmask 255.255.255.0 {
    	range 192.168.0.10 192.168.0.20;
    # tftp server adress
    	next-server 192.168.0.2;
    	filename="pxelinux.0";
    }
    [root@ZYB ~]# service dhcpd restart
    

    4、基于http提供安装树及ks文件
    注意:ks文件若从/root/anaconda-ks.cfg复制而来注意开启读权限,安装过程是以apache为进程的属主

    [root@ZYB ~]# yum -y install httpd
    [root@ZYB ~]# mkdir /var/www/html/centos6.9
    [root@ZYB ~]# mount --bind /mnt/ /var/www/html/centso6.9
    [root@ZYB ~]# vim /var/www/html/ks.cfg
    # Kickstart file automatically generated by anaconda.
    #version=DEVEL
    install
    # Use HTTP installation
    url --url="http://192.168.0.2/centos6.9"
    lang en_US.UTF-8
    keyboard us
    network --onboot yes --device eth0 --bootproto dhcp --noipv6
    # Root password:root
    rootpw --iscrypted $1$T2k3LyqB$fZ7SCHyusvoc6nu7xejHX0
    poweroff
    firewall --enabled --service=ssh
    #firewall --service=ssh
    authconfig --enableshadow --passalgo=sha512uselinux --disabled
    selinux --disabled
    timezone Asia/Shanghai
    bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb"
    # The following is the partition information you requested
    # Note that any partitions you deleted are not expressed
    # here so unless you clear all partitions first, this is
    # not guaranteed to work
    clearpart --all --drives=sda
    zerombr
    part /boot --fstype=ext4 --size=200
    part pv.008002 --size=60000
    volgroup vg_zyb --pesize=8192 pv.008002
    logvol /my_data --fstype=ext4 --name=my_data --vgname=vg_zyb --size=10240
    logvol / --fstype=ext4 --name=root --vgname=vg_zyb --size=15032
    logvol swap --name=swap --vgname=vg_zyb --size=4000
    logvol /usr --fstype=ext4 --name=usr --vgname=vg_zyb --size=20480
    logvol /var --fstype=ext4 --name=var --vgname=vg_zyb --size=10240
    #repo --name="CentOS" --baseurl=https://mirrors.aliyun.com/centos/6.9/os/x86_64/ --cost=100
    #repo --name="Fedora EPEL" --baseurl=https://mirrors.aliyun.com/epel/6/x86_64/ --cost=100
    repo --name="CentOS CDROM" --baseurl=http://192.168.0.2/centos6.9
    %packages
    @core
    @development
    @server-platform-devel
    @server-policy
    @workstation-policy
    jpackage-utils
    tree
    wget
    vim
    lftp
    %end
    %post
    sed -i '1,$s@id:[0-9]:initdefault:@id:3:initdefault:@g' /etc/inittab
    cat>/root/.vimrc<<EOF
    set number " 显示行号 
    set tabstop=4 " 设定 tab 长度为 4 
    EOF
    %end
    [root@ZYB ~]# service httpd start
    

    5、配置tftp-server

    [root@ZYB ~]# yum -y install tftp-server
    [root@ZYB ~]# yum -y install tftp
    [root@ZYB ~]# yum -y install xinetd
    [root@ZYB ~]# chkconfig tftp on
    [root@ZYB ~]# service xinetd start
    [root@ZYB ~]# ss -unlp | grep 69
    

    6、准备tftpboot内文件,并设置ks文件地址,通过http获得
    syslinux提供pxelinux.0

    [root@ZYB ~]# yum -y install syslinux
    [root@ZYB ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
    [root@ZYB ~]# cp /mnt/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/
    [root@ZYB ~]# cp /mnt/isolinux/{boot.msg,vesamenu.c32,splash.jpg} /var/lib/tftpboot/
    [root@ZYB ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
    [root@ZYB ~]# cp /mnt/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
    [root@ZYB ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
    

    7、dhcp主机监测,目标机通过网络引导
    注意:目标机和dhcp主机需使用同一网络适配器

    [root@ZYB ~]# tail /var/log/boot.log
    

  • 相关阅读:
    开启我的博客历程
    RTSP协议视频智能流媒体服务平台EasyNVR录像计划功能实现过程
    如何在RTSP协议视频智能平台EasyNVR未登录的情况下也可以调用通道直播链接的接口?
    环保设备“云上查” 排污监管“线上盯” EasyNVR视频边缘计算网关助力“智慧环保”实现“智慧”监管
    网络摄像头RTSP协议视频平台EasyNVR录像计划模块开发过程
    如何在SSH连接linux的情况下使用wireshark抓包TSINGSEE青犀视频云边端架构产品中的问题?
    RTSP协议TSINGSEE青犀视频平台EasyNVR如何通过GET传值的方式获取通过登录鉴权
    TSINGSEE青犀视频平台EasyNVR为何需要跨域?为什么不能单纯的从前端来解决跨域问题?
    【解决方案】TSINGSEE青犀视频云边端架构RTSP视频边缘计算平台EasyNVR搭建“云上透明厨房”远程监控平台方案
    【解决方案】“云-边-端”三级架构协同打造基于安防视频云服务EasyCVR的智慧城市解决方案
  • 原文地址:https://www.cnblogs.com/hesper/p/9041495.html
Copyright © 2011-2022 走看看