- 论坛徽章:
- 0
|
转:
http://blog.chinaunix.net/u/25686/showart_198916.html
PXE网络安装LINUX [DHCP+TFTP+NFS] 作者:萧少聪[Scott Siu] E-Mail:scottsiuzs@gmail.com 06-11-11[ps:光棍节快乐]
更多精选文章请看:
http://wiki.bsdlife.org
一、方案
系统:Red Hat Enterprise Linux 4 AS 4.0
实现:DHCP+TFTP+NFS
二、笔记
1、复制安装文件到硬盘 (我用的是CD)
# mkdir /var/netboot
# mkdir /mnt/cd
--放入CD1
# mount /dev/hdc /mnt/cd
# cp /mnt/cd/* /var/netboot -r
# umount /mnt/cd
--放入CD2、3、4
# mount /dev/hdc /mnt/cd
# cp /mnt/cd/RedHat/RPMS/*.rpm /var/netboot/RedHat/RPMS -r
# umount /mnt/cd
2、DHCP
# rpm -ivh /var/netboot/RedHat/RPMS/dhcp-3.0.1-12_EL.i386.rpm
# cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf
# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
allow booting; //这两行说明允许exp启动[加入]
allow bootp;
subnet 192.168.1.0 netmask 255.255.255.0 { //你的router[修改]
# --- default gateway
option routers 192.168.1.100; //你的router[修改]
option subnet-mask 255.255.255.0; //你的掩码[修改]
# option nis-domain "domain.org"; //你的NIS域,我是注释掉了[修改]
# option domain-name "scott.home"; //你的DNS域名,没做DNS先注释掉了[修改]
# option domain-name-servers 192.168.1.100; //你的DNS服务器IP,没做DNS先注释掉了[修改]
filename "/linux-install/pxelinux.0"; //指明tftp所在的位置[加入]
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.1.128 192.168.1.250; //你想分配的地址段[修改]
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;
# } //这些都注释掉
}
3、NFS
# vi /etc/exports
/var/netboot/ *(ro,sync)
/tftpboot/linux-install/ *(ro,sync)
4、TFTP
# rpm -ivh /var/netboot/RedHat/RPMS/tftp-server-0.39-1.i386.rpm
# mkdir /tftpboot/linux-install
# cp /var/netboot/initrd.img /tftpboot/linux-install/
# cp /var/netboot/vmlinuz /tftpboot/linux-install/
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/linux-install/
# cp /var/netboot/*.msg /tftpboot/linux-install/
# cp /var/netboot/isolinux.cfg /tftpboot/linux-install/pxelinux.cfg/default
4、防火墙iptables
先是针对NFS的一个修改
# vi /etc/sysconfig/nfs
MOUNTD_PORT=4002
STATD_PORT=4003
LOCKD_TCPPORT=4004
LOCKD_UDPPORT=4004
# iptables -F
# iptables -P INPUT DROP
# iptables -A INPUT -i lo -j ACCEPT
# iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -p tcp -m multiport --dports 111,2049,4002,4003,4004 -j ACCEPT (NFS)
# iptables -A INPUT -s 192.168.1.0/24 -p udp -m multiport --dports 111,2049,4002,4003,4004 -j ACCEPT (NFS)
# iptables -A INPUT -s 192.168.1.0/24 -p udp --dport 69 -j ACCEPT (TFTP)
# /etc/init.d/iptables save
5、启动服务
# /etc/init.d/dhcpd restart
# chkconfig dhcpd on
# /etc/init.d/nfs restart
# chkconfig nfs on
# chkconfig tftp on
# /etc/init.d/xinetd restart
6、测试(有点问题不知道是不是VMWare GSX的问题)
我装的是Win XP SP2,VMWare GSX 3.2.0,新建一个虚拟机以PXE启动,启动后能得到IP也出现了LINUX安装
先单,但敲键盘没反应,过十分钟,刚刚敲键盘的内容才输进去,真不知道是为什么了!请高人赐教,或者
哪位弟兄用VMWare 5.5.1装一下,看会不会有这情况!谢谢!
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/11765/showart_328416.html |
|