2 Licensed under the Apache License, Version 2.0 (the "License"); you may
3 not use this file except in compliance with the License. You may obtain
4 a copy of the License at
6 http://www.apache.org/licenses/LICENSE-2.0
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11 License for the specific language governing permissions and limitations
14 Convention for heading levels in Open vSwitch documentation:
16 ======= Heading 0 (reserved for the title in a document)
22 Avoid deeper levels because they do not render well.
24 ========================================
25 RHEL 5.6, 6.x Packaging for Open vSwitch
26 ========================================
28 This document describes how to build and install Open vSwitch on a Red Hat
29 Enterprise Linux (RHEL) host. If you want to install Open vSwitch on a generic
30 Linux host, refer to :doc:`general` instead.
32 We have tested these instructions with RHEL 5.6 and RHEL 6.0.
34 For RHEL 7.x (or derivatives, such as CentOS 7.x), you should follow the
35 instructions in the :doc:`fedora`. The Fedora spec files are used for RHEL
38 .. _rhel-prerequisites:
43 You may build from an Open vSwitch distribution tarball or from an Open vSwitch
46 The default RPM build directory, ``_topdir``, has five directories in the
50 where the software is unpacked and built
52 where the newly created binary package files are written
54 contains the original sources, patches, and icon files
56 contains the spec files for each package to be built
58 where the newly created source package files are written
60 Before you begin, note the RPM sources directory on your version of RHEL. The
61 command ``rpmbuild --showrc`` will show the configuration for each of those
62 directories. Alternatively, the command ``rpm --eval '%{_topdir}'`` shows the
63 current configuration for the top level directory and the command ``rpm --eval
64 '%{_sourcedir}'`` does the same for the sources directory. On RHEL 5, the
65 default RPM ``_topdir`` is ``/usr/src/redhat`` and the default RPM sources
66 directory is ``/usr/src/redhat/SOURCES``. On RHEL 6, the default ``_topdir`` is
67 ``$HOME/rpmbuild`` and the default RPM sources directory is
68 ``$HOME/rpmbuild/SOURCES``.
73 You will need to install all required packages to build the RPMs.
74 The command below will install RPM tools and generic build dependencies::
76 $ yum install @'Development Tools' rpm-build yum-utils
78 Then it is necessary to install Open vSwitch specific build dependencies.
79 The dependencies are listed in the SPEC file, but first it is necessary
80 to replace the VERSION tag to be a valid SPEC.
82 The command below will create a temporary SPEC file::
84 $ sed -e 's/@VERSION@/0.0.1/' rhel/openvswitch.spec.in > /tmp/ovs.spec
86 And to install specific dependencies, use yum-builddep tool::
88 $ yum-builddep /tmp/ovs.spec
90 Once that is completed, remove the file ``/tmp/ovs.spec``.
92 If python3-sphinx package is not available in your version of RHEL, you can
93 install it via pip with 'pip install sphinx'.
95 Open vSwitch requires python 3.4 or newer which is not available in older
96 distributions. In the case of RHEL 6.x and its derivatives, one option is
97 to install python34 from `EPEL`_.
99 .. _EPEL: https://fedoraproject.org/wiki/EPEL
101 .. _rhel-bootstrapping:
103 Bootstrapping and Configuring
104 -----------------------------
106 If you are building from a distribution tarball, skip to :ref:`rhel-building`.
107 If not, you must be building from an Open vSwitch Git tree. Determine what
108 version of Autoconf is installed (e.g. run ``autoconf --version``). If it is
109 not at least version 2.63, then you must upgrade or use another machine to
112 Assuming all requirements have been met, build the tarball by running::
118 You must run this on a machine that has the tools listed in
119 :ref:`general-build-reqs` as prerequisites for building from a Git tree.
120 Afterward, proceed with the rest of the instructions using the distribution
123 Now you have a distribution tarball, named something like
124 ``openvswitch-x.y.z.tar.gz``. Copy this file into the RPM sources directory,
127 $ cp openvswitch-x.y.z.tar.gz $HOME/rpmbuild/SOURCES
129 Broken ``build`` symlink
130 ~~~~~~~~~~~~~~~~~~~~~~~~
132 Some versions of the RHEL 6 kernel-devel package contain a broken ``build``
133 symlink. If you are using such a version, you must fix the problem before
136 To find out whether you are affected, run::
138 $ cd /lib/modules/<version>
141 where ``<version>`` is the version number of the RHEL 6 kernel.
144 The trailing slash in the final command is important. Be sure to include
147 If the ``ls`` command produces a directory listing, your kernel-devel package
148 is OK. If it produces a ``No such file or directory`` error, your kernel-devel
151 If your kernel-devel package is buggy, then you can fix it with::
153 $ cd /lib/modules/<version>
155 $ ln -s /usr/src/kernels/<target> build
157 where ``<target>`` is the name of an existing directory under
158 ``/usr/src/kernels``, whose name should be similar to ``<version>`` but may
159 contain some extra parts. Once you have done this, verify the fix with the
160 same procedure you used above to check for the problem.
167 You should have a distribution tarball named something like
168 openvswitch-x.y.z.tar.gz. Copy this file into the RPM sources directory::
170 $ cp openvswitch-x.y.z.tar.gz $HOME/rpmbuild/SOURCES
172 Make another copy of the distribution tarball in a temporary directory. Then
173 unpack the tarball and ``cd`` into its root::
175 $ tar xzf openvswitch-x.y.z.tar.gz
176 $ cd openvswitch-x.y.z
181 To build Open vSwitch userspace, run::
183 $ rpmbuild -bb rhel/openvswitch.spec
185 This produces two RPMs: "openvswitch" and "openvswitch-debuginfo".
187 The above command automatically runs the Open vSwitch unit tests. To disable
188 the unit tests, run::
190 $ rpmbuild -bb --without check rhel/openvswitch.spec
193 If the build fails with ``configure: error: source dir
194 /lib/modules/2.6.32-279.el6.x86_64/build doesn't exist`` or similar, then
195 the kernel-devel package is missing or buggy.
200 On RHEL 6, to build the Open vSwitch kernel module run::
202 $ rpmbuild -bb rhel/kmod-openvswitch-rhel6.spec
204 You might have to specify a kernel version and/or variants, e.g.:
207 -D "kversion 2.6.32-131.6.1.el6.x86_64" \
208 -D "kflavors default debug kdump" \
209 rhel/kmod-openvswitch-rhel6.spec
211 This produces an "kmod-openvswitch" RPM for each kernel variant, in this
212 example: "kmod-openvswitch", "kmod-openvswitch-debug", and
213 "kmod-openvswitch-kdump".
215 .. _rhel-script-integrations:
217 Red Hat Network Scripts Integration
218 -----------------------------------
220 A RHEL host has default firewall rules that prevent any Open vSwitch tunnel
221 traffic from passing through. If a user configures Open vSwitch tunnels like
222 Geneve, GRE, VXLAN, LISP etc., they will either have to manually add iptables
223 firewall rules to allow the tunnel traffic or add it through a startup script
224 Refer to the "enable-protocol" command in the ovs-ctl(8) manpage for more
227 In addition, simple integration with Red Hat network scripts has been
228 implemented. Refer to `README.RHEL.rst`__ in the source tree or
229 /usr/share/doc/openvswitch/README.RHEL.rst in the installed openvswitch package
232 __ https://github.com/openvswitch/ovs/blob/master/rhel/README.RHEL.rst
237 Report problems to bugs@openvswitch.org.