一、配置IP

vi /etc/sysconfig/network-scripts/ifcfg-eth0

CNETOS6.4无人值守安装_第1张图片

Service network restart

二、CentOS 5/RHEL 5下搭建本地YUM源

1.挂载光盘

Mkdir /mnt/cdrom

Mount /dev/cdrom /mnt/cdrom

2.将安装盘里面的文件全部COPY

Mkdir /var/www/html/cdrom

\cp r /mnt/cdrom/* /var/www/html/cdrom

3.进入YUM的配置文件目录

Cd /etc/yum.repos.d

mv CentOS-Base.repoCentOS-Base.repo.bak

viCentOS-Media.repo

 

 

# CentOS-Media.repo

#

#  This repo can beused with mounted DVD media, verify the mount poi

nt for

#  CentOS-6.  You can use this repo and yum to installitems directly

 off the

#  DVD ISO that werelease.

#

# To use this repo, put in your DVD and use it with theother repos t

oo:

#  yum--enablerepo=c6-media [command]

#

# or for ONLY the media repo, do this:

#

#  yum--disablerepo=\* --enablerepo=c6-media [command]

 

[c6-media]

name=CentOS-$releasever - Media

baseurl=file:///var/www/html/cdrom

       file:///media/CentOS/

       file:///media/cdrom/

       file:///media/cdrecorder/

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

 

测试yum是否配置成功

yum list

 

清除yum缓存

Yum clean all

 

重新建立缓存

yum makecache

 

 

大概在配置文件的第15行,会看到如下内容:

[c5-media]

name=CentOS-$releasever- Media 下载源名

baseurl=file:///media/CentOS/下载源路径

file:///media/cdrom/

file:///media/cdrecorder/

gpgcheck=1 安装此下载源中的软件包时是否检查RPM软件包的数字签名

enabled=0 是否启用此下载源,0为禁止、1为启用。

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

~

~

把上面的内容修改成如下:

[c5-media]

name=localyum

baseurl=file:///var/www/html/cdrom 2步中用以存放光盘内容的本地源目录

#gpgcheck=0

#enabled=1

#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

 

最后保存退出!!!!!

 

yum clean all (清除缓存)

yum make cache (建立新缓存)

 

Yum y install httpd

Yum y install dhcp

Yum y install tftp-server

yum –y groupinstall "X Window System"

yum –y groupinstallDesktop

yum –y install system-config-kickstart

 

 

所有包都安装完毕

现在配置服务

 

三、配置TFTP服务器

vi/etc/xinetd.d/tftp

 

# default: off

# description: The tftp server serves files usingthe trivial file tr

ansfer \

#      protocol.  The tftp protocol isoften used to boot diskless \

#      workstations, download configuration files to network-aware p

rinters, \

#       andto start the installation process for some operating syst

ems.

service tftp

{

       socket_type             = dgram

       protocol                = udp

        wait                    = no

       user                    = root

       server                  =/usr/sbin/in.tftpd

       server_args             = -s/var/lib/tftpboot

        disable                 = no

       per_source              = 11

       cps                     = 100 2

       flags                   = IPv4

}

disable 设置为no

 

重启服务

service xinetd restart /etc/init.d/xinetd restart

 

四、配置支持PXE的启动程序

 

1 复制pxelinux.0 文件至/var/lib/tftpboot/文件夹中

# cp /usr/share/syslinux/pxelinux.0/var/lib/tftpboot/

说明:syslinux是一个功能强大的引导加载程序,而且兼容各种介质。更加确切地说:SYSLINUX是一个小型的Linux操作系统,

它的目的是简化首次安装Linux的时间,并建立修护或其它特殊用途的启动盘。

2 复制iso 镜像中的/p_w_picpath/pxeboot/initrd.imgvmlinux /var/lib/tftpboot/文件夹中

# cp /var/www/html/cdrom/p_w_picpaths/pxeboot/{initrd.img,vmlinuz}/var/lib/tftpboot/

3 复制iso 镜像中的/isolinux/*.msg/var/lib/tftpboot/文件夹中

# cp /var/www/html/cdrom/isolinux/*.msg/var/lib/tftpboot/

4 /var/lib/tftpboot/中新建一个pxelinux.cfg目录

# mkdir /var/lib/tftpboot/pxelinux.cfg

5 iso 镜像中的/isolinux 目录中的isolinux.cfg复制到pxelinux.cfg目录中,同时更改文件名称为default

# cp/var/www/html/cdrom/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default

6 修改default文件

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

 

default ks

prompt 1

timeout 6

display boot.msg

F1 boot.msg

F2 options.msg

F3 general.msg

F4 param.msg

F5 rescue.msg

label linux

  kernel vmlinuz

  append initrd=initrd.img

label text

  kernel vmlinuz

  append initrd=initrd.img text

label ks

  kernel vmlinuz

  appendks=http://192.168.1.254/ks.cfg initrd=initrd.img

label local

  localboot 1

label memtest86

  kernel memtest

  append -

 

五、配置DHCP

1复制配置模板文件到DHCP的配置目录中

# cp -f/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

2修改/etc/dhcp/dhcpd.conf 配置文件,内容如下:

ddns-update-styleinterim;

ignoreclient-updates;

filename"pxelinux.0";

next-server192.168.1.254;

subnet 192.168.1.0netmask 255.255.255.0 {

        option routers                  192.168.1.254;

        option subnet-mask              255.255.255.0;

        range dynamic-bootp 192.168.1.100192.168.1.200;

        default-lease-time 21600;

        max-lease-time 43200;

}

3启动DHCP服务

# /etc/init.d/dhcpd start

 

六、生成ks.cfg

进入xwindows

system-config-kickstart

 

CNETOS6.4无人值守安装_第2张图片

CNETOS6.4无人值守安装_第3张图片

CNETOS6.4无人值守安装_第4张图片

CNETOS6.4无人值守安装_第5张图片

CNETOS6.4无人值守安装_第6张图片

CNETOS6.4无人值守安装_第7张图片


将ks.cfg保存到/var/www/html/目录下

 

 

 

测试

CNETOS6.4无人值守安装_第8张图片

关闭iptablesF

 

Vi /etc/syslinux/config

# This filecontrols the state of SELinux on the system.

# SELINUX= cantake one of these three values:

#     enforcing - SELinux security policy isenforced.

#     permissive - SELinux prints warningsinstead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= cantake one of these two values:

#     targeted - Targeted processes areprotected,

#     mls - Multi Level Security protection.

SELINUXTYPE=disabled

 

重启REBOOT