CentOS release 6.5
nginx-1.0.15-5.el6.src.rpm
[root@wsh ~]# useradd -r mockbuild #新建mockbuild用户 [root@wsh ~]# rpm -ivh nginx-1.0.15-5.el6.src.rpm #和安装二进制rpm包一样 warning: nginx-1.0.15-5.el6.src.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY 1:nginx ########################################### [100%] #执行完上面步骤,会在当前目录下生成rpmbulid目录 [root@wsh ~]# cd rpmbuild/ [root@wsh rpmbuild]# ls SOURCES SPECS [root@wsh rpmbuild]# cd SPECS/ [root@wsh SPECS]# ls nginx.spec [root@wsh SPECS]# rpmbuild -ba nginx.spec #rpmbuild创建rpm包,-ba:二进制和源码包,-bb:只是二进制包 perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). error: Failed build dependencies: ##首先安装这些包,在此不再演示 GeoIP-devel is needed by nginx-1.0.15-5.el6.x86_64 gd-devel is needed by nginx-1.0.15-5.el6.x86_64 libxslt-devel is needed by nginx-1.0.15-5.el6.x86_64 pcre-devel is needed by nginx-1.0.15-5.el6.x86_64 perl(ExtUtils::Embed) is needed by nginx-1.0.15-5.el6.x86_64 [root@wsh SPECS]# rpmbuild -ba nginx.spec #rpmbuild创建rpm包 ...... ...... Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.wOwzDo + umask 022 + cd /root/rpmbuild/BUILD + cd nginx-1.0.15 + /bin/rm -rf /root/rpmbuild/BUILDROOT/nginx-1.0.15-5.el6.x86_64 + exit 0 #创建成功# [root@wsh SPECS]# cd .. #切换到上级目录 [root@wsh rpmbuild]# ls #自动生成了RPMS,SRPMS等目录 BUILD BUILDROOT RPMS SOURCES SPECS SRPMS [root@wsh rpmbuild]# cd SRPMS/ #切换到SRPMS目录,此目录存储创建成功的源码rpm包 [root@wsh SRPMS]# ls nginx-1.0.15-5.el6.src.rpm [root@wsh rpmbuild]# cd ../RPMS/ #切换到RPMS目录,此目录存储创建成功的二进制rpm包 [root@wsh RPMS]# ls x86_64 [root@wsh RPMS]# cd x86_64/ #切换到basearch目录 [root@wsh x86_64]# ls #自动生成了nginx的二进制rpm包 nginx-1.0.15-5.el6.x86_64.rpm nginx-debuginfo-1.0.15-5.el6.x86_64.rpm [root@wsh x86_64]# rpm -ivh nginx-1.0.15-5.el6.x86_64.rpm #rpm -ivh安装,成功 Preparing... ########################################### [100%] 1:nginx ########################################### [100%] 下面用浏览器访问本机ip地址:
本文出自 “大灰狼” 博客,请务必保留此出处http://huifei1314.blog.51cto.com/4681402/1416739
软件包管理之源码格式的rpm包,布布扣,bubuko.com
原文:http://huifei1314.blog.51cto.com/4681402/1416739