Hello World !
分类: LINUX
2012-07-19 21:28:52
环境Linux5.7.0.3 -------不同版本ks.cfg可能不同 安装时不能通过NAT连接方式
1.Install RPM
dhcp
dhcp-3.0.5-29.el5.i386.rpm
dhcp-devel-3.0.5-29.el5.i386.rpm
xinetd
xinetd-2.3.14-13.el5.i386.rpm
tftp
tftp-server-0.49-2.i386.rpm
nfs
nfs-utils-1.0.9-54.el5.i386.rpm
nfs-utils-lib-1.0.8-7.6.el5.i386.rpm
portmap
portmap-4.0-65.2.2.1.i386.rpm
[root@localhost ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# cd /mnt/Server/
[root@localhost Server]# rpm -ivh dhcp-3.0.5-29.el5.i386.rpm dhcp-devel-3.0.5-29.el5.i386.rpm
warning: dhcp-3.0.5-29.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:dhcp ########################################### [ 50%]
2:dhcp-devel ########################################### [100%]
[root@localhost Server]# rpm -ivh xinetd-2.3.14-13.el5.i386.rpm tftp-server-0.49-2.i386.rpm
warning: xinetd-2.3.14-13.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:xinetd ########################################### [ 50%]
2:tftp-server ########################################### [100%]
[root@localhost Server]# rpm -ivh nfs-utils-1.0.9-54.el5.i386.rpm nfs-utils-lib-1.0.8-7.6.el5.i386.rpm
warning: nfs-utils-1.0.9-54.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package nfs-utils-lib-1.0.8-7.6.el5.i386 is already installed
package nfs-utils-1.0.9-54.el5.i386 is already installed
[root@localhost Server]# rpm -ivh portmap-4.0-65.2.2.1.i386.rpm
warning: portmap-4.0-65.2.2.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
package portmap-4.0-65.2.2.1.i386 is already installed
[root@localhost Server]#
2.开机自启动服务
[root@localhost Server]# chkconfig dhcpd on
[root@localhost Server]# chkconfig xinetd on
[root@localhost Server]# chkconfig nfs on
[root@localhost Server]# chkconfig portmap on
3 ifconfig 配置
[root@localhost Server]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:C6:42:C8
inet addr:10.10.1.1 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::20c:29ff:fec6:42c8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1796 errors:0 dropped:0 overruns:0 frame:0
TX packets:2580 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:140037 (136.7 KiB) TX bytes:317549 (310.1 KiB)
Interrupt:67 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1568 (1.5 KiB) TX bytes:1568 (1.5 KiB)
1.Dhcp配置
[root@localhost Server]# cd /etc
[root@localhost etc]# cp /usr/share/doc/dhcp*/dhcpd.conf.sample ./dhcpd.conf
cp: overwrite `./dhcpd.conf'? y
[root@localhost etc]# vi dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 10.10.0.0 netmask 255.255.0.0 {
# --- default gateway
option routers 10.10.1.1;
option subnet-mask 255.255.0.0;
range dynamic-bootp 10.10.10.10 10.10.20.240;
default-lease-time 21600;
max-lease-time 43200;
filename "/kickstart/ks.cfg";
next-server 10.10.1.1;
}
option space PXE;
class "PXE" {
match if substring(option vendor-class-identifier,0,9) = "PXEClient";
option vendor-encapsulated-options 01:04:00:00:00:00:ff;
option boot-size 0x1;
filename "pxelinux.0";
option tftp-server-name "10.10.1.1";}
"dhcpd.conf" 24L, 559C written
[root@localhost etc]# service dhcpd restart
Starting dhcpd: [ OK ]
dhcpd启动时日志文件,失败时可参考cat /var/log/messages
2.Tftp配置
[root@localhost etc]# cd xinetd.d
[root@localhost xinetd.d]# vi 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
per_source = 11
cps = 100 2
flags = IPv4
}
~
~
~
~
~
"tftp" 18L, 509C written
[root@localhost xinetd.d]# service xinetd restart
Stopping xinetd: [FAILED]
Starting xinetd: [ OK ]
[root@localhost xinetd.d]# netstat -a|grep tftp
getnameinfo failed
getnameinfo failed
getnameinfo failed
getnameinfo failed
udp 0 0 *:tftp *:*
[root@localhost xinetd.d]# cd /tftpboot
[root@localhost xinetd.d]# ls
[root@localhost tftpboot]# cp /usr/lib/syslinux/pxelinux.0 .
[root@localhost tftpboot]# cp /mnt/images/pxeboot/initrd.img .
[root@localhost tftpboot]# cp /mnt/images/pxeboot/vmlinuz .
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# cd pxelinux.cfg/
[root@localhost pxelinux.cfg]# cp /mnt/isolinux/isolinux.cfg ./default
[root@localhost pxelinux.cfg]# ls
default
[root@localhost pxelinux.cfg]# vi default
default linux
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 ksdevice=eth0 load_ramdisk=1 initrd=initrd.img network ks noipv6
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -
"default" 24L, 410C written
[root@localhost pxelinux.cfg]# cd ..
[root@localhost tftpboot]# ll
total 12100
-r--r--r-- 1 root root 10449935 Jul 20 06:15 initrd.img
-rw-r--r-- 1 root root 13148 Jul 20 06:15 pxelinux.0
drwxr-xr-x 2 root root 4096 Jul 20 06:20 pxelinux.cfg
-r--r--r-- 1 root root 1894068 Jul 20 06:15 vmlinuz
[root@localhost tftpboot]#
3.NFS配置
[root@localhost etc]# cd /
[root@localhost /]# mkdir install
[root@localhost /]# mkdir kickstart
[root@localhost /]# mount /dev/cdrom /install/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost /]# vi /etc/exports
/install *(ro,sync)
/tftpboot *(ro,sync)
/kickstart *(ro,sync)
~
"/etc/exports" 3L, 63C written
[root@localhost /]# service nfs restart
Shutting down NFS mountd: [FAILED]
Shutting down NFS daemon: [FAILED]
Shutting down NFS quotas: [FAILED]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@localhost /]# showmount -e
Export list for localhost.localdomain:
/install *
/tftpboot *
/kickstart *
[root@localhost /]# exportfs
/kickstart
/tftpboot
/install
[root@localhost /]#
4./kickstart/ks.cfg
[root@localhost /]# cd kickstart/
[root@localhost kickstart]# vi ks.cfg
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all
zerombr yes
#Skip the key number
key --skip
# 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 NFS installation
bootloader --location=mbr
# Partition clearing information
clearpart --all
zerombr yes
#Skip the key number
key --skip
# 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 NFS installation
nfs --server=10.10.1.1 --dir=/install
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
"ks.cfg" 46L, 1166C written
[root@localhost kickstart]#