zoukankan      html  css  js  c++  java
  • 分布式平台下的OSCentOs 无人值守

    环境:虚拟机VM,Centos5.0

    说明:我的ip地址为192.168.141.3,为客户机分配的ip地址范围为

    192.168.141.180-192.168.141.182

    一:安装DHCP服务器,配置后并设置开机启动(用来分配IP地址)
     
    A;安装dhcp
     
     
     

     
     
     
    B;修改配置文件
     
    修改/etc/dhcpd.conf如下:

    ddns-update-style interim;
    ignore client-updates;
    allow booting;   #定义可以PXE方式启动
    allow bootp;     #定义支持boottp
    class "pxeclients" {                                                                
    match if substring(option vendor-class-identifier,0,9) = "PXEClient";
    filename "/pxelinux.0";     #pxelinux.0启动引导文件存放路径
    next-server 192.168.141.3;   #TFTP服务器ip地址,所以dhcpd与TFTP服务器不一定在一个机器

    }

    subnet 192.168.141.0 netmask 255.255.255.0 {       #DHCP服务器自身网段及子网掩码

    # --- default gateway
            option routers 192.168.141.2;      
            option subnet-mask 255.255.255.0;
            option nis-domain "domain.org";
            option domain-name "domain.org";
            option domain-name-servers 192.168.141.2;    #域名服务器ip,可以不使,但最好
    设置一个免得安装中提示

            option time-offset -18000;
    # Eastern Standard Time
    # option ntp-servers 192.168.1.1;
    # option netbios-name-servers 192.168.1.1;
    # --- Selects point-to-point node (default is hybrid). Don't change this unless
    # -- you understand Netbios very well
    # option netbios-node-type 2;

            range dynamic-bootp 192.168.141.180 192.168.141.182; #DHCP地址池
            default-lease-time 21600;
            max-lease-time 43200;

            # we want the nameserver to appear at a fixed address
    # host ns {
    #这个字段可以为指定MAC地址的机器指定固定的ip,也可不
    使
    # next-server marvin.redhat.com;
    # hardware ethernet 12:34:56:78:AB:CD;
    # fixed-address 207.175.42.254;
    # }
       }  
     
     
    C;设置开机启动
     
     
     
     

     
     
     
     
    D;重启服务 /etc/init.d/dhcpd restart
     
     
    二:安装FTP服务器,并设置开机启动(用来放置光盘的内容和ks问件)
     
     
    A;安装vsftpd
     
     
     

     
     
     
     
    B; 重启服务 /etc/init.d/vsftpd restart
     
     
    三:安装TFTP服务器,一个是服务器端,一个是客户端,客户端主要用来做本机测试的(用来放置PXE启动时所需的文件)
     
     
    A;安装tftp
     
     

      

     
     
    B;修改/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
    {
            disable = no
            socket_type = dgram
            protocol = udp
            wait = yes
            user = root
            server = /usr/sbin/in.tftpd
            server_args = -s /tftpboot
            per_source = 11
            cps = 100 2
            flags = IPv4
    }
     
     
    C;重启服务 /etc/init.d/xinetd restart
     
     
     
    四:挂载光盘到/var/ftp/pub
     
     
     
     

     
     
     
     
    五:配置支持PXE的启动程序
     
    A;拷贝启动引导文件:
     
     
     
     

        
     
     
    B;拷贝内核文件,菜单选项文件,以及菜单配置文件:
     
     
     
     

     
     
     
    C;我的/tftpboot目录结构:
     
     
     
     
     
     
     

     
     
     
     
     
     
     
     
    D;拷贝/root/anaconda-ks.cfg 到/var/pub,并修改其权限
     
     
     
     
     
     
     
     
     

     
     
     
     
     
     
    E;修改/tftpboot/pxelinux.cfg/default如下:
     
     
    default ks
    prompt 1
    timeout 60
    display boot.msg
    F1 boot.msg
    F2 options.msg
    F3 general.msg
    F4 param.msg
    F5 rescue.msg
    label linux
      kernel vmlinuz
      append initrd=initrd.img
    label text
      kernel vmlinuz
      append initrd=initrd.img text
    label ks
      kernel vmlinuz
      append ks=ftp://192.168.141.3/anaconda-ks.cfg initrd=initrd.img
    label local
      localboot 1
    label memtest86
      kernel memtest
      append -


    F;修改/var/ftp/anaconda-ks.cfg如下:
     
    # Kickstart file automatically generated by anaconda.

    install
    url  --url=ftp://192.168.141.3/pub
    lang en_US.UTF-8
    keyboard us
    network --device eth0 --bootproto dhcp
    rootpw --iscrypted $1$oK96NKbn$9vjtYYXYpWTjuicKjciMH0
    firewall --enabled --port=22:tcp
    authconfig --enableshadow --enablemd5
    selinux --enforcing
    timezone --utc Asia/Shanghai
    bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
    # 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 --initlable
    part /boot --fstype ext3 --size=100 --asprimary
    part swap --size=256
    part / --fstype ext3 --size=1 --grow --asprimary

    %packages
    @admin-tools
    @base
    @base-x
    @core
    @development-libs
    @development-tools
    @dialup
    @editors
    @games
    @gnome-desktop
    @graphical-internet
    @graphics
    @network-server
    @office
    @printing
    @sound-and-video
    @system-tools
    @text-internet
    kernel-devel
     
     
     
     
    六:测试,成功了:
     
     
     
     
     
     

     
     
     
     
     
     
     

     
     
     
     
     
     
     
     
     
     
    总结:
    另外几种路径的写法为:
     
    HTTP:
    default 文件 append ks=http://192.168.141.3/pub/ks.cfg   initrd=initrd.img
    anaconda-ks文件  url --url http://192.168.141.3/pub
     
     NIS:
    default文件  append ks=nfs:192.168.141.3:/pub/ks.cfg   initrd=initrd.img
    anaconda-ks nfs --server=192.168.141.3   --dir=/var/ftp/pub
     

    另外:

    clearpart   --all  --initlabel

     --all      擦除系统上原有所有分区;

    --initlabel    初始化磁盘卷标为系统架构的默认卷标

    加了--initlabel可防止如下情况的出现:

  • 相关阅读:
    Python中*和**的区别
    Python中str、list、numpy分片操作
    Python中bisect的使用方法
    Python中__str__和__repr__的区别
    Python中函数参数类型和参数绑定
    C++中explicit
    C++中const
    自动识别 URL
    .net中activex的替代技术:winform control(一)
    vs2005包加载有误的解决方法
  • 原文地址:https://www.cnblogs.com/jerryxing/p/2546956.html
Copyright © 2011-2022 走看看