全部博文(89)
分类: LINUX
2009-05-18 17:02:49
#####################
#
# 环境介绍
#
#####################
# 所用软件: PXElinux DHCP TFTP APACHE Kickstart
# 实验环境操作系统: CentOS_5.2
# 目标操作系统: CentOS_5.2
# tftp目录: /tftpboot/
# 光盘镜像目录: /data/CentOS_CD
# apache页面目录 /var/www/html/
#####################
#
# yum
#
#####################
cp /etc/yum.repos.d/CentOS-Base.repo CentOS-Base.repo.bak
vi CentOS-Base.repo
--------------------------------------------------------------------------------
[base]
name=CentOS-$releasever - Base
baseurl=
gpgcheck=1
gpgkey=
[update]
name=CentOS-$releasever - Updates
baseurl=
gpgcheck=1
gpgkey=
[addons]
name=CentOS-$releasever - Addons
baseurl=
gpgcheck=1
gpgkey=
[extras]
name=CentOS-$releasever - Extras
baseurl=
gpgcheck=1
gpgkey=
--------------------------------------------------------------------------------
yum update
#####################
#
# apache
#
#####################
yum install httpd.i386
yum list httpd.i386
-----------------------------------------------------------------------
Loaded plugins: security
Installed Packages
httpd.i386 2.2.3-43.el5.centos installed
service httpd start
#####################
#
# TFTPd
#
#####################
yum install tftp-server.i386 # The server for the Trivial File Transfer Protocol (TFTP).
yum install tftp.i386 # The client for the Trivial File Transfer Protocol (TFTP).
vi /etc/xinetd.d/tftp
--------------------------------------------------------------------------------
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no # 原由yes,改为no 启动ing
per_source = 11
cps = 100 2
flags = IPv4
}
--------------------------------------------------------------------------------
service xinetd restart
# 验证是否开启tftpd
netstat -unl
udp 0 0 0.0.0.0:69 0.0.0.0:*
lsof -i:69
xinetd 26808 root 5u IPv4 77410 UDP *:tftp
vim /tftpboot/text
text........
cd /
tftp -v localhost
Connected to CentOS-5.2 (127.0.0.1), port 69
tftp> get text
getting from CentOS-5.2:text to text [netascii]
Received 302 bytes in 0.4 seconds [5389 bit/s]
tftp>
ls
text # 启动成功
#####################
#
# DHCPd
#
#####################
yun isntall dhcp.i386 # DHCP (Dynamic Host Configuration Protocol) server and relay agent.
cd /usr/share/doc/dhcp-3.0.5 /etc/dhcpd.conf
vi /etc/dhcpd.conf
----------------------------------------------------------------------------------------
ddns-update-style interim;
ignore client-updates;
filename "/pxelinux.0";
allow booting;
allow bootp;
subnet 192.168.13.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.13.1;
next-server 192.168.13.1;
option subnet-mask 255.255.255.0;
# option nis-domain "domain.org";
option domain-name "tom.com";
option domain-name-servers 192.168.13.1;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.13.200 192.168.13.205;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
# host ns {
# next-server marvin.redhat.com;
# hardware ethernet 12:34:56:78:AB:CD;
# fixed-address 207.175.42.254;
# }
}
----------------------------------------------------------------------------------------
service dhcpd stop
# 验证
netstat -unl
udp 0 0 0.0.0.0:67 0.0.0.0:*
lsof -i:67
dhcpd 31444 root 5u ipv4 86738 UDP *:bootps
#####################
#
# 添加DVD光盘内容
#
#####################
mkdir /mnt/cdrom
mkdir /data/CentOS_CD
mount /dev/cdrom /mnt/cdrom
cp -R /mnt/cdrom/* /data/CentOS_CD
ln -s /data/CentOS_CD /var/www/html/CentOS_CD
ll /data/CentOS_CD
--------------------------------------------------------------------------------
total 424
-rw-r--r-- 1 root root 34 May 13 20:28 1.txt
drwxr-xr-x 2 root root 155648 May 13 19:49 CentOS
-rw-r--r-- 1 root root 212 May 13 19:49 EULA
-rw-r--r-- 1 root root 18009 May 13 19:49 GPL
drwxr-xr-x 4 root root 4096 May 13 19:49 images
drwxr-xr-x 2 root root 4096 May 13 19:49 isolinux
-rw-r--r-- 1 root root 0 May 13 20:24 ks.cfg
drwxr-xr-x 2 root root 4096 May 13 19:49 NOTES
-rw-r--r-- 1 root root 655 May 13 19:49 RELEASE-NOTES-cs
-rw-r--r-- 1 root root 1401 May 13 19:49 RELEASE-NOTES-cs.html
-rw-r--r-- 1 root root 839 May 13 19:49 RELEASE-NOTES-de
-rw-r--r-- 1 root root 1571 May 13 19:49 RELEASE-NOTES-de.html
-rw-r--r-- 1 root root 694 May 13 19:49 RELEASE-NOTES-en
-rw-r--r-- 1 root root 1367 May 13 19:49 RELEASE-NOTES-en.html
-rw-r--r-- 1 root root 694 May 13 19:49 RELEASE-NOTES-en_US
-rw-r--r-- 1 root root 1367 May 13 19:49 RELEASE-NOTES-en_US.html
-rw-r--r-- 1 root root 788 May 13 19:49 RELEASE-NOTES-es
-rw-r--r-- 1 root root 1619 May 13 19:49 RELEASE-NOTES-es.html
-rw-r--r-- 1 root root 852 May 13 19:49 RELEASE-NOTES-fr
-rw-r--r-- 1 root root 1641 May 13 19:49 RELEASE-NOTES-fr.html
-rw-r--r-- 1 root root 766 May 13 19:49 RELEASE-NOTES-ja
-rw-r--r-- 1 root root 1565 May 13 19:49 RELEASE-NOTES-ja.html
-rw-r--r-- 1 root root 706 May 13 19:49 RELEASE-NOTES-nl
-rw-r--r-- 1 root root 1433 May 13 19:49 RELEASE-NOTES-nl.html
-rw-r--r-- 1 root root 752 May 13 19:49 RELEASE-NOTES-pt_BR
-rw-r--r-- 1 root root 1480 May 13 19:49 RELEASE-NOTES-pt_BR.html
-rw-r--r-- 1 root root 801 May 13 19:49 RELEASE-NOTES-ro
-rw-r--r-- 1 root root 1473 May 13 19:49 RELEASE-NOTES-ro.html
drwxr-xr-x 2 root root 4096 May 13 19:49 repodata
-rw-r--r-- 1 root root 1512 May 13 19:49 RPM-GPG-KEY-beta
-rw-r--r-- 1 root root 1504 May 13 19:49 RPM-GPG-KEY-CentOS-5
-r--r--r-- 1 root root 7048 May 13 19:49 TRANS.TBL
--------------------------------------------------------------------------------
#####################
#
# /tftpboot/*
#
#####################
# 1. pxelinux.0
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
# 2. 拷贝安装盘中的/image/pxeboot/initrd.img,vmlinuz 这两个文件
cp /data/CentOS_CD/images/pxeboot/initrd.img /tftpboot
cp /data/CentOS_CD/images/pxeboot/vmlinuz /tftpboot
# 3. 拷贝安装盘中的/isolinux/*.msg
cp /data/CentOS_CD/isolinux/*.msg /tftpboot
# 4. 创建/tftpboot/pxelinux.cfg/default, 拷贝现成文件/isolinux/isolinux.cfg
cp /data/CentOS_CD/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
vi /tftpboot/pxelinux.cfg/default
--------------------------------------------------------------
default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label local
localboot 1
label linux
kernel vmlinuz
append initrd=initrd.img
label text
kernel vmlinuz
append initrd=initrd.img text
label autoinstall
kernel vmlinuz
append ks= initrd=initrd.img
--------------------------------------------------------------
#####################
#
# kickstart
#
#####################
# 进入到 X ,在超级终端输入 system-config-kickstart,程序运行。 生成ks.cfg
yum install system-config-kickstart
cp ks.cfg /var/www/html/