]>
Commit | Line | Data |
---|---|---|
542cc9bb TG |
1 | How to Install Open vSwitch on Red Hat Enterprise Linux |
2 | ======================================================= | |
c434706a BP |
3 | |
4 | This document describes how to build and install Open vSwitch on a Red | |
5 | Hat Enterprise Linux (RHEL) host. If you want to install Open vSwitch | |
9feb1017 | 6 | on a generic Linux host, see [INSTALL.md] instead. |
c434706a BP |
7 | |
8 | We have tested these instructions with RHEL 5.6 and RHEL 6.0. | |
9 | ||
aa7b733f RB |
10 | For RHEL 7.x (or derivatives, such as CentOS 7.x), you should follow |
11 | the instructions in [INSTALL.Fedora.md]. The Fedora spec files are | |
12 | used for RHEL 7.x. | |
13 | ||
c434706a BP |
14 | Building Open vSwitch for RHEL |
15 | ------------------------------ | |
16 | ||
17 | You may build from an Open vSwitch distribution tarball or from an | |
18 | Open vSwitch Git tree. | |
19 | ||
1547f8e3 FL |
20 | The default RPM build directory (_topdir) has five directories in |
21 | the top-level: | |
22 | 1. BUILD/ Where the software is unpacked and built. | |
23 | 2. RPMS/ Where the newly created binary package files are written. | |
24 | 3. SOURCES/ Contains the original sources, patches, and icon files. | |
25 | 4. SPECS/ Contains the spec files for each package to be built. | |
26 | 5. SRPMS/ Where the newly created source package files are written. | |
27 | ||
28 | Before you begin, note the RPM sources directory on your version of | |
3c49da46 | 29 | RHEL. The command "rpmbuild --showrc" will show the configuration |
1547f8e3 FL |
30 | for each of those directories. Alternatively, the command "rpm --eval |
31 | '%{_topdir}'" shows the current configuration for the top level | |
32 | directory and the command "rpm --eval '%{_sourcedir}'" does the same | |
33 | for the sources directory. On RHEL 5, the default RPM _topdir is | |
34 | /usr/src/redhat and the default RPM sources directory is | |
35 | /usr/src/redhat/SOURCES. On RHEL 6, the default _topdir is | |
36 | $HOME/rpmbuild and the default RPM sources directory is | |
37 | $HOME/rpmbuild/SOURCES. | |
c434706a | 38 | |
935cdc95 BP |
39 | 1. Install build prerequisites: |
40 | ||
542cc9bb | 41 | ``` |
935cdc95 BP |
42 | yum install gcc make python-devel openssl-devel kernel-devel graphviz \ |
43 | kernel-debug-devel autoconf automake rpm-build redhat-rpm-config \ | |
44 | libtool | |
542cc9bb | 45 | ``` |
935cdc95 BP |
46 | |
47 | 2. If you are building from a distribution tarball, skip to step 3. | |
48 | Otherwise, you must be building from an Open vSwitch Git tree. | |
49 | Determine what version of Autoconf is installed (e.g. run "autoconf | |
50 | --version"). If it is not at least version 2.63, then you have two | |
6fdbeaa6 BP |
51 | choices: |
52 | ||
0877a018 | 53 | a. Install Autoconf 2.63 or later, one way or another. |
6fdbeaa6 BP |
54 | |
55 | b. Create a distribution tarball on some other machine, by | |
56 | running "./boot.sh; ./configure; make dist" in the Git tree. | |
57 | You must run this on a machine that has the tools listed in | |
9feb1017 TG |
58 | [INSTALL.md] as prerequisites for building from a Git tree. |
59 | Afterward, proceed with the rest of the instructions using | |
542cc9bb | 60 | the distribution tarball. |
6fdbeaa6 | 61 | |
6fdbeaa6 | 62 | 3. Some versions of the RHEL 6 kernel-devel package contain a broken |
8f5cb995 BP |
63 | "build" symlink. If you are using such a version, you must fix |
64 | the problem before continuing. | |
65 | ||
66 | To find out whether you are affected, run: | |
67 | ||
542cc9bb | 68 | ``` |
8f5cb995 BP |
69 | cd /lib/modules/<version> |
70 | ls -l build/ | |
542cc9bb | 71 | ``` |
8f5cb995 | 72 | |
542cc9bb | 73 | where `<version>` is the version number of the RHEL 6 kernel. (The |
8f5cb995 BP |
74 | trailing slash in the final command is important. Be sure to include |
75 | it.) If the "ls" command produces a directory listing, your | |
76 | kernel-devel package is OK. If it produces a "No such file or | |
77 | directory" error, your kernel-devel package is buggy. | |
78 | ||
79 | If your kernel-devel package is buggy, then you can fix it with: | |
80 | ||
542cc9bb | 81 | ``` |
8f5cb995 BP |
82 | cd /lib/modules/<version> |
83 | rm build | |
84 | ln -s /usr/src/kernels/<target> build | |
542cc9bb | 85 | ``` |
8f5cb995 | 86 | |
542cc9bb TG |
87 | where `<target>` is the name of an existing directory under |
88 | /usr/src/kernels, whose name should be similar to `<version>` but may | |
8f5cb995 BP |
89 | contain some extra parts. Once you have done this, verify the fix with |
90 | the same procedure you used above to check for the problem. | |
91 | ||
935cdc95 BP |
92 | 4. If you are building from a distribution tarball, skip to step 5. |
93 | Otherwise, create a distribution tarball from the root of the Git | |
94 | tree by running: | |
95 | ||
542cc9bb | 96 | ``` |
935cdc95 BP |
97 | ./boot.sh |
98 | ./configure | |
99 | make dist | |
542cc9bb | 100 | ``` |
935cdc95 BP |
101 | |
102 | 5. Now you have a distribution tarball, named something like | |
103 | openvswitch-x.y.z.tar.gz. Copy this file into the RPM sources | |
104 | directory, e.g.: | |
105 | ||
542cc9bb | 106 | `cp openvswitch-x.y.z.tar.gz $HOME/rpmbuild/SOURCES` |
c434706a | 107 | |
935cdc95 BP |
108 | 6. Make another copy of the distribution tarball in a temporary |
109 | directory. Then unpack the tarball and "cd" into its root, e.g.: | |
c434706a | 110 | |
542cc9bb | 111 | ``` |
935cdc95 BP |
112 | tar xzf openvswitch-x.y.z.tar.gz |
113 | cd openvswitch-x.y.z | |
542cc9bb | 114 | ``` |
c434706a | 115 | |
6fdbeaa6 | 116 | 7. To build Open vSwitch userspace, run: |
c434706a | 117 | |
542cc9bb | 118 | `rpmbuild -bb rhel/openvswitch.spec` |
c434706a BP |
119 | |
120 | This produces two RPMs: "openvswitch" and "openvswitch-debuginfo". | |
121 | ||
329cf232 GS |
122 | The above command automatically runs the Open vSwitch unit tests. |
123 | To disable the unit tests, run: | |
124 | ||
542cc9bb | 125 | `rpmbuild -bb --without check rhel/openvswitch.spec` |
329cf232 | 126 | |
8f5cb995 BP |
127 | If the build fails with "configure: error: source dir |
128 | /lib/modules/2.6.32-279.el6.x86_64/build doesn't exist" or similar, | |
129 | then the kernel-devel package is missing or buggy. Go back to step | |
130 | 1 or 2 and fix the problem. | |
131 | ||
6fdbeaa6 | 132 | 8. On RHEL 6, to build the Open vSwitch kernel module, copy |
935cdc95 | 133 | rhel/openvswitch-kmod.files into the RPM sources directory and run: |
c434706a | 134 | |
542cc9bb | 135 | `rpmbuild -bb rhel/openvswitch-kmod-rhel6.spec` |
c434706a | 136 | |
935cdc95 | 137 | You might have to specify a kernel version and/or variants, e.g.: |
6c9b8ee4 | 138 | |
542cc9bb | 139 | ``` |
6c9b8ee4 AF |
140 | rpmbuild -bb \ |
141 | -D "kversion 2.6.32-131.6.1.el6.x86_64" \ | |
142 | -D "kflavors default debug kdump" \ | |
143 | rhel/openvswitch-kmod-rhel6.spec | |
542cc9bb | 144 | ``` |
6c9b8ee4 | 145 | |
935cdc95 BP |
146 | This produces an "kmod-openvswitch" RPM for each kernel variant, in |
147 | this example: "kmod-openvswitch", "kmod-openvswitch-debug", and | |
148 | "kmod-openvswitch-kdump". | |
c434706a | 149 | |
f9ee9dcb GS |
150 | A RHEL host has default firewall rules that prevent any Open vSwitch tunnel |
151 | traffic from passing through. If a user configures Open vSwitch tunnels like | |
271e6bc7 JG |
152 | Geneve, GRE, VXLAN, LISP etc., they will either have to manually add iptables |
153 | firewall rules to allow the tunnel traffic or add it through a startup script | |
154 | (Please refer to the "enable-protocol" command in the ovs-ctl(8) manpage). | |
f9ee9dcb | 155 | |
0fb42626 AF |
156 | Red Hat Network Scripts Integration |
157 | ----------------------------------- | |
158 | ||
159 | Simple integration with Red Hat network scripts has been implemented. | |
9feb1017 | 160 | Please read [rhel/README.RHEL] in the source tree or |
0fb42626 AF |
161 | /usr/share/doc/openvswitch/README.RHEL in the installed openvswitch |
162 | package for details. | |
163 | ||
c434706a BP |
164 | Reporting Bugs |
165 | -------------- | |
166 | ||
167 | Please report problems to bugs@openvswitch.org. | |
9feb1017 TG |
168 | |
169 | [INSTALL.md]:INSTALL.md | |
892de3eb | 170 | [INSTALL.Fedora.md]:INSTALL.Fedora.md |
9feb1017 | 171 | [rhel/README.RHEL]:rhel/README.RHEL |