pxe (网络引导 dhcp ftp )
准备工作
服务器 :ftp (放置安装文件) yum (system-config-kickstart) dhcp (客户动态得到地址) tftp (pxe 所需文件)
机器名称:stationx.abc.com
服务器 dhcp ftp tftp yum
tftp
cd /tftpboot
拷贝 /mnt/cdrom/images/pxeboot/vmlinuz ./
.............../images/pxeboot/initrd.d ./
cp /usr/lib/syslinux/pxelinux.0 ./
mkdir pxelinux.cfg
cp /mnt/cdrom/isolinux/isolinux.cfg pxelinux.cfg/default
编辑default
12行 append之后 ks= ksdevice=eth0
安装dhcp服务器
next-server 服务器地址
filename “prelinux.0"
1:安装ftp服务器,并设置
[root@zzu ~]# cd /var/ftp/pub/
[root@zzu pub]#cp -a -r /mnt/cdrom/.* ./
[root@zzu pub]# ll
?昏. 5752
dr-xr-xr-x 3 root root 4096 2009-08-19 Cluster
dr-xr-xr-x 3 root root 4096 2009-08-19 ClusterStorage
-r--r--r-- 1 root root 8445 2008-09-03 EULA
-r--r--r-- 1 root root 8445 2009-08-04 eula.en_US
-r--r--r-- 1 root root 18416 2006-12-01 GPL
dr-xr-xr-x 4 root root 4096 2009-08-19 images
dr-xr-xr-x 2 root root 4096 2009-08-19 isolinux
[root@zzu ~]# service vsftpd start
涓?vsftpd ?.. vsftpd锛 [纭..]
[root@zzu ~]# chkconfig vsftpd on
root@zzu ~]# chkconfig --list|grep vsftpd
vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
2:配置yum
[root@zzu ~]# vim /etc/yum.repos.d/server.repo
1 [rhel-server]
2 name=Red Hat Enterprise Linux server
3 baseurl=file:///mnt/cdrom/Server
4 enabled=1
5 gpgcheck=1
6 gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
7 [rhel-vt]
8 name=Red Hat Enterprise Linux vt
9 baseurl=file:///mnt/cdrom/VT
10 enabled=1
11 gpgcheck=1
12 gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
13
14 [rhel-cluster]
15 name=Red Hat Enterprise Linux cluster
16 baseurl=file:///mnt/cdrom/Cluster
17 enabled=1
18 gpgcheck=1
19 gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
20
21 [rhel-clusterstorage]
22 name=Red Hat Enterprise Linux clusterstorage
23 baseurl=file:///mnt/cdrom/ClusterStorage
24 enabled=1
25 gpgcheck=1
[root@zzu ~]# yum repolist
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
repo id repo name
rhel-cluster Red Hat Enterpris
rhel-clusterstorage Red Hat Enterpris
rhel-server Red Hat Enterpris
rhel-vt Red Hat Enterpris
repolist: 2,399
[root@zzu ~]#
3:安装dhcp
[root@zzu ~]# yum install dhcp*
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package dhcpv6-client-1.0.10-17.el5.i386 already installed and latest version
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package dhcp.i386 12:3.0.5-21.el5 set to be updated
---> Package dhcp-devel.i386 12:3.0.5-21.el5 set to be updated
---> Package dhcpv6.i386 0:1.0.10-17.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================
Installing:
dhcp i386 12:3.0.5-21.el5 rhel-server 866 k
dhcp-devel i386 12:3.0.5-21.el5 rhel-server 131 k
dhcpv6 i386 1.0.10-17.el5 rhel-server 192 k
Transaction Summary
======================================================================================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
--------------------------------------------------------------------------------------------------------------------------------------
Total 389 MB/s | 1.2 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : dhcp 1/3
Installing : dhcp-devel 2/3
Installing : dhcpv6 3/3
Installed:
dhcp.i386 12:3.0.5-21.el5 dhcp-devel.i386 12:3.0.5-21.el5 dhcpv6.i386 0:1.0.10-17.el5
Complete!
[root@zzu ~]# vim /etc/dhcpd.conf
1 #
2 # DHCP Server Configuration file.
3 ddns-update-style interim;
4 ignore client-updates;
5
6 subnet 192.168.6.0 netmask 255.255.255.0 {
7
8 # --- default gateway
9 option routers 192.168.6.254;
10 option subnet-mask 255.255.255.0;
11
12 option nis-domain "domain.org";
13 option domain-name "domain.org";
14 option domain-name-servers 192.168.1.1;
15 next-server 192.168.6.100;
16 filename "pxelinux.0";
17
18 option time-offset -18000; # Eastern Standard Time
19 # option ntp-servers 192.168.1.1;
20 # option netbios-name-servers 192.168.1.1;
21 # --- Selects point-to-point node (default is hybrid). Don't change this unless
22 # -- you understand Netbios very well
23 # option netbios-node-type 2;
24
25 range dynamic-bootp 192.168.6.120 192.168.6.150;
26 default-lease-time 21600;
27 max-lease-time 43200;
[root@zzu ~]# service dhcpd start
启动 dhcpd: [确定]
[root@zzu ~]# chkconfig dhcpd on
-- INSERT --
4:安装tftp服务器
[root@zzu ~]# yum install tftp*
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package tftp-0.49-2.i386 already installed and latest version
Package tftp-server-0.49-2.i386 already installed and latest ve
[root@zzu ~]# service xinetd start
?.. xinetd锛
[root@zzu ~]# chkconfig xinetd on
[root@zzu ~]# chkconfig --list|grep xinetd
xinetd 0:off 1:off 2:on 3:on 4:on 5:on 6:o
xinetd based services:
[root@zzu ~]#
Vim /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
}
Cd /tftproot
[root@zzu tftpboot]# cp /mnt/cdrom/images/pxeboot/initrd.img ./
[root@zzu tftpboot]# cp /mnt/cdrom/images/pxeboot/vmlinuz ./
[root@zzu tftpboot]# cp /usr/lib/syslinux/pxelinux.0 ./ 驱动模块
[root@zzu tftpboot]# ll
total 8552
-r--r--r-- 1 root root 6855881 Feb 7 21:52 initrd.img
drwxr-xr-x 4 root root 4096 Feb 8 2012 linux-install
-rw-r--r-- 1 root root 13148 Feb 7 21:52 pxelinux.0
-r--r--r-- 1 root root 1855956 Feb 7 21:49 vmlinuz
[root@zzu tftpboot]# mkdir pxelinux.cfg
[root@zzu tftpboot]# ll
total 8556
-r--r--r-- 1 root root 6855881 Feb 7 21:52 initrd.img
drwxr-xr-x 4 root root 4096 Feb 8 2012 linux-install
-rw-r--r-- 1 root root 13148 Feb 7 21:52 pxelinux.0
drwxr-xr-x 2 root root 4096 Feb 7 21:55 pxelinux.cfg
-r--r--r-- 1 root root 1855956 Feb 7 21:49 vmlinuz
[root@zzu tftpboot]# cp /mnt/cdrom/isolinux/isolinux.cfg pxelinux.cfg/default
[root@zzu tftpboot]# vim pxelinux.cfg/default
1 default linux
2 prompt 1
3 timeout 5
4 display boot.msg
5 F1 boot.msg
6 F2 options.msg
7 F3 general.msg
8 F4 param.msg
9 F5 rescue.msg
10 label linux
11 kernel vmlinuz
12 append ks=ftp://192.168.6.100/pub/ks.cfg ksdevice=eth0 initrd=initrd.img
13 label text
14 kernel vmlinuz
15 append initrd=initrd.img text
16 label ks
17 kernel vmlinuz
18 append ks initrd=initrd.img
19 label local
20 localboot 1
21 label memtest86
22 kernel memtest
23 append -
24[root@zzu tftpboot]# service xinetd start
?.. xinetd锛
[root@zzu tftpboot]# chkconfig xinetd on
其他
[root@zzu tftpboot]# yum install system-config-kick*
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
The program yum-complete-transaction is found in the yum-utils package.
--> Running transaction check
---> Package system-config-kickstart.noarch 0:2.6.19.8-2.el5 set to be updated
--> Processing Dependency: pykickstart for package: system-config-kickstart
--> Running transaction check
---> Package pykickstart.noarch 0:0.43.5-1.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================
Installing:
system-config-kickstart noarch 2.6.19.8-2.el5 rhel-server 985 k
Installing for dependencies:
pykickstart noarch 0.43.5-1.el5 rhel-server 128 k
Transaction Summary
======================================================================================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
--------------------------------------------------------------------------------------------------------------------------------------
Total 322 MB/s | 1.1 MB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : pykickstart 1/2
Installing : system-config-kickstart 2/2
Installed:
system-config-kickstart.noarch 0:2.6.19.8-2.el5
Dependency Installed:
pykickstart.noarch 0:0.43.5-1.el5
Complete!
[root@zzu tftpboot]# system-config-kickstart
产生ks.cfg文件
[root@zzu ~]# vim /var/ftp/pub/ks.cfg
#platform=x86, AMD64, 或 Intel EM64T
# System authorization information
auth --useshadow --enablemd5
key --skip
# System bootloader configuration
bootloader --append="quiet" --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use network installation
url --url=ftp://192.168.6.100/pub
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$19p.ehQF$ao.mnfQJO9Or5yf5h5X.a1
# SELinux configuration
selinux --permissive
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=16 --resolution=800x600
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part / --bytes-per-inode=4096 --fstype="ext3" --size=10000
part swap --bytes-per-inode=4096 --fstype="swap" --size=512
%post --interpreter=#/bin/bash
ADDRE=`ifconfig eth0 |grep -i "bcast"|awk '{print $2}'`
NUM=${ADDRE##*.}
sed -i 's&HOSTNAME.*&HOSTNAME=station'$NUM'.abc.com&' /etc/sysconfig/network
init 6
service --disable cups,sendmail
%packages
安装测试
Sendmail 服务的启动很慢
后续
Ks.cfg个参数的作用
anaconda-ks.cfg详解
2010-08-13 14:45
这个文件记录的是安装系统时的一些信息:
那这个文件有什么用呢? 可以把这个文件经修改之后放入U盘,命名为ks.cfg 也可以放入nfs服务器,通过网络安装,出现boot界面时就可以输入: |
本文出自 “心灵规划” 博客,谢绝转载!