本文共 1163 字,大约阅读时间需要 3 分钟。
拿ngixnx-1.12.2来说
1.安装rpm-build软件包
yum -y install rpm-build2.生成rpmbuild目录结构rpmbuild -ba nginx.spec //会报错,没有文件或目录报错也要打上去 避免自己去创建文件夹 它会自己生成目录3.将源码软件复制到SOURCES目录cp nginx-1.12.2.tar.gz /root/rpmbuild/SOURCES/4.创建并修改SPEC配置文件vim /root/rpmbuild/SPECS/nginx.spec Name:nginx //必须写正确Version:1.12.2 //必须写正确Release:10Summary:Nginx is a web server software. //说明Group:tearena License:GPLURL:www.test.comSource0:nginx-1.12.2.tar.gz#BuildRequires: #Requires: %descriptionnginx [engine x] is an HTTP and reverse proxy server.%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}%installmake install DESTDIR=%{buildroot}%files%doc/usr/local/nginx/* //对哪些文件进行打包%changelog5.安装依赖软件包yum –y install gcc pcre-devel zlib-devel openssl-devel6.rpmbuild创建RPM软件包rpmbuild -ba /root/rpmbuild/SPECS/nginnginx-1.12.2-10.x86_64.rpm x.spec看一下 RPM包生成ls /root/rpmbuild/RPMS/x86_64/nginx-1.12.2-10.x86_64.rpm nginx-debuginfo-1.12.2-10.x86_64.rpm repodata //第一个就是生成的RPM包以后省了很多麻烦转载于:https://blog.51cto.com/13740508/2115457