Chinaunix首页 | 论坛 | 博客
  • 博客访问: 211888
  • 博文数量: 37
  • 博客积分: 2649
  • 博客等级: 少校
  • 技术积分: 490
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-02 10:31
文章分类

全部博文(37)

文章存档

2012年(3)

2009年(7)

2008年(27)

我的朋友

分类: LINUX

2008-12-04 19:06:08

服务器运行的系统为CentOS5.2
一.搭建dhcp服务器
1.rpm -ivh dhcp-3.0.5-7.el5.i386.rpm
注意版本,某个版本有bug导致不能获取地址,有的版本和dhclient程序冲突,最好和dhclient版本相同。
2.设置dhcp.conf
这是我的设置:
option space PXE;
option PXE.mtftp-ip               code 1 = ip-address; 
option PXE.mtftp-cport            code 2 = unsigned integer 16;
option PXE.mtftp-sport            code 3 = unsigned integer 16;
option PXE.mtftp-tmout            code 4 = unsigned integer 8;
option PXE.mtftp-delay            code 5 = unsigned integer 8;
option PXE.discovery-control      code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr   code 7 = ip-address;
class "pxeclients" {
    match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
    option vendor-class-identifier "PXEClient";
    vendor-option-space PXE;
    # At least one of the vendor-specific PXE options must be set in
    # order for the client boot ROMs to realize that we are a PXE-compliant
    # server.  We set the MCAST IP address to 0.0.0.0 to tell the boot ROM
    # that we can't provide multicast TFTP (address 0.0.0.0 means no
    # address).
    option PXE.mtftp-ip 0.0.0.0;
    # This is the name of the file the boot ROMs should download.
    filename "pxelinux.0";
    # This is the name of the server they should get it from.
    next-server 192.168.0.1;
}
ddns-update-style interim;
ignore client-updates;
default-lease-time 1200;
max-lease-time 9200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1,192.168.0.2;
option domain-name "mydomain.org";
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.100;
}
host netboot {
hardware ethernet 00:0F:E2:97:2A:FF;
 fixed-address 192.168.0.22;
 option root-path "192.168.0.1:/tftpboot";
}
前面pxe一段要注意,否则不能进行pxe启动安装。
3.启动dhcp服务
/etc/init.d/dhcpd start
 
二.搭建tftp服务器
1.安装xinetd:rpm -ivh xinetd-2.3.4-0.8.i386.rpm
安装tftp-server:rpm -ivh tftp-server-0.39-3.el4.i386
2.修改/etc/xinetd.d/tftp:
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -u nobody -s /tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
}
3.启动tftp服务:/etc/rc.d/init.d/xinetd restart
启动nfs服务:/etc/rc.d/init.d/nfs restart
 
三.制作gentoo网络启动文件
主要包含两个文件内核gentoo和文件系统gentoo.igz,但gentoo.igz需要作一定修改。我所做的修改主要参考下面两篇文章:
这个步骤需要的三个文件gentoo,gentoo.igz,image.squashfs来自于install-x86-minimal-2008.0.iso,livecd虽然有这些文件不过安装的时候会出现问题。
 
主要目的为将image.squashfs放入gentoo.igz压缩包,修改压缩包里的init脚本,然后重新打包。
1.解压缩gentoo.igz到gentoo.dir
cp gentoo.igz /tftpboot
mkdir gentoo.dir
cd gentoo.dir
zcat ../gentoo.igz|cpio -idv
2.将image.squashfs拷贝到mnt/cdrom下
mkdir mnt/cdrom
cp image.squashfs mnt/cdrom
3.修改./init脚本
修改的补丁文件如下所示:
--- init.orig 2008-11-28 08:16:38.000000000 +0800
+++ init 2008-11-28 08:19:05.000000000 +0800
@@ -282,11 +282,6 @@
   [ ! -e "${NEW_ROOT}/dev/tty1" ] && mknod "${NEW_ROOT}/dev/tty1" c 4 1
  fi
 
- if [ "${REAL_ROOT}" != "/dev/nfs" ] && [ "${LOOPTYPE}" != "sgimips" ]
- then
-  bootstrapCD
- fi
-
  if [ "${REAL_ROOT}" = '' ]
  then
   echo -n -e "${WARN}>>${NORMAL}${BOLD} No bootable medium found. Waiting for new devices"
@@ -414,7 +409,7 @@
    fi
   else
    bad_msg "Could not mount specified ROOT, try again"
-   got_good_root=0
+   got_good_root=1
    REAL_ROOT=''
   fi
  fi
@@ -433,7 +428,7 @@
  [ -z "${LOOP}" ] && find_loop
  [ -z "${LOOPTYPE}" ] && find_looptype
 
- cache_cd_contents
+# cache_cd_contents
 
  # If encrypted, find key and mount, otherwise mount as usual
  if [ -n "${CRYPT_ROOT}" ]
@@ -469,7 +464,7 @@
   elif [ "${LOOPTYPE}" = 'squashfs' ]
   then
    good_msg 'Mounting squashfs filesystem'
-   mount -t squashfs -o loop,ro "${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
+   mount -t squashfs -o loop,ro "/mnt/cdrom/${LOOPEXT}${LOOP}" "${NEW_ROOT}/mnt/livecd"
    test_success 'Mount filesystem'
    FS_LOCATION='mnt/livecd'
   elif [ "${LOOPTYPE}" = 'gcloop' ]
手工修改的工作量也不大。
4.重新打包gentoo.igz
find *|cpio --quiet --dereference -o -H newc|gzip -9>../gentoo.igz
 
至此,前期工作已经全部完成,将gentoo和新的gentoo.igz放到/tftpboot下,客户端机器重启就可以进行漫长的gentoo安装了。
 
 
阅读(2481) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2008-12-05 10:55:09

真郁闷啊,花了这么长时间搞了网络安装,结果最后还是不行,人家的串口驱动都是特殊的,不透露给我们客户的

auro2008-12-04 23:24:11

http://www.zettaserve.com/default.asp?catid=21 http://wiki.antlinux.com/pmwiki.php?n=HowTos.SetupPxeBoot http://siso.sourceforge.net/kernel-copy.html