免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 848 | 回复: 0
打印 上一主题 下一主题

RedHat 8.0下,Kernel 2.4.20重新compile 成支援IPVS的过程 [复制链接]

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-07-28 16:45 |只看该作者 |倒序浏览
相信大家都有跟我一样的困扰,要安装Linux Virtual Server,要重新Compile Linux的kernel,但是常常会因为一两个小错误,而无法成功,以下是我在自己的NoteBook上面的RedHat 8.0上将kernel 2.4.20-19.8重新compile成支援IPVS的过程,各位可以参考参考…
------------------------------------------------------------------------------------------
Kernel 2.4.20如何重新compile 成支援IPVS:
ASUS: L2000 Notebook
OS:RedHat 8.0 (Kernel  2.4.20-18.
CPU:Pentium-4 mobile 1.4G         RAM: DDR-266 512MB

源由:
为什么会想装LVS(Linux Virtual Server),主要是因为需要。基本上这是句废话,但是安装过程中我主要参考下列网页:
http://linux.vbird.idv.tw/ 鸟哥的Linux私房菜
http://www.adj.idv.tw/server/linux_lvs.php    在RedHat 7.3上架设LVS
http://www.adj.idv.tw/server/linux_lvs.php Study-Area的讨论文章
http://www.linuxvirtualserver.org/  LVS的官方网站
http://www.linuxaid.com.cn/articles/2/0/202490941.shtml LinuxAid说明(上)
http://www.linuxaid.com.cn/articles/8/0/807154206.shtml LinuxAid说明(下)
http://mail.incredimail.com/howto/lvs/install/ RedHat7.3的用户用这儿的资料

注意:
如果你参考Linux Virtual Server的官方网站上的作法,我跟你保证在REDHAT 8、9以上很难做出来,除非你很懂kernel,所以上述文章,就当成练基本功吧。
  参考google查出来网友的讨论,RedHat在9.0里面kernel中完全将ipvs的套件移除,当然主要是因为商业考量,要大家都去买RHAS,RedHat 9.0完全是desttop oriented。另外最适合拿来当Linux Virtual Server的RedHat版本为7.3,其他的都不是很stable,有兴趣可以用google查查看。
  下列方法适用于2.4的kernel,主要在Redhat 8.0上使用,已经利用up2date将所有的套件更新至最新版本,其他版本估计应该也差不多。

我的安装方式(compile成支援IPVS kernel):
1.首先上http://www.redhat.com 抓取kernel-source-2.4.20-19.8.i386.rpm这个kernel的核心。在我的NoteBook上利用
# rpm –ivh kernel-source-2.4.20-19.8.i386.rpm   
安装,他会建立一个目录:/usr/src/linux-2.4.20-19.8与一个Symbolic Link linux-2.4,但是我们还要另外建立一个symbolic link
#ln –s ./linux-2.4.20-19.8 ./linux
(因为等会要上ipvs patch的时候,他一定会link到/usr/src/linux这个目录,所以要另外建力这个目录。)

2.因为我的Notebook原本的OS为2.4.20-18.8,所以在/boot目录下,可以找到
-rw-r--r--    1 root     root        44764  5月 29 19:49 config-2.4.20-18.8
这个档案,将这个档案copy至/usr/src/linux/.config
# cp /boot/config-2.4.20-18.8 /usr/src/linux/.config
因为等会我要利用make oldconfig去作…他default会去读取/usr/src/linux/.config这个file
3.上Linux Virtual Server的网页抓取kernel-2.4.0-20的PATCH档案下来,
我是抓下面这个档案:
The IPVS Netfilter module for kernel 2.4 - Version 1.0.9 - May 21, 2003
取得ipvs-1.0.9.tar.gz 这个档案
因为我试过抓linux-2.4.20-ipvs-1.0.9.patch.gz 但是,没有compile成功过,所以放弃。
将ipvs-1.09.tar.gz解开,放在/usr/src/source/ipvs-1.0.9这个目录下,然后在这个目录下,输入
# make patchkernel
# make installsource

4.接着安装cipe 1.5.4的这个版本,http://mail.incredimail.com/howto/lvs/install/package/ 这个目录中有。cipe 1.4.5无法使用,因为1.4.5有Bug,所以一定要确定cipe的版本是1.5.4,且一定要安装cipe否则等一下无法compile ipvs的东西。
所有准备工作到此告一段落。正式进入compile kernel的重要阶段。

5.开始compile kernel,
# make oldconfig (会去读取.config的资料,并且会问你有关ipvs的一些设定,全部用M回答),按下Enter。
# make dep
# make bzImage
# make modules
# make modules_install
# make install
6.至于最后的make install,不晓得为什么我总是无法完成到最后,但是必要的档案已经都有了…
-rw-r--r--    1 root     root       131735  6月  6 08:53 initrd-2.4.20-18.8.img
-rw-r--r--    1 root     root       129736  7月 28 15:51 initrd-2.4.20-19.8custom.img
lrwxrwxrwx    1 root     root           28  7月 28 15:58 System.map ->; System.map-2.4.20-19.8custom
-rw-r--r--    1 root     root       519383  7月 28 15:51 System.map-2.4.20-19.8custom
-rw-r--r--    1 root     root      1118581  7月 28 15:51 vmlinuz-2.4.20-19.8custom
7.修改/etc/lilo如下面格式:
prompt
timeout=350
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
message=/boot/message
lba32
#       optional

other=/dev/hda1
        optional
        label=WinXP-Home

image=/boot/vmlinuz-2.4.20-18.8
        label=linux_old
        append="root=LABEL=/"
        read-only
        optional
        initrd=/boot/initrd-2.4.20-18.8.img
image=/boot/vmlinuz-2.4.20-19.8custom
        label=linux_new
        root=/dev/hda5
        append="devfs=mount"
        read-only
        optional
        initrd=/boot/initrd-2.4.20-19.8custom.img

因为我的/ 是mount在/dev/hda5下,所以你只要稍加修改即可。

8.重新开机(shutdown –r now)
9.选择linux_new开机,看看有没有错误。
10如果都没有错误,安装ipvsadm-1.21-4.i386.rpm
rpm –ivh ipvsadm-1.21-4.i386.rpm
rpm –ivh piranha-docs-0.5.3-9.i386.rpm
rpm –ivh piranha-0.5.3-9.i386.rpm
rpm –ivh piranha-gui-0.5.3-9.ir86.rpm (这个我因为没有apache所以装不起来)

11.试验一下 输入:
[root@nbaa boot]# ipvsadm
IP Virtual Server version 1.0.9 (size=65536)
Prot LocalAddressort Scheduler Flags
  ->; RemoteAddressort           Forward Weight ActiveConn InActConn
出现上面画面就是成功啦!!!
12.后续的动作就依照你的网路状态,去作规划了,我还在研究。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP