首先要安装rpmbuild工具和初始化rpmbuild的工作目录:
yum install -y rpm-build
rpmbuild -ba isulad.spec
第二条命令会出错退出, 但是这条命令只是为了创建rpmbuild的工作目录, 执行后可以发现在当前用户默认工作目录下出现了rpmbuild目录。
进入rpmbuild工作目录, 可以发现有如下子目录:
$ ls ~/rpmbuild
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
源码放在SOURCES
目录下, 用于构建的SPEC文件放在SPECS
下, 构建完成的包会放在RPMS
下。
dnf install -y patch automake autoconf libtool cmake make libcap libcap-devel libselinux libselinux-devel libseccomp libseccomp-devel git libcgroup tar python3 python3-pip libcurl-devel zlib-devel glibc-headers openssl-devel gcc gcc-c++ systemd-devel systemd-libs golang libtar && \
dnf --enablerepo=powertools install -y yajl-devel device-mapper-devel && \
dnf install -y epel-release && \
dnf --enablerepo=powertools install libuv-devel &&\
dnf install libwebsockets-devel
使用这些命令用centos上的包管理器安装一些基础依赖。
dnf --enablerepo=powertools install -y docbook2X doxygen && \
dnf install -y bash-completion chrpath rsync
先下载lxc源码
git clone https://gitee.com/src-openeuler/lxc.git
之后把所需要的源码,patch, spec放到rpmbuild工作目录:
export RPM=~/rpmbuild
cd lxc
cp *.patch *.tar.gz $RPM/SOURCES/ && \
cp *.spec $RPM/SPECS/
cd ~/rpmbuild/SPECS
rpmbuild -ba lxc.spec
构建成功后,rpm包会放在rpmbuild工作目录中的RPM目录中, 可以找到对应的lxc rpm包然后用rpm -Uvh
命令安装
cd ~/rpmbuild/RPMS/x86_64
dnf install -y yajl-2.1.0-10.el8.x86_64 rsync-3.1.3-12.el8.x86_64
rpm -Uvh lxc-libs-4.0.3-2022072501.x86_64.rpm
rpm -Uvh lxc-4.0.3-2022072501.x86_64.rpm
dnf --enablerepo=powertools install -y gtest-devel
注意: 安装lcr之前需要先安装上一步构建的lxc。
先下载lcr源码
git clone https://gitee.com/openeuler/lcr
之后把源码打包,最后把所需要的源码,patch, spec放到rpmbuild工作目录:
export RPM=~/rpmbuild
cd lcr
tar -zcvf lcr-2.0.tar.gz *
cp lcr-2.0.tar.gz $RPM/SOURCES/
cp *.spec $RPM/SPECS/
cd ~/rpmbuild/SPECS
rpmbuild -ba lcr.spec
构建成功后, rpm包会放在rpmbuild工作目录中的RPM目录中, 可以找到对应的rpm包然后用rpm -Uvh
命令安装
rpm -Uvh lcr-2.1.0-2.x86_64.rpm
rpm -Uvh lcr-devel-2.1.0-2.x86_64.rpm
dnf --enablerepo=powertools install -y gmock-devel
首先先下载lclibcni源码,之后把源码打包,最后把所需要的源码,patch, spec放到rpmbuild工作目录:
git clone https://gitee.com/openeuler/clibcni
cd clicni
tar -zcvf clibcni-2.0.tar.gz *
cp clibcni-2.0.tar.gz $RPM/SOURCES/
cp *.spec $RPM/SPECS/
cd ~/rpmbuild/SPECS
rpmbuild -ba clibcni.spec
构建成功后, rpm包会放在rpmbuild工作目录中的RPM目录中, 可以找到对应的rpm包然后用rpm -Uvh
命令安装
yum install -y emacs.x86_64
git clone https://gitee.com/src-openeuler/protobuf
cd protobuf
git checkout openEuler-20.03-LTS
cp *.tar.gz *.el *.patch $RPM/SOURCES/ && cp *.spec $RPM/SPECS/
由于isulad不需要编译java和python的protobuf, 所以可以修改spec文件最开始的5行从而避免安装相关的依赖:
cd ~/rpmbuild/SPECS
vim protobuf.spec
%bcond_with python
%bcond_with java
rpmbuild -ba protobuf.spec
构建成功后, rpm包会放在rpmbuild工作目录中的RPM目录中, 可以找到对应的rpm包然后用rpm -Uvh
命令安装
rpm -Uvh protobuf-3.14.0-4.x86_64.rpm
dnf install -y emacs-26.1-7.el8.x86_64
rpm -Uvh protobuf-compiler-3.14.0-4.x86_64.rpm
rpm -Uvh protobuf-devel-3.14.0-4.x86_64.rpm
yum install -y emacs.x86_64 openssl-devel.x86_64
dnf --enablerepo=powertools install gflags-devel python3-Cython python3-devel
dnf install -y abseil-cpp-devel gperftools-devel re2-devel
git clone https://gitee.com/src-openeuler/grpc
cd grpc
git checkout openEuler-20.03-LTS
cp *.tar.gz $RPM/SOURCES/ && cp *.spec $RPM/SPECS/
rpmbuild -ba grpc.spec
dnf install -y epel-release.noarch c-ares-1.13.0-5.el8.x86_64 gperftools-libs-2.7-9.el8.x86_64
dnf --enablerepo=powertools install gflags-devel
rpm -Uvh grpc-1.31.0-1.x86_64.rpm
dnf install -y openssl-devel.x86_64
rpm -Uvh grpc-devel-1.31.0-1.x86_64.rpm
dnf install -y bzip2-devel e2fsprogs-devel libattr-devel libxml2-devel lz4-devel lzo-devel sharutils libacl-devel
dnf --enablerepo=powertools install sharutils
git clone https://gitee.com/src-openeuler/libarchive
cd libarchive
git checkout openEuler-20.03-LTS
cp *.tar.gz *.patch $RPM/SOURCES/ && cp *.spec $RPM/SPECS/
rpmbuild -ba libarchive.spec
rpm -Uvh libarchive-3.4.3-4.x86_64.rpm
rpm -Uvh libarchive-devel-3.4.3-4.x86_64.rpm
dnf install -y sqlite-devel
首先把源码打包
git clone https://gitee.com/openeuler/iSulad
cd iSulad/
tar -zcvf iSulad-2.1.tar.gz *
cp iSulad-2.1.tar.gz $RPM/SOURCES/
cp *.spec $RPM/SPECS/
rpmbuild -ba iSulad.spec
先安装 libwebsockets:
dnf install -y epel-release
dnf --enablerepo=powertools install libuv-devel
dnf install libwebsockets-devel
再安装isulad:
dnf install -y sqlite-devel.x86_64
rpm -Uvh iSulad-2.1.0-1.x86_64.rpm