吐槽:操蛋的工作内容
由于工作需要,需要将服务给封装成RPM
类型的安装文件,并放入yum
中,以供以后服务使用yum -y install
的方式全自动安装!
准备RPM包编译的标准环境
rpmbuild/
├── BUILD
├── BUILDROOT
├── RPMS
├── SOURCES
├── SPECS
└── SRPMS
1. BUILD
目录
2. BUILDROOT
目录
3. RPMS
目录
4. SOURCES
目录
5. SPECS
目录
6. SRPMS
目录
制作spec编译文件
Name: xiaopalu1
Version: 5.0.0
Release: 1
Summary: The underlying dependency components of xiaopalu2
License: Mulan Permissive License, Version 2
Source0: xiaopalu1.tar.gz
%description
The underlying dependency functional components of intelligent operation and maintenance
%prep
#%setup -q
%build
# No build process for this package, as we're only unpacking a tarball
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/home
tar xf %{SOURCE0} -C $RPM_BUILD_ROOT/home
%files
/home/xiaopalu
%changelog
Tue Aug 27 2024 xiaopalu <Jsx20011014@163.com> - 20240827.01
- Provide the underlying dependency components of xiaopalu2.
1. 基本信息
Name: 软件包的名称是 xiaopalu1
。
Version: 软件包的版本是 5.0.0
。
Release: 软件包的发布版本是 1
。
Summary: 对软件包的简要描述,说明它是 xiaopalu2
的底层依赖组件。
License: 该软件包使用的是 Mulan Permissive License, Version 2 开源许可证。
Source0: 指定了源代码包的文件名(在这个例子中是 xiaopalu1.tar.gz
)。
2. 描述
3. 准备阶段
4. 构建阶段
5. 安装阶段
6. 文件列表
7. 变更日志
安装rpmbuild命令
yum -y install rpmbuild
开始编译RPM包
## 开始编译RPM包
rpmbuild -ba xiaopalu.spec
## 编译后服务树结构
rpmbuild/
├── BUILD
├── BUILDROOT
├── RPMS
│ └── x86_64
| └── xiaopalu-5.0.0-1.ctl2.x86_64.rpm ## 最终的RPM包
├── SOURCES
│ └── xiaopalu1.tar.gz
├── SPECS
│ ├── xiaopalu.spec
└── SRPMS
└── xiaopalu-5.0.0-1.ctl2.src.rpm
额外的RPM命令
rpm -qi xiaopalu-5.0.0-1.ctl2.x86_64.rpm
Name : xiaopalu
Version : 5.0.0
Release : 1.ctl2
Architecture: x86_64
Install Date: (not installed)
Group : ops
Size : 687743553
License : Mulan Permissive License, Version 2
Signature : (none)
Source RPM : xiaopalu-5.0.0-1.ctl2.src.rpm
Build Date : Tue 27 Aug 2024 05:38:12 PM CST
Build Host : nm-het7-1.1.1.1
Summary : The CtOps around "O&M and service" to provide a one-stop IT O&M management platform for O&M and R&D.
Description :
The CtOps is committed to building a one-stop operation and maintenance capability platform,
providing asset management, unified monitoring and alarm, and automated inspection capabilities,
breaking down the data walls, chimney alarms, manual operation and maintenance problems in the
traditional operation and maintenance process, and facilitating the digital transformation of
operation and maintenance work.
rpm -ql package_name
rpm -qil package_name
rpm -qR package_name
rpm -q --last package_name