RHEL7.0 DHCP+TFTP+SYSLINUX+FTP+KICKSTART自動安裝

dbhelper發表於2014-11-27

 

           使用vmware workstation  9

     OS版本:RHEL7.0

    RHEL7.0  DHCP+TFTP+SYSLINUX+FTP+KICKSTART 無人值守安裝

    一、配置DHCP伺服器

    安裝軟體包

    [root@LiuZhen ~]# rpm -qa dhcp

    [root@LiuZhen ~]# yum install dhcp

    yum源配置參考我的部落格 http://blog.itpub.net/27771627/viewspace-1223153/

     

    [root@LiuZhen ~]# cat /etc/dhcp/dhcpd.conf

    #

    # DHCP Server Configuration file.

    # see /usr/share/doc/dhcp*/dhcpd.conf.example

    # see dhcpd.conf(5) man page

    #

    option domain-name "LiuZhen.com"; //hostname

    option domain-name-servers 192.168.220.222; //server IP

    default-lease-time 600;                                                        //租用時間

    max-lease-time 7200;

    log-facility local7;

    allow booting;                                                                       //pexlinux 使用

    allow bootp;                                                                         //pexlinux 使用

    subnet 192.168.220.0 netmask 255.255.255.0 {

    range 192.168.220.100 192.168.220.200;                                  //動態獲得IP範圍

    option routers 192.168.221.1;                                                     //閘道器

    next-server 192.168.220.222;                                                   //pexlinux 使用

    filename "pxelinux.0";                                                                 //pexlinux 使用

    }

    重啟DHCP服務

    [root@LiuZhen ~]# service dhcpd restart

    Redirecting to /bin/systemctl restart dhcpd.service

     

     

    設定開機自動啟動DHCP服務

    [root@LiuZhen ~]# chkconfig dhcpd on

    Note: Forwarding request to 'systemctl enable dhcpd.service'.

    ln -s '/usr/lib/systemd/system/dhcpd.service' '/etc/systemd/system/multi-user.target.wants/dhcpd.service'

     

     

    設定防火牆停止限制DHCP服務

    [root@LiuZhen ~]# firewall-cmd --permanent --add-service=dhcp

    success

    重新啟動防火牆

    [root@LiuZhen ~]# service firewalld restart

    Redirecting to /bin/systemctl restart firewalld.service

    這裡先不寫測試過程,詳見我的部落格http://blog.itpub.net/27771627/viewspace-1245570/

     

     

    二、配置TFTP服務

    檢查tftp包是否存在

    [root@LiuZhen ~]# rpm -qa tftp

    yum安裝tftp

    [root@LiuZhen ~]# yum install tftp

    安裝超級守護程式

    [root@LiuZhen xinetd.d]# rpm -qa xinetd

    [root@LiuZhen xinetd.d]#

    [root@LiuZhen xinetd.d]# yum install xinetd

    [root@LiuZhen xinetd.d]# rpm -qa tftp-server

    [root@LiuZhen xinetd.d]# yum install tftp-server

    [root@LiuZhen xinetd.d]#

     

    檢視配置檔案

    [root@LiuZhen xinetd.d]# 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                        = yes

    per_source                = 11

    cps                        = 100 2

    flags                        = IPv4

    }

    修改yes 為no

    clip_image001

     

     

    [root@LiuZhen xinetd.d]# service xinetd restart

    Redirecting to /bin/systemctl restart xinetd.service

    設定防火牆

    clip_image002

    配置完成,測試方法見我的部落格http://blog.itpub.net/27771627/viewspace-1245670/

     

     

     

    三、配置syslinux

    檢查包是否安裝

    clip_image003

    安裝包

    clip_image004

     

     

    拷貝以下檔案到目錄下

    clip_image005

    clip_image006

    clip_image007

    clip_image008

    修改配置檔案

    /var/lib/tftpboot/pxelinux.cfg/default

    將所有 =hd:LABEL=RHEL-7.0 都改成=ftp://192.168.220.222

    可使用命令替換

    sed -i "/inst.stage2/s/=hd:LABEL=RHEL-7.0\\\x20Server.x86_64/=ftp:\/\/192.168.220.222/" /var/lib/tftpboot/pxelinux.cfg/default

     

     

    四、配置VSFTP服務

    安裝軟體包

    clip_image009

    配置服務和防火牆

    clip_image010

     

    將作業系統介質拷貝到FTP目錄下

    [root@LiuZhen tftpboot]# cp -r /mnt/* /var/ftp

    配置完成,可以測試是否可以進入安裝

    新建空虛擬機器,使用hostonly網段,啟動測試

    測試可以出現引導安裝介面,繼續配置kickstart,實現無人值守安裝

    clip_image011

     

     

    五、配置KICKSTART

    拷貝系統預設配置檔案,並給與許可權

    clip_image012

    安裝軟體包

    [root@LiuZhen vsftpd]# rpm -q system-config-kickstart

    package system-config-kickstart is not installed

    [root@LiuZhen vsftpd]#

    [root@LiuZhen vsftpd]# yum -y install system-config-kickstart

    修改配置檔案/var/ftp/pub/ks.cfg

    將cdrom 改為 url --url=ftp://192.168.220.222

    none改成all

    clip_image013

    修改配置檔案/var/lib/tftpboot/pxelinux.cfg/default

    將quiet改為

    clip_image014

     

    clip_image015

     

    配置完成,測試效果,啟動兩個虛擬機器一起自動安裝測試

    clip_image016

     

    安裝過程有點慢,配置完成

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27771627/viewspace-1245967/,如需轉載,請註明出處,否則將追究法律責任。

相關文章