用pxe方式安装ubuntu系统

来源:互联网 发布:实况足球亨利巅峰数据 编辑:程序博客网 时间:2024/06/05 14:54

ubuntu发行版本默认支持网络安装,但其网络安装有些限制,基本上只支持http方式 的网络安装。

 

本文讲解通过pxe的方式安装ubuntu,pxe是网络启动的一种协议,能够让你的计算机在没有任何存储介质的情况下,通过网卡从远程的服务器上下载引导启动所需要的文件来启动系统。根据pxe的标准,想要从网络启动,首先需要你的网卡支持网络启动,此外还需要你在其他的服务器上配置dhcp、tftp服务器。

 

在centos上搭建dhcp服务器的步骤日下:

1.  安装dhcpd软件包:

#  yum install -y dhcp

2.  配置如下:

# cat /etc/dhcpd.conf

ddns-update-style none;
ignore client-updates;
allow booting;
allow bootp;

filename "/pxelinux.0";
subnet 192.168.5.0 netmask 255.255.255.0 {

        option routers                  192.168.5.1;
        option subnet-mask              255.255.255.0;

        option domain-name-servers      202.112.128.50;

        range dynamic-bootp 192.168.5.33 192.168.5.38;
        default-lease-time 21600;
        max-lease-time 43200;

    # PXE-specific configuration directives...
    next-server 192.168.5.247;
    filename "/pxelinux.0";
}
注意:将其中的next-server改为dhcp服务器所在的ip

 

在centos上搭建tftp服务器的步骤如下:

1. 安装软件

#  yum install -y tftp-server

2.  配置如下:

#  cat /etc/xinetd.d/tftp

service tftp
{
        disable = no
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /tftpboot -c
        per_source              = 11
        cps                         = 100 2
        flags                   = IPv4
}
3.  启动tftp

#  mkdir /tftpboot

#  chmod 777 /tftpboot

#  chkconfig tftp on

#  /etc/init.d/xinetd start

注意:由于tftp依赖于xinetd,所以,先要确保已经安装xinetd。

 

现在tftp服务器和dhcp服务器已经架设好了,接下来需要为客户端的引导启动和系统安装提供文件。这步在不同的系统上不太一样,redhat系列的发行版本支持多种网络安装(nfs,ftp,http等),而ubuntu发行版本则基本上支持http。下面介绍ubuntu系列的网络安装步骤:

1.  下载ubuntu镜像文件

2.  将ubuntu镜像文件挂载到某个目录,将install目录下的netboot中的所有内容拷贝到/tftpboot

#  mount  -o loop xxx.iso /mnt

#  cp -r /mnt/install/netboot /tftpboot

3.  安装apache,搭建http服务器,并启动相应的服务

4.  在apache的默认路径下创建ubuntu文件夹,并将ubuntu镜像文件挂载到该目录

 

在服务器端完成这些配置之后,其他机器就应该能够从网络启动了,在选择镜像网站时选择手动输入即可.