Chinaunix首页 | 论坛 | 博客
  • 博客访问: 386660
  • 博文数量: 25
  • 博客积分: 496
  • 博客等级: 下士
  • 技术积分: 815
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-01 11:18
文章分类
文章存档

2014年(2)

2013年(6)

2012年(17)

分类: LINUX

2012-07-09 14:28:15

linux遇到严重的系统故障时,就需要用linux的rescue mode进入系统进行修复,假如要修复对象的机器没光驱呢,就不能从光盘进入rescue了,而且随身带着光盘也麻烦,试想一下在笔记本上配一个各个系统版本的rescue,到时候只要网线一连,就能进入rescue进行修复了。
在网络上有很多关于kickstart+dhcp+dns+vsftp++tftp+pxe的网络自动安装文档,其实网络rescue原理也一样。
一:dhcp配置
安装dhcp(略)

点击(此处)折叠或打开

  1. [root@server2 ~]# vim /etc/dhcpd.conf
  2. ddns-update-style none;
  3. subnet 192.168.238.0 netmask 255.255.255.0 {
  4. option routers 192.168.238.1;
  5. option subnet-mask 255.255.255.0;
  6. option domain-name "example.com";
  7. default-lease-time 21600;
  8. max-lease-time 43200;
  9. pool {
  10. range 192.168.238.2 192.168.238.99;
  11. }
  12. next-server server2.lanv.com;
  13. }
  14. option space PXE;
  15. class "PXE" {
  16. match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
  17. option vendor-encapsulated-options 01:04:00:00:00:00:ff;
  18. option boot-size 0x1;
  19. filename "pxelinux.0";
  20. option tftp-server-name "server2.lanv.com";
  21. option vendor-class-identifier "PXEClient";
  22. vendor-option-space PXE;
  23. }
  24. [root@server2 ~]# service dhcpd restart
  25. Shutting down dhcpd: [ OK ]
  26. Starting dhcpd: [ OK ]

二:配置vsftp
安装略

点击(此处)折叠或打开

  1. [root@server2 ~]# cd /var/ftp/pub/
  2. [root@server2 pub]# mkdir RHEL5.7
把rhel5.7光盘内容都cp到/var/ftp/pub/RHEL5.7里

点击(此处)折叠或打开

  1. [root@server2 pub]# service vsftpd start
  2. Starting vsftpd for vsftpd: [ OK ]
  3. [root@server2 pub]# chkconfig vsftpd on

三:配置tftp
启用tftp

点击(此处)折叠或打开

  1. [root@server2 oracle]# vim /etc/xinetd.d/tftp
  2. service tftp
  3. {
  4. socket_type = dgram
  5. protocol = udp
  6. wait = yes
  7. user = root
  8. server = /usr/sbin/in.tftpd
  9. server_args = -s /tftpboot
  10. disable = no
  11. per_source = 11
  12. cps = 100 2
  13. flags = IPv4
  14. }
  15. [root@server2 oracle]# service xinetd restart
    Stopping xinetd:                                           [  OK  ]
    Starting xinetd:                                           [  OK  ]
拷贝以下文件到/tftpboot目录

点击(此处)折叠或打开

  1. [root@server2 isolinux]# df -h /mnt
  2. Filesystem Size Used Avail Use% Mounted on
  3. /dev/hdc 3.6G 3.6G 0 100% /mnt
  4. [root@server2 mnt]# cd isolinux/
  5. [root@server2 isolinux]# ls
  6. boot.cat general.msg isolinux.bin memtest param.msg splash.lss vmlinuz
  7. boot.msg initrd.img isolinux.cfg options.msg rescue.msg TRANS.TBL
  8. [root@server2 isolinux]# cp boot.msg /tftpboot/
  9. [root@server2 isolinux]# cp initrd.img /tftpboot/initrd-5.7.img
  10. [root@server2 isolinux]# cp -r isolinux.cfg /tftpboot/default
  11. [root@server2 isolinux]# cp vmlinuz /tftpboot/vmlinuz-5.7
  12. [root@server2 isolinux]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
  13. [root@server2 isolinux]# cd /tftpboot/
    [root@server2 tftpboot]# mkdir pxelinux.cfg
    [root@server2 tftpboot]# mv default pxelinux.cfg/
  14. [root@server2 tftpboot]# ls
    boot.msg  initrd-5.7.img  pxelinux.0  pxelinux.cfg  vmlinuz-5.7
编辑default文件,指定安装内核名称及启动模式


 

点击(此处)折叠或打开

  1. [root@server2 tftpboot]# vim /tftpboot/pxelinux.cfg/default
  2. default rhel5.7res
  3. prompt 1
  4. timeout 100
  5. display boot.msg
  6. label rhel5.7res
  7. kernel vmlinuz-5.7
  8. append ksdevice=eth0 load_ramdisk=1 initrd=initrd-5.7.img rescue

编辑boot.msg文件,显示启动列表


 

点击(此处)折叠或打开

  1. [root@server2 tftpboot]# vim boot.msg
  2. ##############
  3. # linux part #
  4. ##############
  5. rhel5.7res

测试启动效果

 

 

 

 

 

 

 

 
这样一个简单的linux network rescue mode 就配好了。
 
PS:只想配网络rescue的话,第二步配置vsftp是可以不要的,本文配置只要加上kickstart脚本,再在/tftpboot/pxelinux.cfg/default文件中加上以下内容

点击(此处)折叠或打开

  1. label rhel5.7
  2. kernel vmlinuz-5.7
  3. append ksdevice=eth0 load_ramdisk=1 initrd=initrd-5.7.img ks=ftp://192.168.238.253/pub/gls/ks-5.7.cfg
就可以实现RHE5.7系统的网络自动安装了。




阅读(4425) | 评论(1) | 转发(2) |
给主人留下些什么吧!~~

云杉上的蝴蝶2012-08-09 03:57:39

这个方法还是蛮实用的!文章面向读者难道为中,对于忽略掉的配置部分,如果能加上相关技术文章的Link就更好了,对于涉入Linux 系统不久的同学们会非常有帮助!