Open vSwitch (OVS) is an open source virtual switch widely adopted in network virtualization. OVS is popular in platforms like OpenStack, and software-defined networking (SDN) solutions. While most Linux distros provide precompiled Open vSwitch packages, building from source enables you to use custom version, alter build options, or introduce custom patches. In this article, we help you acquire valuable skill by building Open vSwitch from source on Ubuntu or Debian Linux machine.
Use the following steps to build and install Open vSwitch from source on Debian or Ubuntu. For RHEL-based systems, check out the guide – Building Open vSwitch on RHEL-based systems.
1. Install Dependencies
Refresh the package list by running:
sudo apt update
Execute the commands below to install all the dependencies required to build Open vSwitch:
sudo apt install build-essential fakeroot autoconf automake \
bzip2 debhelper-compat dh-exec dh-python dh-sequence-python3 \
graphviz iproute2 libcap-ng-dev libdbus-1-dev libdpdk-dev \
libnuma-dev libpcap-dev libssl-dev libtool libunbound-dev \
openssl pkg-config procps python3-all-dev python3-setuptools \
python3-sortedcontainers python3-sphinx dh-sequence-sphinxdoc
After installing all dependencies, proceed to download OVS archive.
2. Download Open vSwitch tar archive
Visit Open vSwitch releases page to download the latest release. You could also download it from CLI:
RELEASE=3.5.0
wget https://www.openvswitch.org/releases/openvswitch-$RELEASE.tar.gz
Extract downloaded archive file:
tar xvf openvswitch-$RELEASE.tar.gz
Go to the extracted binary folder:
cd openvswitch-$RELEASE
3. Build Open vSwitch from source
Execute the boot.sh
script:
./boot.sh
Next, run the configure script to generate the Makefile. It will also check for any missing dependencies:
./configure && make debian
Run the command dpkg-checkbuilddeps
from the top-level directory of your OVS source to verify all build dependencies are satisfied.
dpkg-checkbuilddeps
If you’ve the dependencies installed properly, the command will exit without printing anything. The output will indicate any missing packages you need to install.
Run the following command in the root directory of your project to generate installation package:
make debian-deb
Move up one level from your current working directory:
cd ../
List all .deb
packages:
$ ls -lh *.deb
-rw-r--r-- 1 root root 1020K Apr 14 23:13 openvswitch-common_3.5.0-1_amd64.deb
-rw-r--r-- 1 root root 1.1M Apr 14 23:13 openvswitch-doc_3.5.0-1_all.deb
-rw-r--r-- 1 root root 38K Apr 14 23:13 openvswitch-ipsec_3.5.0-1_amd64.deb
-rw-r--r-- 1 root root 24K Apr 14 23:13 openvswitch-pki_3.5.0-1_all.deb
-rw-r--r-- 1 root root 8.9M Apr 14 23:13 openvswitch-source_3.5.0-1_all.deb
-rw-r--r-- 1 root root 1.6M Apr 14 23:13 openvswitch-switch_3.5.0-1_amd64.deb
-rw-r--r-- 1 root root 84K Apr 14 23:13 openvswitch-test_3.5.0-1_all.deb
-rw-r--r-- 1 root root 302K Apr 14 23:13 openvswitch-testcontroller_3.5.0-1_amd64.deb
-rw-r--r-- 1 root root 224K Apr 14 23:13 openvswitch-vtep_3.5.0-1_amd64.deb
-rw-r--r-- 1 root root 293K Apr 14 23:13 python3-openvswitch_3.5.0-1_amd64.deb
4. Install generated .deb files
Install Kernel modules:
sudo apt install dkms linux-headers-$(uname -r)
Install openvswitch-common
package:
$ sudo dpkg -i ./openvswitch-common_${RELEASE}-1_amd64.deb
Selecting previously unselected package openvswitch-common.
(Reading database ... 84849 files and directories currently installed.)
Preparing to unpack .../openvswitch-common_3.5.0-1_amd64.deb ...
Unpacking openvswitch-common (3.5.0-1) ...
Setting up openvswitch-common (3.5.0-1) ...
Processing triggers for man-db (2.12.0-4build2) ...
Next, install the openvswitch-switch Debian package:
$ sudo dpkg -i ./openvswitch-switch_${RELEASE}-1_amd64.deb
Selecting previously unselected package openvswitch-switch.
(Reading database ... 84905 files and directories currently installed.)
Preparing to unpack .../openvswitch-switch_3.5.0-1_amd64.deb ...
Unpacking openvswitch-switch (3.5.0-1) ...
Setting up openvswitch-switch (3.5.0-1) ...
update-alternatives: using /usr/lib/openvswitch-switch/ovs-vswitchd to provide /usr/sbin/ovs-vswitchd (ovs-vswitchd) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/openvswitch-switch.service → /usr/lib/systemd/system/openvswitch-switch.service.
Created symlink /etc/systemd/system/openvswitch-switch.service.requires/ovs-record-hostname.service → /usr/lib/systemd/system/ovs-record-hostname.service.
ovs-vswitchd.service is a disabled or a static unit, not starting it.
ovsdb-server.service is a disabled or a static unit, not starting it.
Processing triggers for man-db (2.12.0-4build2) ...
Optionally, install the documentation package:
$ sudo dpkg -i openvswitch-doc_${RELEASE}-1_all.deb
Selecting previously unselected package openvswitch-doc.
(Reading database ... 84952 files and directories currently installed.)
Preparing to unpack openvswitch-doc_3.5.0-1_all.deb ...
Unpacking openvswitch-doc (3.5.0-1) ...
Setting up openvswitch-doc (3.5.0-1) ...
Check Open vSwitch service status, it should be running:
$ systemctl status openvswitch-switch.service
● openvswitch-switch.service - Open vSwitch
Loaded: loaded (/usr/lib/systemd/system/openvswitch-switch.service; enabled; preset: enabled)
Active: active (exited) since Mon 2025-04-14 23:21:20 EAT; 26min ago
Process: 41444 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 41444 (code=exited, status=0/SUCCESS)
CPU: 1ms
Apr 14 23:21:20 ubuntu-noble01.cloudspinx.com systemd[1]: Starting openvswitch-switch.service - Open vSwitch...
Apr 14 23:21:20 ubuntu-noble01.cloudspinx.com systemd[1]: Finished openvswitch-switch.service - Open vSwitch.
5. Using OVS CLI tools
Logout of the active shell session, then back in:
logout
Run ovs-vsctl show
command to check version of OVS:
$ ovs-vsctl show
ebcb1dfd-84c2-4e53-8916-f43beea78e01
ovs_version: "3.5.0"
References: