Skip to content

00 简介

官方文档

更加详细的说明

1. RPM 优势

使用RPM,你可以:

  • 安装、重新安装、删除、升级和验证包
  • 使用安装过的包的数据库来查询和验证包
  • 使用元数据描述包,和包的安装手册,等等
  • 将源码打包到源码包和二进制包
  • 向yum仓库添加包
  • 对包进行数字签名

2. 示例

简单的 hello-world.spec 文件:

Name:       hello-world
Version:    1
Release:    1
Summary:    Most simple RPM package
License:    FIXME

%description
This is my first RPM package, which does nothing.

%prep
# we have no source, so nothing here

%build
cat > hello-world.sh <<EOF
#!/usr/bin/bash
echo Hello world
EOF

%install
mkdir -p %{buildroot}/usr/bin/
install -m 755 hello-world.sh %{buildroot}/usr/bin/hello-world.sh

%files
/usr/bin/hello-world.sh

%changelog
# let's skip this for now

构建RPM包:

$ rpmbuild -ba hello-world.spec