当前位置:  首页  >  服务器技术  >  Linux/unix  >  Linux教程

VM下使用PXE+DHCP+TFTP+APACHE自动安装LINUX实例

实验准备:一台安装服务器(vm下的CentOS5.5)在安装服务器上所要使用到的套件为:dhcp、tftp、httpd第一:是在安装服务器上的设置[root@localhost~]#yum-yinstalltftp-serverdhcphttpd检查安装相关的套件[root@localhost~]#vie

实验准备:一台安装服务器(vm下的CentOS5.5

 

在安装服务器上所要使用到的套件为:dhcptftphttpd

第一:是在安装服务器上的设置

[root@localhost ~]# yum -y install tftp-server dhcp httpd   //检查安装相关的套件

[root@localhost ~]# vi /etc/dhcpd.conf   //dhcpd的设置

ddns-update-style interim;

ignore client-updates;

 

subnet 192.168.1.0 netmask 255.255.255.0 {

 

# --- default gateway

        option routers                  192.168.1.1;    //GATEWAY

        option subnet-mask              255.255.255.0;   //NETMASK

 

        option nis-domain               "domain.org";

        option domain-name              "domain.org";

        option domain-name-servers      202.102.240.65;    //DNS-server-IP

 

        option time-offset              -18000; # Eastern Standard Time

 

        range dynamic-bootp 192.168.1.128 192.168.1.254;

        default-lease-time 21600;

        max-lease-time 43200;

 

        next-server 192.168.1.193;       //这个就是安装服务器的IP地址

        filename "/pxelinux.0";

}

接着是对自动安装选项的配置,如果你喜欢手动配置系统选项(就是正常的安装步骤)的话,次步骤可以不使用。

[root@localhost ~]# vi /var/www/html/ethnicity.cfg   

# Kickstart file automatically generated by anaconda.

install

nfs --server=192.168.1.193 --dir=/mnt/iso

key --skip

lang en_US.UTF-8

keyboard us

xconfig --startxonboot --resolution 1024x768 --depth 16

network --device eth0 --bootproto dhcp

rootpw --iscrypted $1$rjNWMWwe$y84mj/AbysRJu3ZNt07JH/

firewall --disabled

authconfig --useshadow --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

part /boot --fstype ext3 --size=100

part pv.100000 --size=18000

part swap --size=512

volgroup vol0 --pesize=32768 pv.100000

logvol /home --fstype ext3 --name=home --vgname=vol0 --size=480

logvol / --fstype ext3 --name=root --vgname=vol0 --size=8192

%packages

@GNOME Desktop Environment

@X Window System

@Printing Support

@Development Tools

elinks

openssh

openssh-server

openssh-clients

vim-enhanced

samba-common

samba-client

gimp

gimp-data-extras

enscript

libcap

ntp

coreutils

elfutils

elfutils-libelf

gimp-print-plugin

gnome-icon-theme

gstreamer

gstreamer-tools

libgnomeprint22

libgnomeprintui22

libgsf

libIDL

libraw1394

nautilus-cd-burner

openmotif

pyorbit

startup-notification

ttmkfdir

firefox

mutt

然后是NFS的设置(也就是安装树的设置)

[root@localhost ~]# mount -o loop /dev/hdc /mnt/iso/    

[root@localhost ~]# vi /etc/exports

/mnt/iso *(ro)

[root@localhost ~]# /etc/init.d/portmap restart

[root@localhost ~]# /etc/init.d/nfs restart

[root@localhost ~]# exportfs -arv

exporting *:/mnt/iso

TFTP的设置(其实就是打开就可以了)

[root@localhost ~]# vi /etc/xinetd.d/tftp

service tftp

{

        socket_type             = dgram

        protocol                = udp

        wait                    = yes

        user                    = root

        server                  = /usr/sbin/in.tftpd

        server_args             = -s /tftpboot

        disable                 = no

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}

 

然后是对PXE的设置

[root@localhost /]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/

[root@localhost /]# mount -o loop /dev/hdc /mnt/iso

[root@localhost /]# cp /mnt/iso/images/pxeboot/{initrd.img,vmlinuz} /tftpboot/

[root@localhost /]# cp /mnt/iso/isolinux/*.msg /tftpboot/

[root@localhost /]# mkdir /tftpboot/pxelinux.cfg

[root@localhost /]# cp /mnt/iso/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

[root@localhost ~]# cd /tftpboot/pxelinux.cfg/

[root@localhost pxelinux.cfg]# chmod a+w default

[root@localhost pxelinux.cfg]# vi default  //这么设置是安装启动时有个菜单

default linux

prompt 1

吐了个 "CAO" !
扫码关注 PHP1 官方微信号
PHP1.CN | 中国最专业的PHP中文社区 | PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | PHP问答
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved PHP1.CN 第一PHP社区 版权所有