rpm打包的过程,就是先源码安装一遍(并不会真的在机器上安装),再把安装的文件封装到rpm包中
[root@room9pc01 ~]#yum -y install gcc pcre-devel openssl-devel //安装源码安装的相关软件
[root@room9pc01 ~]#yum -y install rpm-bulid //安装rpm打包工具
[root@room9pc01 ~]#rpmbuild -ba wenjianming //随便执行一个文件,不存在也没关系,会在本地目录生成一个rpmbuild文件夹
[root@room9pc01 ~]#cp /root/nginx-1.12.2-1.x86_64.tar.gz /root/rpmbuild/SOURCES //将源码包放到SOURCES目录下,打包的时候会自动从这里调用
[root@room9pc01 ~]#vim /root/rpmbuild/SPECS/nginx.spec
Name:nginx //打包的名字
Version:1.12.2 //打包文件名字后的版本
Release:1 //第几次打包了
Summary:this is a web software //描述信息
#Group:
License:GPL //GPL开源协议
#URL: //访问网站,可以不写
Source0:nginx-1.12.2.tar.gz //SOURCES目录下的源码文件
#BuildRequires:
#Requires:
%description //描述信息
this is the first one
%post //安装完后要执行的命令
useadd -s /sbin/nologin nginx
%prep
%setup -q
%build
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx //改为./configure, 后跟添加的模块
make %{?_smp_mflags}
%install
make install DESTDIR=%{buildroot}
%files
%doc
/usr/local/nginx/* //虚拟源码安装完后,要进行打包的文件,这文件是指源码安装完后文件的存放位置
%changelog