如何将源码包转换成rpm包

1)安装rpm-build软件包

[root@proxy ~]# yum -y install rpm-build

2)生成rpmbuild目录结构

[root@proxy ~]# rpmbuild -ba nginx.spec

//制作rpm包,但是没有配置文件会报错,报错也需要敲,会产生所需的目录

3)准备工作,将源码软件复制到SOURCES目录

[root@proxy ~]# cp  lnmp_soft/nginx-1.12.2.tar.gz /root/rpmbuild/SOURCES/

4)创建并修改SPEC配置文件

[root@proxy ~]# vim /root/rpmbuild/SPECS/nginx.spec 
Name:nginx                                        #源码包软件名称
Version:1.12.2                                    #源码包软件的版本号
Release:    10                                        #制作的RPM包版本号
Summary: Nginx is a web server software.            #RPM软件的概述    
License:GPL                                        #软件的协议
URL:    www.test.com                                    #网址
Source0:nginx-1.12.2.tar.gz                        #源码包文件的全称
#BuildRequires:                                    #制作RPM时的依赖关系
#Requires:                                        #安装RPM时的依赖关系
%description
nginx [engine x] is an HTTP and reverse proxy server.    #软件的详细描述
%post
useradd nginx                               #非必需操作:安装后脚本(创建账户)
%prep
%setup -q                                #自动解压源码包,并cd进入目录
%build
./configure
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
%files
%doc
/usr/local/nginx/*                    #对哪些文件与目录打包
%changelog

使用配置文件创建RPM包:
1)安装依赖软件包

[root@proxy ~]# yum -y install gcc make pcre-devel openssl-devel

2)rpmbuild创建RPM软件包

[root@proxy ~]# rpmbuild -ba rpmbuild/SPECS/nginx.spec
[root@proxy ~]# ls /root/rpmbuild/RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm

[root@proxy ~]# ls rpmbuild/RPMS/x86_64/                                 
//查看结果看到nginx-1.12.2-10.x86_64.rpm则成功

安装软件测试:
[root@proxy ~]# yum install /root/rpmbuild/RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm 
[root@proxy ~]# rpm -qa |grep nginx
[root@proxy ~]# ls /usr/local/nginx/



作者:一个小运维
链接:https://www.jianshu.com/p/6c19bfcc1c99

相关资源:
java 对Redis的导入和导出 - Dcsdn 

GitOps 初探 - Dcsdn 

Redis数据的导出和导入 - Dcsdn

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值