欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

内核编译

程序员文章站 2023-12-25 11:27:51
...

一.内核编译

实验环境:
在server5中:

虚拟机至少2048M以上Memory(内存)
内核编译
实验步骤:
所需要的LVS-FULLNAT和内核源码包

[aaa@qq.com ~]# ls
asciidoc-8.4.5-4.1.el6.noarch.rpm
Lvs-fullnat-synproxy.tar.gz
newt-devel-0.52.11-3.el6.x86_64.rpm
kernel-2.6.32-220.23.1.el6.src.rpm
slang-devel-2.2.1-1.el6.x86_64.rpm

1.配置高可用yum源

[aaa@qq.com ~]# vim /etc/yum.repos.d/rhel-source.repo
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=http://172.25.14.250/source6.5
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[LoadBalancer]
name=LoadBalancer
baseurl=http://172.25.14.250/source6.5/LoadBalancer
gpgcheck=0

[HighAvailability]
name=HighAvailability
baseurl=http://172.25.14.250/source6.5/HighAvailability
gpgcheck=0

[ResilientStorage]
name=ResilientStorage
baseurl=http://172.25.14.250/source6.5/ResilientStorage
gpgcheck=0

[ScalableFileSystem]
name=ScalableFileSystem
baseurl=http://172.25.14.250/source6.5/ScalableFileSystem
gpgcheck=0

2.安装内核源码包

[root@server5 ~]# yum install rpm-build -y # rpmbuild命令被用于创建rpm的二进制软件包和源码软件包
[root@server5 ~]# rpm -ivh kernel-2.6.32-220.23.1.el6.src.rpm 
[root@server5 ~]# cd rpmbuild/SPECS/
[root@server5 SPECS]# rpmbuild -bp kernel.spec

内核编译
3.根据提示,安装对应的安装包

[root@server5 SPECS]# yum install gcc redhat-rpm-config patchutils xmlto asciidoc elfutils-libelf-devel zlib-devel binutils-devel newt-devel python-devel perl-ExtUtils-Embed hmaccalc  -y

4.安装3个安装包

[root@server5 ~]# yum  install asciidoc-8.4.5-4.1.el6.noarch.rpm newt-devel-0.52.11-3.el6.x86_64.rpm slang-devel-2.2.1-1.el6.x86_64.rpm -y

5.从RPM获取内核源代码

[root@server1 SPECS]# rpmbuild -bp kernel.spec

6.重新打开一个server5

[root@server1 ~]# yum provides */rngd
[root@server1 ~]# yum install rng-tools-2-13.el6_2.x86_64 -y
[root@server1 ~]# rngd -r /dev/urandom

7.回到另一个server5

[aaa@qq.com ~]# tar zxf Lvs-fullnat-synproxy.tar.gz
[aaa@qq.com ~]# cd rpmbuild/BUILD/kernel-2.6.32-220.23.1.el6/linux-2.6.32-220.23.1.el6.x86_64/
[aaa@qq.com linux-2.6.32-220.23.1.el6.x86_64]# cp /root/lvs-fullnat-synproxy/lvs-2.6.32-220.23.1.el6.patch .
[aaa@qq.com linux-2.6.32-220.23.1.el6.x86_64]# patch -p1 < lvs-2.6.32-220.23.1.el6.patch ##打补丁
[aaa@qq.com linux-2.6.32-220.23.1.el6.x86_64]# vim Makefile #修改配置文件

内核编译

[aaa@qq.com linux-2.6.32-220.23.1.el6.x86_64]# make  ##编译
[aaa@qq.com linux-2.6.32-220.23.1.el6.x86_64]# make modules_install   ##导入模块
[aaa@qq.com linux-2.6.32-220.23.1.el6.x86_64]# make install 
[root@server5 ~]# cd /boot/grub/
[root@server5 grub]# vim grub.conf #修改引导文件
default=0  ##默认启动
[root@server5 grub]# reboot

内核编译

二.LVS Tools安装

1. keepalived install

[root@server5 ~]# cd lvs-fullnat-synproxy/
[root@server5 lvs-fullnat-synproxy]# tar zxf lvs-tools.tar.gz
[root@server5 lvs-fullnat-synproxy]# cd tools/keepalived/
[root@server5 keepalived]# ./configure --with-kernel-dir="/lib/modules/`uname -r`/build";
[root@server5 keepalived]# yum install -y popt-devel
[root@server5 keepalived]# make;
[root@server5 keepalived]# make install

2.ipvsadm install

[root@server5 ~]# cd lvs-fullnat-synproxy/tools/ipvsadm/
[root@server5 ipvsadm]# make;
[root@server5 ipvsadm]# make install;

上一篇:

下一篇: