将源码包打包成RPM包

版权声明:观极著作 https://blog.csdn.net/weixin_41619143/article/details/88577384

RPM
1,描述信息
2,对源码安装后的数据压缩rpm

应用的场景

打包流程

安装rpm-build软件
#yum -y install rpm-build
#rpmbuild -ba nginx.spec //会报错,没有那个文件或目录
#cd rpmbuild/

将源码软件复制到SOURCES目录下

#cp /lnmp_soft/nginx-1.10.3.tar.gz /root/rpmbuild/SOURCES/

#vim SPECS/nginx.spec (SPECS/下vim自动生成xx.spec配置文件)
---------------------------------------------------------------------------------------
Name:nginx
Version:1.10.3
Release:2
Summary:This is a web

#Group:         
License:GPL
URL:www.ainiwan.com
Source0:nginx-1.10.3.tar.gz

#BuildRequires: 
#Requires:      

%description
nginx [engine x] is an HTTP and reverse proxy server.

%post
useradd nginx                                                  //非必需操作:安装后脚本(创建账户)

%prep
%setup -q                                                        //自动解压源码包,并cd进入目录

%build
./configure (--prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-stream         --with-http_stub_status_module  )

make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}

%files
%doc
/usr/local/nginx/*

%changelog
--------------------------------------------------------------------------------------------

#rpmbuild -ba /root/rpmbuild/SPECS/nginx.spec 
## ls RPMS/x86_64/
nginx-1.10.3-2.x86_64.rpm  nginx-debuginfo-1.10.3-2.x86_64.rpm


==================打包完工==============

     将打包成rpm的nginx安装
#yum -y install gcc pcre-devel.i686 openssl-devel.i686 zlib-devel.i686 
#netstat -antlp | grep 80
#systemctl stop httpd.service
#rpm -ivh RPMS/x86_64/nginx-1.12.2-6.x86_64.rpm
#/usr/local/nginx/sbin/nginx 
#netstat -antlp | grep 80

#curl http://127.0.0.1/

==================安装完工================

猜你喜欢

转载自blog.csdn.net/weixin_41619143/article/details/88577384
今日推荐