当前位置:网站首页>rpm2rpm 打包步骤
rpm2rpm 打包步骤
2022-06-30 12:13:00 【Erik_ly】
本文主要介绍将 rpm 包解压后,修改里面的文件,然后重新打包成 rpm 的过程。
准备环境
- 安装rpm-build包
yum install rpm-build -y
- 安装rpmdevtools
yum install rpmdevtools -y
- 创建工作空间
rpmdev-setuptree
查看工作目录

- 创建 BUILDROOT目录
mkdir /root/rpmbuild/BUILDROOT
完整目录结构

解压 rpm 包
- 复制文件
复制需要修改的 rpm 包至 /root/rpmbuild/BUILDROOT/ 目录,

- 解压 rpm 包
cd /root/rpmbuild/BUILDROOT
rpm2cpio zookeeper_3_0_1_0_187-3.4.6.3.0.1.0-187.noarch.rpm | cpio -idv
- 提取 spec 文件
rpmrebuild --package --notest-install --spec-only=zookeeper.spec zookeeper_3_0_1_0_187-3.4.6.3.0.1.0-187.noarch.rpm
注:这里用到了rpmrebuild工具,具体可查看:使用rpmrebuild从rpm包中提取spec文件,有下载链接和使用方法。
- 移动 SPEC 文件
mv zookeeper.spec /root/rpmbuild/SPECS/
- 删除原 rpm 包
rm -rf zookeeper_3_0_1_0_187-3.4.6.3.0.1.0-187.noarch.rpm
修改内容
查看解压后的文件内容,

按自己需要进行修改,
- 如果只是需要替换同名文件,则直接进行替换即可;
- 如果需要增加文件或文件夹,则需要在
zookeeper.spec中按原有格式添加文件或文件夹; - 如果需要删除文件或文件夹,也需要在
zookeeper.spec中删除相应的文件或文件夹。 - 如果修改的文件较多,也可以将原有的
%files内容改为
%files
%defattr(-,root,root,-)
/usr/hdp/3.0.1.0-187
重新打 rpm 包
修改好文件后,重新打包成 rpm 文件,
cd /root/rpmbuild/SPECS
rpmbuild -ba --buildroot /root/rpmbuild/BUILDROOT/ zookeeper.spec

执行完成后在 /root/rpmbuild/RPMS 目录中查看新的 rpm 包

注:本文首发于个人博客网站: http://www.erik-ly.com/
边栏推荐
- Mysql中 begin..end使用遇到的坑
- Getting started with the go language is simple: go handles XML files
- Redis-緩存問題
- SQLSERVER 查询编码是 936 简体中文GBK,那我是写936 还是写GBK?
- 图解使用Navicat for MySQL创建存储过程
- MySQL built-in functions
- NoSQL - redis configuration and optimization
- Double dqn notes
- Redis的基本操作的命令
- Clipboardjs - development learning summary 1
猜你喜欢

How to detect 3D line spectral confocal sensors in semiconductors

How do different types of variables compare with zero

【一天学awk】运算符

SuperMap 3D SDKs_ Unity plug-in development - connect data services for SQL queries

Solve the problem that the server cannot be connected via SSH during reinstallation

Android development interview real question advanced version (with answer analysis)

Ensemble de cartes

ES6新特性介绍

MySQL composite query

SuperMap iclient3d for webgl loading TMS tiles
随机推荐
Inner join and outer join of MySQL tables
Substrate 源码追新导读: 5月中旬: Uniques NFT模块和Nomination Pool
Swagger2 automatically generates API documents
Clipboardjs - development learning summary 1
Sword finger offer 05 Replace spaces: replace each space in the string s with "%20"“
【MySQL】MySQL的安装与配置
Some commonly used hardware information of the server (constantly updated)
Q-learning notes
How to select an OLAP database engine?
MySql实现两个查询结果相除
60 divine vs Code plug-ins!!
Why should offline stores do new retail?
JMeter性能测试之相关术语及性能测试通过标准
立创 EDA #学习笔记10# | 常用连接器元器件识别 和 无源蜂鸣器驱动电路
Grep match lookup
Double dqn notes
杂文:自家的智能家居方案研究
7 lightweight and easy-to-use tools to relieve pressure and improve efficiency for developers, and help enterprises' agile cloud launch | wonderful review of techo day
SQLSERVER 查询编码是 936 简体中文GBK,那我是写936 还是写GBK?
通过EF Core框架根据SQL Server数据库表生成实体类