Linux 制作RPM
包一直是不好解决的问题,本文介绍一种基于docker
、Coprs
构建并发布RPM包的方法,并提供在线的rpm下载地址。
前言
- docker 用来制作rpm的打包环境
- Copr 存放RPM包,制品仓库
目录结构
本文以 https://github.com/xiexianbin/tengine-rpm 为例,代码目录结构如下:
## tree tengine-rpm
tengine-rpm # 根目录
├── Dockerfile # 基于 centos:7 的 rpm-build 环境
├── Makefile # 封装好的 makefile,提供镜像制作、rpm发布等功能
├── README.md # 帮助文档
├── SOURCES # 源码文档
│ ├── logrotate
│ ├── tengine.conf
│ ├── tengine.service
│ └── tengine.vh.default.conf
├── SPECS # SPEC 文件
│ └── tengine.spec
└── build.sh # 容器内,打包命令封装,实际使用的需要修改相关 cpor 的描述等信息
2 directories, 9 files
使用
Help
make
help info:
# make help
help Show this help.
build Build Docker image to build rpm.
bash Run /bin/bash in the Docker image to build rpm.
copr Run docker image to build rpm and push srpm to copr.
debug Build Docker image to build rpm and into bash.
Setup
Build docker image
make build
build docker image: xiexianbin/rpm-builder:latest
debug
make bash
into docker /bin/bash, you can debug rpm packages
调试支持如下命令:
Usage:
build.sh [command]
Available Commands:
srpm build srpm package
mock build rpm locally with mock
copr upload the srpm and build rpm on copr
copr
make copr
自动打包,并将srpm发布到copr,触发copr自动打rpm包
YUM 源
dnf copr enable xiexianbin/tengine-rpm
dnf install tengine
sudo curl -sL -o /etc/yum.repos.d/xiexianbin-tengine-rpm-epel-7.repo https://copr.fedorainfracloud.org/coprs/xiexianbin/tengine-rpm/repo/epel-7/xiexianbin-tengine-rpm-epel-7.repo
sudo yum -y install tengine
扩展
类似软件: