CentOS release 6.5
nginx-1.0.15-5.el6.src.rpm
[[email protected] ~]# useradd -r mockbuild #新建mockbuild用户 [[email protected] ~]# 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目录 [[email protected] ~]# cd rpmbuild/ [[email protected] rpmbuild]# ls SOURCES SPECS [[email protected] rpmbuild]# cd SPECS/ [[email protected] SPECS]# ls nginx.spec [[email protected] 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 [[email protected] 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 #创建成功# [[email protected] SPECS]# cd .. #切换到上级目录 [[email protected] rpmbuild]# ls #自动生成了RPMS,SRPMS等目录 BUILD BUILDROOT RPMS SOURCES SPECS SRPMS [[email protected] rpmbuild]# cd SRPMS/ #切换到SRPMS目录,此目录存储创建成功的源码rpm包 [[email protected] SRPMS]# ls nginx-1.0.15-5.el6.src.rpm [[email protected] rpmbuild]# cd ../RPMS/ #切换到RPMS目录,此目录存储创建成功的二进制rpm包 [[email protected] RPMS]# ls x86_64 [[email protected] RPMS]# cd x86_64/ #切换到basearch目录 [[email protected] x86_64]# ls #自动生成了nginx的二进制rpm包 nginx-1.0.15-5.el6.x86_64.rpm nginx-debuginfo-1.0.15-5.el6.x86_64.rpm [[email protected] x86_64]# rpm -ivh nginx-1.0.15-5.el6.x86_64.rpm #rpm -ivh安装,成功 Preparing... ########################################### [100%] 1:nginx ########################################### [100%] 下面用浏览器访问本机ip地址:
软件包管理之源码格式的rpm包
时间: 2024-10-09 01:23:12