In this tutorial we will cover step-by-step procedure of compiling Open vSwitch (OVS) from source code on Rocky Linux, AlmaLinux, RHEL 9/8, and any other flavor of RHEL Linux. Open vSwitch a multilayer, and open-source virtual switch designed for high-performance and advanced network automation in virtualized environments. It has support for advanced networking features like GRE/VXLAN tunneling, VLANs, traffic shaping, and OpenFlow traffic-based control.
In the previous post, we walked through the procedure of building Open vSwitch from source on Debian and Ubuntu systems. In this article, we’ll shift focus to building it on RHEL-based Linux distributions. Ensure that the current OS doesn’t have OVS installed either from OS packages or build earlier. If it exist you need to remove it prior to proceeding with the build.
1. Install required build dependencies
Update your system if possible:
sudo dnf -y update
Enable extra repositories:
- Rocky Linux / AlmaLinux 9:
sudo dnf -y install epel-release
sudo dnf config-manager --set-enabled crb
- Rocky Linux / AlmaLinux 8:
sudo dnf -y install epel-release
sudo dnf config-manager --set-enabled powertools
- RHEL 9:
subscription-manager repos --enable=codeready-builder-for-rhel-9-x86_64-rpms
- RHEL 8:
subscription-manager repos --enable=codeready-builder-for-rhel-8-x86_64-rpms
Install all the dependencies needed to build Open vSwitch from source:
sudo dnf -y install "@Development Tools"
sudo dnf -y install gcc make python3-devel openssl-devel \
kernel-devel kernel-debug-devel rpm-build desktop-file-utils \
groff-base libcap-ng-devel numactl-devel selinux-policy-devel \
systemtap-sdt-devel unbound-devel unbound python3-sphinx \
libbpf-devel libxdp-devel groff network-scripts
2. Download Open vSwitch tarball
Visit Open vSwitch downloads page and select the version you want to install. Download from CLI can also be done using wget
or curl
utilities.
Set the version to download as variable VER
:
VER=3.5.0
Download the tarball:
wget https://www.openvswitch.org/releases/openvswitch-$VER.tar.gz
Extract the downloaded file:
tar xvf openvswitch-$VER.tar.gz
3. Build Open vSwitch packages
Navigate to the folder created after extraction:
cd openvswitch-$VER
Run the boot.sh
script to initiate build process:
./boot.sh
Run configure command
./configure
To compile the Open vSwitch user-space RPM packages, run the following command:
make rpm-fedora
To enable DPDK support in the Open vSwitch package, include the --with-dpdk
option during the build process:
make rpm-fedora RPMBUILD_OPT="--with dpdk --without check"
Include the --with-afxdp
option during the build process to enable AF_XDP support:
make rpm-fedora RPMBUILD_OPT="--with afxdp --without check"
4. Install Open vSwitch RPM Packages
Move to the rpmbuild directory:
cd rpm/rpmbuild/RPMS/x86_64
List all .rpm
packages:
$ ls -lh
total 10M
-rw-r--r--. 1 root root 9.6K Apr 16 00:05 network-scripts-openvswitch-3.5.0-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 2.1M Apr 16 00:05 openvswitch-3.5.0-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 5.5M Apr 16 00:05 openvswitch-debuginfo-3.5.0-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 2.3M Apr 16 00:05 openvswitch-debugsource-3.5.0-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 139K Apr 16 00:05 openvswitch-devel-3.5.0-1.el8.x86_64.rpm
-rw-r--r--. 1 root root 20K Apr 16 00:05 openvswitch-ipsec-3.5.0-1.el8.x86_64.rpm
Install openvswitch RPM package:
$ sudo rpm -Uvh openvswitch-$VER-1.*.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:openvswitch-3.5.0-1.el8 ################################# [100%]
Install network scripts package:
$ sudo rpm -Uvh network-scripts-openvswitch-$VER-1.*.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:network-scripts-openvswitch-3.5.0################################# [100%]
If you need Open vSwitch development tools, install the devel package.
$ sudo rpm -Uvh openvswitch-devel-$VER-1.*.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:openvswitch-devel-3.5.0-1.el8 ################################# [100%]
5. Start Open vSwitch services
Start Open vSwitch service and set it to start automatically.
sudo systemctl enable --now openvswitch
Check Open vSwitch service status, it should be active:
$ systemctl status openvswitch.service
● openvswitch.service - Open vSwitch
Loaded: loaded (/usr/lib/systemd/system/openvswitch.service; enabled; vendor preset: disabled)
Active: active (exited) since Wed 2025-04-16 00:17:18 EAT; 5s ago
Process: 93926 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 93926 (code=exited, status=0/SUCCESS)
Apr 16 00:17:18 rocky01.cloudspinx.com systemd[1]: Starting Open vSwitch...
Apr 16 00:17:18 rocky01.cloudspinx.com systemd[1]: Started Open vSwitch.
The command above will start other OVS services:
systemctl status ovs-vswitchd ovsdb-server
Log out of your current shell session, then log back in:
logout
Run the ovs-vsctl show
command to verify the Open vSwitch (OVS) version:
$ ovs-vsctl show
8d2d42ed-88e7-45bc-b2d2-eb43e25763b1
ovs_version: "3.5.0-1.el8"
Useful Links: