# 基于最新的代码构建rpm包
# 基于centos8.1
# 替换为阿里源 这次测试官方源有问题 会卡在adebe rpm包上
mv CentOS-Base.repo CentOS-Base.repo.bak
mv CentOS-Extras.repo CentOS-Extras.repo.bak
mv CentOS-centosplus.repo CentOS-centosplus.repo.bak
mv CentOS-PowerTools.repo CentOS-PowerTools.repo.bak
mv CentOS-AppStream.repo CentOS-AppStream.re
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
yum clean all
yum makecache
# 依赖
yum info epel-release
yum config-manager --set-enabled PowerTools
dnf install groff python3-sphinx
dnf install wget openssl-devel python3-six gcc make python3-devel openssl-devel kernel-devel graphviz kernel-debug-devel autoconf automake rpm-build redhat-rpm-config libtool python3-zope-interface desktop-file-utils libcap-ng-devel groff checkpolicy selinux-policy-devel -y
dnf install gcc-c++ unbound unbound-devel -y
# 基于源码编译
git clone github.com:/ovs.git
cd ovs/
git checkout branch-2.13
./boot.sh
# 为了保持源码路径干净,创建一个独立的build目录来进行配置和编译
mkdir -p build && cd build
# 配置
../configure
# 编译组件
make -j4
# 编译为RPM包
make rpm-fedora
# make rpm-fedora RPMBUILD_OPT="--without check"
[root@zbb-c8 build]# find . -name *.rpm
# 编译内核模块
# 应该不需要执行 目前有依赖问题
make rpm-fedora-kmod
# 启用DPDK
make rpm-fedora RPMBUILD_OPT="--with dpdk --without check"
[root@zbb-c8 ovs]# pwd
/root/ovs
[root@zbb-c8 ovs]# find . -name *.rpm
./build/rpm/rpmbuild/RPMS/x86_64/openvswitch-2.13.4-1.el8.x86_64.rpm
./build/rpm/rpmbuild/RPMS/x86_64/openvswitch-devel-2.13.4-1.el8.x86_64.rpm
./build/rpm/rpmbuild/RPMS/x86_64/network-scripts-openvswitch-2.13.4-1.el8.x86_64.rpm
./build/rpm/rpmbuild/RPMS/x86_64/openvswitch-ipsec-2.13.4-1.el8.x86_64.rpm
./build/rpm/rpmbuild/RPMS/x86_64/openvswitch-debugsource-2.13.4-1.el8.x86_64.rpm
./build/rpm/rpmbuild/RPMS/x86_64/openvswitch-debuginfo-2.13.4-1.el8.x86_64.rpm
./build/rpm/rpmbuild/RPMS/noarch/openvswitch-selinux-policy-2.13.4-1.el8.noarch.rpm
./build/rpm/rpmbuild/RPMS/noarch/python3-openvswitch-2.13.4-1.el8.noarch.rpm
./build/rpm/rpmbuild/RPMS/noarch/openvswitch-test-2.13.4-1.el8.noarch.rpm
./build/rpm/rpmbuild/SRPMS/openvswitch-2.13.4-1.el8.src.rpm
*.src.rpm 源程序包
*.noarch.rpm 可以在不同cpu上使用
.i86.rpm 参照上文
*.athlon.rpm 在AMD系统上更好发挥AMD cpu性能
网友评论