Installation from the Source Code Package
In this document, /open-vswitch/ is used as the path for storing the downloaded and decompressed files.
- Obtain the source code package.
- Method 1: Obtain the source code package by running the git command.
You can select the official code repository of OVS to clone code and switch to the branch of the corresponding version for compilation.
1 2
$ git clone https://github.com/openvswitch/ovs.git $ git checkout v2.12.0
- Method 2: Obtain the compressed source code package.
You can download the code of the release version from the official OVS website.
Version archive path: https://www.openvswitch.org/download/
Version download link: https://www.openvswitch.org/releases/openvswitch-2.12.0.tar.gz
- Method 3: Obtain the compressed source code package.
You can download the compressed
snapshot package of the version code from the official code repository of OVS.Version snapshot address: https://github.com/openvswitch/ovs/releases
Download link: https://github.com/openvswitch/ovs/archive/v2.12.0.zip/https://github.com/openvswitch/ovs/archive/v2.12.0.tar.gz
- Method 1: Obtain the source code package by running the git command.
- (Optional) Set the booting for the code package.
This step is applicable to the scenario where you use method 2 in step 1 to download and decompress the source code package. You need to set the booting for the code package.
1$ ./boot.sh
- Run the configuration script to configure the software compilation package.
- Generally, you can invoke the configuration script without any parameters. By default, all executable files and shared library files are installed in the /usr/local directory. In addition, the OVS software searches for the database files in the /usr/local/etc/openvswitch directory.
- For you need to customize parameters, see Command Reference for Compiling Configuration Scripts.
To keep the source code path clean, create an independent build directory for configuration and compilation.
1 2
$ mkdir -p build && cd build $ ../configure
- Compile the components.
1$ make -j4
After the compilation dependency installation and compilation configuration are complete, run GNU make in the build directory to compile the components. The figure below shows the build directory after the compilation is complete.

- (Optional) Compile the RPM package.
If you need to compile an RPM or DEB package (CentOS RPM package is used as an example) for installation on other nodes, run the following command to pack the RPM package. After the packaging is complete, the RPM package is generated in the rpmbuild directory, as shown in the figure below.
1 2
$ make rpm-fedora $ make rpm-fedora-kmod

- Install components.
1$ make install
If you recompile and build the kernel module, you need to install, load, and check the kernel module.
1 2 3
$ make modules_install $ /sbin/modprobe openvswitch $ /sbin/lsmod | grep openvswitch