PXE网络安装

PXE网络安装
===================================
安装环境:
[root@localhost ~]# lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release: 5.5
Codename: Tikanga
===========================
[root@localhost ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:18:AA:A3  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe18:aaa3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3298 errors:0 dropped:0 overruns:0 frame:0
          TX packets:229 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3202491 (3.0 MiB)  TX bytes:33898 (33.1 KiB)
          Interrupt:59 Base address:0x2024 
-------------------------------
步骤一:安装DHCP服务器(前提:已经安装好网络YUM源)
[root@localhost ~]# yum -y install dhcp*
[root@localhost ~]# cat /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample > /etc/dhcpd.conf 
[root@localhost ~]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;
        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;
        filename        "pxelinux.0";
        next-server     192.168.1.1;
}
注意:
DHCP服务的PXE设置
next-server:指定TFTP服务器地址
filename:指定要下载的引导程序文件
[root@localhost ~]# service dhcpd start
启动 dhcpd:                                               [确定]
[root@localhost ~]# chkconfig dhcpd on
==================================================================================
步骤二:安装tftp-server并配置
[root@localhost ~]# yum -y install tftp-server //安装tftp-server,一般都已经安装好了
[root@localhost ~]# rpm -ql syslinux |grep pxelinux.0
/usr/lib/syslinux/pxelinux.0
[root@localhost ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
[root@localhost ~]# mkdir /tftpboot/pxelinux.cfg
[root@localhost ~]# cp -rpf /media/isolinux/* /tftpboot/
[root@localhost ~]# cp /tftpboot/isolinux.cfg /tftpboot/pxelinux.cfg/default
[root@localhost ~]# chmod u+w /tftpboot/pxelinux.cfg/default
[root@localhost ~]# vi /tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 60
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 linux ks=ftp://192.168.1.1/ks.cfg
---------------------------------------------------------------
[root@localhost ~]# chkconfig tftp on
[root@localhost ~]# service xinetd restart
停止 xinetd:                                              [确定]
启动 xinetd:                                              [确定]
===================================================
步骤三(安装vsftpd 并配置ks.cfg文件):
[root@localhost ~]# rpm -q vsftpd
vsftpd-2.0.5-16.el5_4.1
[root@localhost ~]# cp anaconda-ks.cfg /var/ftp/ks.cfg
[root@localhost ~]# chmod 755 /var/ftp/ks.cfg 
[root@localhost ~]# vi /var/ftp/ks.cfg
# Kickstart file automatically generated by anaconda.
install
url --url=ftp://192.168.1.1/rhel5
clearpart --all --initlabel
key --skip
part /boot --fstype ext3 --size=100 --ondisk=sda
part pv.2 --size=0 --grow --ondisk=sda
volgroup VolGroup00 --pesize=32768 pv.2
logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=512 --grow --maxsize=1024
lang zh_CN.UTF-8
keyboard us
xconfig --startxonboot
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$fIt8cHuF$141FVcKKdyAagktIXCvGD.
firewall --enabled --port=22:tcp
authconfig --enableshadow --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 --linux --drives=sda
#part /boot --fstype ext3 --size=100 --ondisk=sda
#part pv.2 --size=0 --grow --ondisk=sda
#volgroup VolGroup00 --pesize=32768 pv.2
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=512 --grow --maxsize=1024
reboot
%packages
@admin-tools
@base
@chinese-support
@core
@development-libs
@development-tools
@dialup
@editors
@gnome-desktop
@gnome-software-development
@graphical-internet
@graphics
@java
@java-development
@kde-software-development
@legacy-software-development
@legacy-software-support
@office
@printing
@ruby
@sound-and-video
@text-internet
@x-software-development
@base-x
libhbaapi
kexec-tools
fipscheck
device-mapper-multipath
fuse-libs
sgpio
systemtap-sdt-devel
perl-XML-SAX
pth
perl-XML-Twig
perl-XML-Dumper
perl-TimeDate
perl-libxml-perl
tog-pegasus-devel
perl-Convert-ASN1
libstdc++44-devel
libassuan-devel
perl-XML-NamespaceSupport
perl-DateManip
libksba-devel
fipscheck-devel
sblim-cmpi-dhcp-devel
perl-Crypt-SSLeay
perl-Mozilla-LDAP
pth-devel
log4cpp-devel
perl-LDAP
perl-XML-Grove
libpciaccess-devel
python-imaging
libhbaapi-devel
python-dmidecode
fuse-devel
libksba
perl-Archive-Zip
gsl
gcc44-c++
gcc44-gfortran
pexpect
dejagnu
imake
java-1.6.0-openjdk-devel
gcc-objc
ElectricFence
memtest86+
gcc-gnat
libgfortran44
gcc44
expect
java-1.6.0-openjdk
unifdef
python-docs
nasm
emacs
libgnome-java
gob2
libgtk-java
libglade-java
libgconf-java
libsane-hpaio
bsh-demo
kdesdk-devel
gtk+
eruby
ruby-ri
xorg-x11-xbitmaps
mesa-libGLw-devel
openmotif-devel
icon-naming-utils
mesa-libGLU-devel
icon-slicer
xorg-x11-server-sdk
libXp-devel
xorg-x11-utils
libpciaccess
xorg-x11-server-Xnest
xorg-x11-server-Xvfb
%post
#!/bin/bash
#
cd /etc/yum.r*/
wget ftp://192.168.1.1/benet.repo
cd
yum -y clean all
yum makecache
yum -y install php* mysql* http*
service httpd start
chkconfig httpd on
service mysqld start
chkconfig mysqld on
-----------------------------
[root@localhost ~]# service vsftpd restart
关闭 vsftpd:                                              [确定]
为 vsftpd 启动 vsftpd:                                    [确定]
[root@localhost ~]# chkconfig vsftpd on
##############################################
步骤四: 测试
此处省略
 

你可能感兴趣的:(linux,网络,release)