RHEL7.0 DHCP+TFTP+SYSLINUX+FTP+KICKSTART自动安装

来源:互联网 发布:picasa软件官方下载 编辑:程序博客网 时间:2024/05/18 15:25

使用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

     

    安装过程有点慢,配置完

0 0
原创粉丝点击