Centos6/7来网络引导(pxe)安装centos

本文提供了一种使用PXE网络引导安装CentOS的方法。详细步骤包括安装和配置tftp-server、dhcp服务,调整配置文件,将ISO内容复制到tftp目录,并启动相关服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在网上也找了很多教程然后综合一下


1、需要安装的程序

tftp-server、dhcp、syslinux

2、安装和配置程序

yum install dhcp tftp-server syslinux

简单配置一下dhcp,vim /etc/dhcp/dhcp.c

option domain-name "example.org";

option domain-name-servers 61.139.2.69;
default-lease-time 600;
max-lease-time 7200;

# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;

# 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 172.20.128.0 netmask 255.255.255.0{
#    range 172.20.128.200 172.20.128.220;
#    option routers 172.20.128.1;
#    netxt-server 172.20.28.1;
#    filename "pxelinux.0";
#}
subnet 192.168.139.0 netmask 255.255.255.0{
    range 192.168.139.200 192.168.139.220;
    option routers 192.168.139.208;
    #next-server 192.168.139.208;
    filename "centos/6/isolinux/pxelinux.0";
}

注意:1、因为我的tftp也在本机所以next-server可以注释,filename是tftp的根目录到pxelinux.0。

           2、注意网段,如果你的局域网有dhcp我建议以就设置在同一个网段


配置tftp,vim /etc/xinetd.d/tftp 

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
}

注意:1、disable =no



拷贝文件到tftp中去

挂载光盘:mount /dev/cdrom /mnt

拷贝文件:cp /mnt/isolinux/* /var/lib/tftpboot/centos/6/isolinux/

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/centos/6/isolinux/

创建一个目录mkdir /var/lib/tftpboot/centos/6/isolinux/pxelinux.cfg

拷贝配置:cp /var/lib/tftpboot/centos/6/isolinux/isolinux.cfg /var/lib/tftpboot/centos/6/isolinux/pxelinux.cfg/default


注意:1、centos/6/isolinux是我自己创建的目录


启动服务

1、centos6

service dhcpd restart

service tftp restart

2、centos7

systemctl restart dhcpd

systemctl restart tftp

注意:1、手动打的字如果有错,请提一下,我可以修改。谢谢



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值