假如官网没有提供rpm包只有源码包那怎么办呢?这里主要讲的nginx的源码包制作rpm包的过程。
1. 安装rpm-build软件包
[ root@localhost ~]
2. 生成rpmbuild目录结构
[ root@localhost ~]
error: failed to stat /root/nginx.spec: No such file or directory
[ root@localhost ~]
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
3. 准备工作,将源码软件包复制到SOURCES目录
[ root@localhost ~]
4. 创建并修改SPEC配置文件
[ root@localhost ~]
Name:nginx
Version:1.18.0
Release: 1
Summary: Nginx is a web server software.
License:GPL
URL: www.test.com
Source0:nginx-1.18.0.tar.gz
%description
nginx [ engine x] is an HTTP and reverse proxy server.
%post
useradd -s /sbin/nologin nginx -M
%prep
%setup -q
%build
./configure --prefix= /usr/local/nginx --user= nginx --group= nginx
make %{
?_smp_mflags}
%install
make install DESTDIR= %{
buildroot}
%files
%doc
/usr/local/nginx/*
%changelog
5.使用配置文件创建RPM包
[ root@localhost ~]
[ root@localhost ~]
[ root@localhost ~]
nginx-1.18.0-1.x86_64.rpm nginx-debuginfo-1.18.0-1.x86_64.rpm
6.安装测试:
[ root@localhost ~]
[ root@localhost ~]
nginx-1.18.0-1.x86_64