How to install openvswitch?

did anyone tried to to install openvswitch on rockylinux 9 ? i’ve only found instructions for almalinux : https://computingforgeeks.com/install-open-vswitch-on-rocky-almalinux/ or should I install it from snap?

There are extra packages you can potentially get openvswitch from:

dnf search nfv
centos-release-nfv-common.noarch : Common package to contain NFV SIG
centos-release-nfv-openvswitch.noarch : Common release file to establish shared metadata for CentOS NFV SIG

These may provide the same packages you’re looking for.

You may have to compile and install. Here’s my example.

1.Make a directory for compile.

mkdir -p ~/rpmbuild/SOURCES

2.Install required dependency. YTou may have to run the second step multiple times. but once done, you show be able to upgrade at ease.

yum install yum-utils
yum-builddep xxx.spec

3.Download source package from www.openvswitch.org

curl https://www.openvswitch.org/releases/openvswitch-3.0.1.tar.gz -o ~/rpmbuild/SOURCES/openvswitch-3.0.1.tar.gz

4.unarchive the source package and modify .spec file as you need.

cd /rpmbuild/SOURCES/
tar -zxvf ./openvswitch-3.0.1.tar.gz
vim /rpmbuild/SOURCES/openvswitch-3.0.1/rhel/openvswitch-fedora.spec

change form “requires unbound unbound-devel” to “requires unbound”

(I really don’t know where to find the package, I am just too lazy to meet the dependency. : ) )
btw, you need to install “python3-netaddr python3-pyparsing” since version 3.0.0

yum install python3-netaddr python3-pyparsing
rpmbuild -bb --nocheck /root/rpmbuild/SOURCES/openvswitch-3.0.1/rhel/openvswitch-fedora.spec

5. install the desired package from last step

yum install rpmbuild/RPMS/x86_64/openvswitch-2.13.8-1.el9.x86_64.rpm
systemctl list-unit-files | grep openv
systemctl enable --now openvswitch.service 

6.Now you should be able to use Openvswitch as you wish. Enjoy!

Compiling directly on a system is not recommended. RPM’s should be built in mock.

With that being said, dnf install centos-release-nfv-openvswitch will provide the necessary repos needed to install openvswitch.

[root@firemonitor etc]# dnf install centos-release-nfv-openvswitch
Last metadata expiration check: 2:28:49 ago on Mon 31 Oct 2022 08:34:52 PM MST.
Dependencies resolved.
================================================================================================================================================================
 Package                                                 Architecture                    Version                          Repository                       Size
================================================================================================================================================================
Installing:
 centos-release-nfv-openvswitch                          noarch                          1-4.el9                          extras                          7.7 k
Installing dependencies:
 centos-release-nfv-common                               noarch                          1-4.el9                          extras                          7.9 k

Transaction Summary
================================================================================================================================================================
Install  2 Packages

Total download size: 16 k
Installed size: 2.2 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): centos-release-nfv-common-1-4.el9.noarch.rpm                                                                              27 kB/s | 7.9 kB     00:00
(2/2): centos-release-nfv-openvswitch-1-4.el9.noarch.rpm                                                                         26 kB/s | 7.7 kB     00:00
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                            23 kB/s |  16 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                        1/1
  Installing       : centos-release-nfv-common-1-4.el9.noarch                                                                                               1/2
  Installing       : centos-release-nfv-openvswitch-1-4.el9.noarch                                                                                          2/2
  Verifying        : centos-release-nfv-openvswitch-1-4.el9.noarch                                                                                          1/2
  Verifying        : centos-release-nfv-common-1-4.el9.noarch                                                                                               2/2

Installed:
  centos-release-nfv-common-1-4.el9.noarch                                     centos-release-nfv-openvswitch-1-4.el9.noarch

Complete!
[root@firemonitor etc]# dnf search openvswitch
CentOS Stream 9 - NFV OpenvSwitch                                                                                                73 kB/s |  79 kB     00:01
================================================================== Name Matched: openvswitch ===================================================================
centos-release-nfv-openvswitch.noarch : Common release file to establish shared metadata for CentOS NFV SIG
network-scripts-openvswitch2.15.x86_64 : Open vSwitch legacy network service support
network-scripts-openvswitch2.16.x86_64 : Open vSwitch legacy network service support
openvswitch-selinux-extra-policy.noarch : Open vSwitch Extra SELinux Policy
openvswitch2.15.x86_64 : Open vSwitch
openvswitch2.15-devel.x86_64 : Open vSwitch OpenFlow development package (library, headers)
openvswitch2.15-ipsec.x86_64 : Open vSwitch IPsec tunneling support
openvswitch2.15-test.noarch : Open vSwitch testing utilities
openvswitch2.16.x86_64 : Open vSwitch
openvswitch2.16-devel.x86_64 : Open vSwitch OpenFlow development package (library, headers)
openvswitch2.16-ipsec.x86_64 : Open vSwitch IPsec tunneling support
openvswitch2.16-test.noarch : Open vSwitch testing utilities
openvswitch2.17.x86_64 : Open vSwitch
openvswitch2.17-devel.x86_64 : Open vSwitch OpenFlow development package (library, headers)
openvswitch2.17-ipsec.x86_64 : Open vSwitch IPsec tunneling support
openvswitch2.17-test.noarch : Open vSwitch testing utilities
pcp-pmda-openvswitch.x86_64 : Performance Co-Pilot (PCP) metrics for Open vSwitch
python3-openvswitch2.15.x86_64 : Open vSwitch python3 bindings
python3-openvswitch2.16.x86_64 : Open vSwitch python3 bindings
python3-openvswitch2.17.x86_64 : Open vSwitch python3 bindings
1 Like

I didn’t know there’s this tool. Thanks for your instruction.
I’d love to know the reason why building on system directly is not recommended.

works perfectly, thanks! I’m trying now to configure ovn for lxd :slight_smile: