操作系统openeuler22.0,x86架构
分别下载ovn和ovs的源码
https://github.com/openvswitch/ovs/tree/v2.13.0
https://github.com/ovn-org/ovn/tree/v20.03.1
![](https://img-blog.csdnimg.cn/img_convert/96ca3830914ea45572f16f803faeb7e7.png)
安装必要工具:
yum install -y unzip tar make autoconf automake libtool rpm-build gcc libuuid-devel
准备好官方指导文件
https://github.com/ovn-org/ovn/blob/v20.03.1/Documentation/intro/install/general.rst
https://github.com/openvswitch/ovs/blob/v2.13.1/Documentation/intro/install/general.rst
分别解压在opt目录下:
![](https://img-blog.csdnimg.cn/img_convert/303c3f988ba5234767c83e64fde61f8c.png)
进到各自目录下执行:./boot.sh
如果在没有配置ovs的环境时安装ovn则会报如下错误
![](https://img-blog.csdnimg.cn/img_convert/75361cf1a1aac13fa443122fdf3e7dff.png)
所以先针对ovs执行:
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
![](https://img-blog.csdnimg.cn/img_convert/71c7f20d06c2521a022b80d66fd2a1e1.png)
然后在ovn里面执行:
./configure --with-ovs-source=/root/ovn_src/ovs-2.13.0 -prefix=/usr --localstatedir=/var --sysconfdir=/etc
![](https://img-blog.csdnimg.cn/img_convert/85d91b5fe67d68193b0b6722d76bd77b.png)
在ovn目录下执行make rpm-fedora 提示需要依赖
'/root/ovn_src/ovs-2.13.0/openvswitch-2.13.0.tar.gz'
![](https://img-blog.csdnimg.cn/img_convert/2681a2f466db556eca2722c1b425e4bd.png)
将ovs-2.13.0 更换名称为openvswitch-2.13.0
并打包成openvswitch-2.13.0.tar.gz 然后放到/root/ovn_src/ovs-2.13.0
继续执行make rpm-fedora
![](https://img-blog.csdnimg.cn/img_convert/a9794027db03d9830b392d912b3806a9.png)
提示缺少依赖:逐个安装
![](https://img-blog.csdnimg.cn/img_convert/feaea340b913211e46fcc230387cca04.png)
yum install -y checkpolicy desktop-file-utils gcc-c++ graphviz libcap-ng-devel openssl-devel python3-devel selinux-policy-devel unbound-devel python3-sphinx
注意:当前欧拉系统里面的python版本是3.9.9
![](https://img-blog.csdnimg.cn/img_convert/7b7a9ab0f6d6355732ccb93e3a251cc7.png)
在centos7系统上可能需要安装python2-sphinx
×执行编译:make rhel/ovn-fedora.spec(到上一步骤正常已经打出了rpm包)
![](https://img-blog.csdnimg.cn/img_convert/83ba405403c089c344856d0906d75102.png)
编译成功:
![](https://img-blog.csdnimg.cn/img_convert/e4986df64b56a036c917ee9151e5bb10.png)
ovn源码目录下生成了rpm目录
![](https://img-blog.csdnimg.cn/img_convert/8a74ad1b488189387c087c1e495d3a17.png)
这个打出来的rpm,这里我们在环境中使用红框几个包即可满足基本的应用
![](https://img-blog.csdnimg.cn/img_convert/f25d6bd4f8d443ffc676e47187227a00.png)
下面编译ovs的rpm包
![](https://img-blog.csdnimg.cn/img_convert/e6a0275c7d70b8b3e88fead693c1c74f.png)
编译ovs选择编译用户空间的依赖包
![](https://img-blog.csdnimg.cn/img_convert/80bd834990570f3d9c027bbd63b59ee8.png)
![](https://img-blog.csdnimg.cn/img_convert/1af3bb695e4ed057a7a7ecf28671c7ba.png)
...
![](https://img-blog.csdnimg.cn/img_convert/74fecd7a0bc8633cc4aa1f346f74f04a.png)
上述安装完成
测试安装ovn 和 ovs的rpm包
我们将ovn 服务基础的包整理在一起
![](https://img-blog.csdnimg.cn/img_convert/7bede1d6fb7d17cab1b9f19d497c0381.png)
![](https://img-blog.csdnimg.cn/img_convert/9e7eef0771277f92175c5a08a35cbb88.png)
![](https://img-blog.csdnimg.cn/img_convert/38f413eb1580678260937d89f5e62e43.png)
安装ovs::状态时active(exit)但可以正常使用了
![](https://img-blog.csdnimg.cn/img_convert/368b96fe0fa0c8d2fc6c4eeaf953a5a9.png)
测试ovs
![](https://img-blog.csdnimg.cn/img_convert/8cbd533643c31e7f9b28802d2933928f.png)
测试ovn
![](https://img-blog.csdnimg.cn/img_convert/917dacab5b19d7512ff86319a82dc4b5.png)
测试ovn管理ovs
第一步:在北向数据库创建服务
ovn-sbctl set-connection ptcp:6642:127.0.0.1
ovn-nbctl set-connection ptcp:6641:127.0.0.1
[root@euler22 ovn_rpm_mini]# ss -anlpt | grep 66
LISTEN 0 4096 0.0.0.0:111 0.0.0.0:* users:(("rpcbind",pid=666,fd=8))
LISTEN 0 10 127.0.0.1:6641 0.0.0.0:* users:(("ovsdb-server",pid=51866,fd=20))
LISTEN 0 10 127.0.0.1:6642 0.0.0.0:* users:(("ovsdb-server",pid=51892,fd=19))
LISTEN 0 4096 [::]:111 [::]:* users:(("rpcbind",pid=666,fd=11))
第二步:在ovs节点配置以下三个全局参数,三个参数全部填写才行
ovs-vsctl set open . external-ids:ovn-encap-type=geneve
ovs-vsctl set open . external-ids:ovn-encap-ip="127.0.0.1"
ovs-vsctl set open . external-ids:ovn-remote="tcp:127.0.0.1:6642"
![](https://img-blog.csdnimg.cn/img_convert/ea6c0e6b5e42a750fcda786c4e63f9e7.png)
检查南向数据库是否同步到了chassis ID,以下显示已经成功
![](https://img-blog.csdnimg.cn/img_convert/d8633ff0c9fb0a550e4f18a3f81a6b18.png)
至此完成ovn- ovs 编译-安装-应用的大致流程
不足支持请批评指正