]>
Commit | Line | Data |
---|---|---|
5361570f SF |
1 | .. |
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 | |
5 | ||
6 | http://www.apache.org/licenses/LICENSE-2.0 | |
7 | ||
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 | |
12 | under the License. | |
13 | ||
14 | Convention for heading levels in Open vSwitch documentation: | |
15 | ||
16 | ======= Heading 0 (reserved for the title in a document) | |
17 | ------- Heading 1 | |
18 | ~~~~~~~ Heading 2 | |
19 | +++++++ Heading 3 | |
20 | ''''''' Heading 4 | |
21 | ||
22 | Avoid deeper levels because they do not render well. | |
23 | ||
24 | ======================================== | |
25 | Open vSwitch on Red Hat Enterprise Linux | |
26 | ======================================== | |
27 | ||
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, see the `general installation guide <INSTALL.rst>`__ instead. | |
31 | ||
32 | We have tested these instructions with RHEL 5.6 and RHEL 6.0. | |
33 | ||
34 | For RHEL 7.x (or derivatives, such as CentOS 7.x), you should follow the | |
35 | instructions in the `Fedora installation guide <INSTALL.Fedora.rst>`__. The | |
36 | Fedora spec files are used for RHEL 7.x. | |
37 | ||
38 | Prerequisites | |
39 | ------------- | |
40 | ||
41 | You may build from an Open vSwitch distribution tarball or from an Open vSwitch | |
42 | Git tree. | |
43 | ||
44 | The default RPM build directory, ``_topdir``, has five directories in the | |
45 | top-level. | |
46 | ||
47 | BUILD/ | |
48 | where the software is unpacked and built | |
49 | RPMS/ | |
50 | where the newly created binary package files are written | |
51 | SOURCES/ | |
52 | contains the original sources, patches, and icon files | |
53 | SPECS/ | |
54 | contains the spec files for each package to be built | |
55 | SRPMS/ | |
56 | where the newly created source package files are written | |
57 | ||
58 | Before you begin, note the RPM sources directory on your version of RHEL. The | |
59 | command ``rpmbuild --showrc`` will show the configuration for each of those | |
60 | directories. Alternatively, the command ``rpm --eval '%{_topdir}'`` shows the | |
61 | current configuration for the top level directory and the command ``rpm --eval | |
62 | '%{_sourcedir}'`` does the same for the sources directory. On RHEL 5, the | |
63 | default RPM ``_topdir`` is ``/usr/src/redhat`` and the default RPM sources | |
64 | directory is ``/usr/src/redhat/SOURCES``. On RHEL 6, the default ``_topdir`` is | |
65 | ``$HOME/rpmbuild`` and the default RPM sources directory is | |
66 | ``$HOME/rpmbuild/SOURCES``. | |
67 | ||
68 | Build Requirements | |
69 | ------------------ | |
70 | ||
71 | To compile the RPMs, you will need to install the packages described in the | |
72 | `general installation guide <INSTALL.rst>`__ along with some additional | |
73 | packages. These can be installed with the below command:: | |
74 | ||
75 | $ yum install gcc make python-devel openssl-devel kernel-devel graphviz \ | |
76 | kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \ | |
77 | libtool | |
78 | ||
79 | Bootstrapping and Configuring | |
80 | ----------------------------- | |
81 | ||
82 | If you are building from a distribution tarball, skip to *Building*. If not, | |
83 | you must be building from an Open vSwitch Git tree. Determine what version of | |
84 | Autoconf is installed (e.g. run ``autoconf --version``). If it is not at least | |
85 | version 2.63, then you must upgrade or use another machine to build the | |
86 | packages. | |
87 | ||
88 | Assuming all requirements have been met, build the tarball by running:: | |
89 | ||
90 | $ ./boot.sh | |
91 | $ ./configure | |
92 | $ make dist | |
93 | ||
94 | You must run this on a machine that has the tools listed in the `general | |
95 | installation guide <INSTALL.rst>`__ as prerequisites for building from a Git | |
96 | tree. Afterward, proceed with the rest of the instructions using the | |
97 | distribution tarball. | |
98 | ||
99 | Now you have a distribution tarball, named something like | |
100 | ``openvswitch-x.y.z.tar.gz``. Copy this file into the RPM sources directory, | |
101 | e.g.:: | |
102 | ||
103 | $ cp openvswitch-x.y.z.tar.gz $HOME/rpmbuild/SOURCES | |
104 | ||
105 | Broken ``build`` symlink | |
106 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
107 | ||
108 | Some versions of the RHEL 6 kernel-devel package contain a broken ``build`` | |
109 | symlink. If you are using such a version, you must fix the problem before | |
110 | continuing. | |
111 | ||
112 | To find out whether you are affected, run:: | |
113 | ||
114 | $ cd /lib/modules/<version> | |
115 | $ ls -l build/ | |
116 | ||
117 | where ``<version>`` is the version number of the RHEL 6 kernel. | |
118 | ||
119 | .. note:: | |
120 | The trailing slash in the final command is important. Be sure to include | |
121 | it. | |
122 | ||
123 | If the ``ls`` command produces a directory listing, your kernel-devel package | |
124 | is OK. If it produces a ``No such file or directory`` error, your kernel-devel | |
125 | package is buggy. | |
126 | ||
127 | If your kernel-devel package is buggy, then you can fix it with:: | |
128 | ||
129 | $ cd /lib/modules/<version> | |
130 | $ rm build | |
131 | $ ln -s /usr/src/kernels/<target> build | |
132 | ||
133 | where ``<target>`` is the name of an existing directory under | |
134 | ``/usr/src/kernels``, whose name should be similar to ``<version>`` but may | |
135 | contain some extra parts. Once you have done this, verify the fix with the | |
136 | same procedure you used above to check for the problem. | |
137 | ||
138 | Building | |
139 | -------- | |
140 | ||
141 | You should have a distribution tarball named something like | |
142 | openvswitch-x.y.z.tar.gz. Copy this file into the RPM sources directory:: | |
143 | ||
144 | $ cp openvswitch-x.y.z.tar.gz $HOME/rpmbuild/SOURCES | |
145 | ||
146 | Make another copy of the distribution tarball in a temporary directory. Then | |
147 | unpack the tarball and ``cd`` into its root:: | |
148 | ||
149 | $ tar xzf openvswitch-x.y.z.tar.gz | |
150 | $ cd openvswitch-x.y.z | |
151 | ||
152 | Userspace | |
153 | ~~~~~~~~~ | |
154 | ||
155 | To build Open vSwitch userspace, run:: | |
156 | ||
157 | $ rpmbuild -bb rhel/openvswitch.spec | |
158 | ||
159 | This produces two RPMs: "openvswitch" and "openvswitch-debuginfo". | |
160 | ||
161 | The above command automatically runs the Open vSwitch unit tests. To disable | |
162 | the unit tests, run:: | |
163 | ||
164 | $ rpmbuild -bb --without check rhel/openvswitch.spec | |
165 | ||
166 | .. note:: | |
167 | If the build fails with ``configure: error: source dir | |
168 | /lib/modules/2.6.32-279.el6.x86_64/build doesn't exist`` or similar, then | |
169 | the kernel-devel package is missing or buggy. | |
170 | ||
171 | Kernel Module | |
172 | ~~~~~~~~~~~~~ | |
173 | ||
174 | On RHEL 6, to build the Open vSwitch kernel module, copy | |
175 | rhel/openvswitch-kmod.files into the RPM sources directory and run:: | |
176 | ||
177 | $ rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec | |
178 | ||
179 | You might have to specify a kernel version and/or variants, e.g.: | |
180 | ||
181 | $ rpmbuild -bb \ | |
182 | -D "kversion 2.6.32-131.6.1.el6.x86_64" \ | |
183 | -D "kflavors default debug kdump" \ | |
184 | rhel/openvswitch-kmod-rhel6.spec | |
185 | ||
186 | This produces an "kmod-openvswitch" RPM for each kernel variant, in this | |
187 | example: "kmod-openvswitch", "kmod-openvswitch-debug", and | |
188 | "kmod-openvswitch-kdump". | |
189 | ||
190 | Red Hat Network Scripts Integration | |
191 | ----------------------------------- | |
192 | ||
193 | A RHEL host has default firewall rules that prevent any Open vSwitch tunnel | |
194 | traffic from passing through. If a user configures Open vSwitch tunnels like | |
195 | Geneve, GRE, VXLAN, LISP etc., they will either have to manually add iptables | |
196 | firewall rules to allow the tunnel traffic or add it through a startup script | |
197 | Refer to the "enable-protocol" command in the ovs-ctl(8) manpage for more | |
198 | information. | |
199 | ||
200 | In addition, simple integration with Red Hat network scripts has been | |
201 | implemented. Refer to `README.RHEL.rst <rhel/README.RHEL.rst>`__ in the source | |
202 | tree or /usr/share/doc/openvswitch/README.RHEL.rst in the installed openvswitch | |
203 | package for details. | |
204 | ||
205 | Reporting Bugs | |
206 | -------------- | |
207 | ||
208 | Report problems to bugs@openvswitch.org. |