Openvswitch 编译RPM包

发布时间: 更新时间: 总字数:594 阅读时间:2m 作者: 分享

本博客主要介绍如何在CentOS6.5上编译OpenvSwitch包。

安装依赖包

yum install kernel-headers kernel-devel gcc make python-devel openssl-devel kernel-devel, graphviz kernel-debug-devel automake rpm-build redhat-rpm-config libtool git

安装autoconf

[root@xiexianbin_cn ~]# cd
[root@xiexianbin_cn ~]# wget wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.gz
--2015-10-25 17:31:31--  http://wget/
Resolving wget... failed: Name or service not known.
wget: unable to resolve host address “wget”
--2015-10-25 17:31:32--  http://ftp.gnu.org/gnu/autoconf/autoconf-2.64.tar.gz
Resolving ftp.gnu.org... 208.118.235.20, 2001:4830:134:3::b
Connecting to ftp.gnu.org|208.118.235.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1714683 (1.6M) [application/x-gzip]
Saving to: “autoconf-2.64.tar.gz”

100%[=================================================================================================================>] 1,714,683    130K/s   in 23s     

2015-10-25 17:31:57 (72.1 KB/s) - “autoconf-2.64.tar.gz” saved [1714683/1714683]

FINISHED --2015-10-25 17:31:57--
Downloaded: 1 files, 1.6M in 23s (72.1 KB/s)
[root@xiexianbin_cn autoconf-2.64]# tar -zxf autoconf-2.64.tar.gz 
[root@xiexianbin_cn autoconf-2.64]# cd autoconf-2.64
[root@xiexianbin_cn autoconf-2.64]# ./configure 
[root@xiexianbin_cn autoconf-2.64]# make
...
[root@xiexianbin_cn autoconf-2.64]# make install

备用下载地址:http://pan.baidu.com/s/1ntL9pv7

下载ovs

下载的版本为:openvswitch-2.3.2.tar.gz

[root@xiexianbin_cn ~]# wget http://openvswitch.org/releases/openvswitch-2.3.2.tar.gz -O openvswitch-2.3.2.tar.gz
--2015-10-25 17:39:10--  http://openvswitch.org/releases/openvswitch-2.3.2.tar.gz
Resolving openvswitch.org... 69.56.251.103
Connecting to openvswitch.org|69.56.251.103|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3277164 (3.1M) [application/x-gzip]
Saving to: “openvswitch-2.3.2.tar.gz”

100%[=================================================================================================================>] 3,277,164   35.9K/s   in 77s     

2015-10-25 17:40:29 (41.4 KB/s) - “openvswitch-2.3.2.tar.gz” saved [3277164/3277164]

[root@xiexianbin_cn ~]# 

编译

关于 spec 文件,可以参考:https://github.com/rdo-common/openvswitch,也可以采用 openvswitch tar包中的文件。

[root@xiexianbin_cn ~]# mkdir -p /root/rpmbuild/SOURCES
[root@xiexianbin_cn ~]# cp /root/openvswitch-2.3.2.tar.gz /root/rpmbuild/SOURCES/
[root@xiexianbin_cn ~]# tar -zxf openvswitch-2.3.2.tar.gz
[root@xiexianbin_cn ~]# cd openvswitch-2.3.2
[root@xiexianbin_cn ~]# rpmbuild -bb --without check rhel/openvswitch.spec

[root@xiexianbin_cn openvswitch-2.3.2]# rpmbuild -bb --without check rhel/openvswitch-kmod-rhel6.spec


[root@xiexianbin_cn openvswitch-2.3.2]# cp rhel/openvswitch-kmod.files /root/rpmbuild/SOURCES/
[root@xiexianbin_cn openvswitch-2.3.2]# rpmbuild -bb -D "kversion 2.6.32-431.23.3.el6.x86_64" -D "kflavors default" rhel/openvswitch-kmod-rhel6.spec

注释:

  1. kversion 内核版本可通过uname -r。

编译结果:

[root@xiexianbin_cn x86_64]# pwd
/root/rpmbuild/RPMS/x86_64
[root@xiexianbin_cn x86_64]# ll
total 11460
-rw-r--r-- 1 root root 1231464 Oct 25 18:33 kmod-openvswitch-2.3.2-1.el6.x86_64.rpm
-rw-r--r-- 1 root root 2644260 Oct 25 18:13 openvswitch-2.3.2-1.x86_64.rpm
-rw-r--r-- 1 root root 7853848 Oct 25 18:13 openvswitch-debuginfo-2.3.2-1.x86_64.rpm
[root@xiexianbin_cn x86_64]# 

下载地址:http://pan.baidu.com/s/1sj46gET

参考

Home Archives Categories Tags Docs