linux系统下lvs-fullnat-内核编译,linuxlvs-fullnat-

# 启动EC2 AMI实例

linux系统下lvs-fullnat-内核编译,linuxlvs-fullnat-

# 获取内核源码
get_reference_source -p kernel
sudo rpm -Uvh /usr/src/srpm/debug/kernel-3.2.21-1.32.6.amzn1.src.rpm

首先把需要安装的相关包放在/mnt目录,然后进行如下设置:

1、tar -zxf Lvs-fullnat-synproxy.tar.gz
2、cd lvs-fullnat-synproxy/
3、tar -zxf lvs-tools.tar.gz
4、rpm -ivh kernel-2.6.32-220.23.1.el6.src.rpm
5、cd rpmbuild/cdSPECS/
6、yum install rpm-build -y
7、yum install gcc redhat-rpm-config kernel.spec patchutils xmlto
asciidoc elfutils-libelf-devel zlib-devel binutils-devel newt-devel
python-devel perl-ExtUtils-Embed hmaccalc -y #安装相关依赖性包
8、yum install newt-devel-0.52.11-3.el6.x86_64.rpm
slang-devel-2.2.1-1.el6.x86_64.rpm asciidoc-8.4.5-4.1.el6.noarch.rpm
-y
9、cd rpmbuild/cdSPECS/
10、rpmbuild -bp kernel.spec #解开源码
11、yum install -y rng-tools-2-13.el6_2.x86_64
#在解源码的过程中终端会卡住,这是缺少一个包,因此需要安装这个包,并执行下面的命令
12、rngd -r /dev/urandom

# 安装依赖包
sudo yum install -y gcc gcc44 system-rpm-config m4 rpm-build gdb xmlto
asciidoc elfutils-devel zlib-devel binutils-devel python-devel perl
gettext newt-devel perl-ExtUtils-Embed

接下来进入正式编译的过程

13、cd BUILD
14、cd kernel-2.6.32-220.23.1.el6/
15、cd linux-2.6.32-220.23.1.el6.x86_64/
16、cp /mnt/lvs-fullnat-synproxy/lvs-2.6.32-220.23.1.el6.patch .
#打补丁
17、patch -p1 < lvs-2.6.32-220.23.1.el6.patch

18、vim Makefile
EXTRAVERSION =-220.23.1.el6.x86_64 #添加内核版本,以便区分原有内核
19、make #编译安装,这个过程比较长需要耐心等待
20、make modules_install #导入安装模块
21、make install #写入启动分区

22、vim /boot/grub/grub.conf #修改开机启动项,
default=0 #第一启动项

timeout=5

23、reboot #重启后会看到重新编译的内核

cd /usr/src/rpm/SOURCES/
# 修改内核配置
sudo vi config-generic
# 修改版本号
sudo vi kernel.spec

接下来重新编译Keepalive捷克

24、cd /mnt/lvs-fullnat-synproxy/tools/keepalived/
25、./configure –with-kernel-dir=”/lib/modules/uname -r/build”
26、yum install openssl-devel -y
27、yum install popt-devel -y

28、ln -s /usr/local/etc/sysconfig/keepalived /etc/sysconfig/
29、ln -s /usr/local/etc/keepalived/ /etc/
30、ln -s /usr/local/etc/rc.d/init.d/keepalived /etc/init.d/
31、ln -s /usr/local/sbin/keepalived /sbin/
32、chmod +x /usr/local/etc/rc.d/init.d/keepalived

33、cd /mnt/lvs-fullnat-synproxy/tools/ipvsadm
34、make
35、make install

# 编译并安装内核
sudo rpmbuild -bb kernel.spec
sudo rpm -ivh
/usr/src/rpm/RPMS/x86_64/kernel-3.2.21-1.32.7.amzn1.x86_64.rpm

经过上述步骤就完成了内核的编译,运行ipvsadm名令就会发现多出了fullnat模式

首先把需要安装的相关包放在/mnt目录,然后进行如下设置: 1、tar -zxf
Lvs-fullnat-synproxy.tar.gz…

图片 1

相关文章