> For the complete documentation index, see [llms.txt](https://sdn.feisky.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sdn.feisky.xyz/wang-luo-ji-chu/index-2/build.md).

# OVS编译

## 直接源码编译安装

```bash
export OVS_VERSION="2.6.1"
export OVS_DIR="/usr/src/ovs"
export OVS_INSTALL_DIR="/usr"
curl -sSl http://openvswitch.org/releases/openvswitch-${OVS_VERSION}.tar.gz | tar -xz && mv openvswitch-${OVS_VERSION} ${OVS_DIR}

cd ${OVS_DIR}
./boot.sh
# 如果启用DPDK，还需要加上--with-dpdk=/usr/local/share/dpdk/x86_64-native-linuxapp-gcc
./configure --prefix=${OVS_INSTALL_DIR} --localstatedir=/var --enable-ssl --with-linux=/lib/modules/$(uname -r)/build
make -j `nproc`
make install
make modules_install
```

更新内核模块

```bash
cat > /etc/depmod.d/openvswitch.conf << EOF
override openvswitch * extra
override vport-* * extra
EOF

depmod -a
cp debian/openvswitch-switch.init /etc/init.d/openvswitch-switch
/etc/init.d/openvswitch-switch force-reload-kmod
```

## 编译RPM包

```bash
make rpm-fedora RPMBUILD_OPT="--without check"
```

启用DPDK

```bash
make rpm-fedora RPMBUILD_OPT="--with dpdk --without check"
```

编译内核模块

```bash
make rpm-fedora-kmod
```

## 编译deb包

```bash
apt-get install build-essential fakeroot
dpkg-checkbuilddeps
# 已经编译过，需要首先clean
# fakeroot debian/rules clean
DEB_BUILD_OPTIONS='parallel=8 nocheck' fakeroot debian/rules binary
```

## 参考文档

* <http://docs.openvswitch.org/en/latest/intro/install/>
* <http://docs.openvswitch.org/en/latest/intro/install/debian/>
* <http://docs.openvswitch.org/en/latest/intro/install/dpdk/>
* <http://docs.openvswitch.org/en/latest/intro/install/general/#hot-upgrading>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sdn.feisky.xyz/wang-luo-ji-chu/index-2/build.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
