Linux学习-制作RPM包

制作nginx的RPM包

安装rpm-build软件
[root@py-redis SPECS]# dnf install -y rpm-build
生成rpmbuild目录结构
[root@py-redis SPECS]# rpmbuild -ba nginx.spec
[root@py-redis SPECS]# ls /root/rpmbuild/
BUILD  BUILDROOT  RPMS  SOURCES  SPECS  SRPMS
将源码软件复制到SOURCES目录(本例使用nginx-1.22.1)
[root@py-redis SPECS]# cp ../lnmp_soft/nginx-1.22.1.tar.gz SOURCES/
创建并修改SPEC配置文件
Name:nginx
Version:1.22.1
Release:10
Summary:nginx is a web server software
Group:
License: GPL
URL: www.test.com
Source0:nginx-1.22.1.tar.gz
#BuildRequires: 
Requires:pcre-devel openssl-devel
%description
nginx is an HTTP and reverse proxy server.
%post
useradd nginx
%prep
%setup -q
%build
./configure
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
%files
%doc
/usr/local/nginx/*
%changelog
用配置文件创建RPM包
[root@py-redis SPECS]# yum install -y pcre-devel gcc make openssl-devel
[root@py-redis SPECS]# rpmbuild -ba /root/rpmbuild/SPECS/nginx.spec 
[root@py-redis SPECS]# ls /root/rpmbuild/RPMS/x86_64/nginx-1.22.1-10.x86_64.rpm 
安装测试
[root@py-redis SPECS]# yum install -y /root/rpmbuild/RPMS/x86_64/nginx-1.22.1-10.x86_64.rpm 
[root@py-redis SPECS]# /usr/local/nginx/sbin/nginx 
[root@py-redis SPECS]# curl 192.168.88.11
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值