使用rpmbuild工具制作
安装工具
yum -y install rpm-build
[root@localhost ~]# yum install rpmdevtools
执行如下rpmdev-setuptree生成rpmbuild的工作目录
[root@localhost ~]# rpmdev-setuptree
查看工作目录
[root@localhost ~]# tree rpmbuild/
rpmbuild/
├── BUILD #打包过程中的工作目录
├── RPMS #存放生成的二进制包
├── SOURCES #放置打包资源,包括源码打包文件和补丁文件等
├── SPECS #放置SPEC文档
└── SRPMS #存放生成的源码包
切换目录
[root@localhost ~]# cd ~/rpmbuild/SPECS/
会自动生成模板,修改即可
[root@localhost SPECS]# vim myrpm.spec
Name: nginx
Version: 1.15.2
Release: 1%{?dist}
Summary: Asdas
License: GPL
URL: http://www.localhost
Source0: http://ftp.gnu.org/gnu/hello/%{name}-%{version}.tar.gz
BuildRequires: gettext
%description
Garena self-build Nginx.
%prep
%setup -q
%build
./configure --prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--pid-path=/usr/local/nginx/run/nginx.pid \
--with-http_ssl_module \
--with-http_stub_status_module
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
%files
%defattr(-,root,root,-)
/usr/local
%changelog
执行打包命令
[root@localhost ~]# rpmbuild -bb htop2.2.0.spec