开始尝试编译RPM包 [root@c8 rpm]# cd /root/rpmbuild [root@c8 rpmbuild]# rpmbuild --define "_topdir /root/rpmbuild...第一次运行时,大概率会提示N多依赖包缺失,先耐心地逐个安装上: [root@c8 rpmbuild]# rpmbuild --define "_topdir /root/rpmbuild/" -bb ....[root@c8 rpcsvc-proto-1.4]# cd /root/rpmbuild/ # 将编译过程输出到日志文件中,更方便观察的排查错误 [root@c8 rpmbuild]# rpmbuild...在这过程中,我们还可以通过观察 /root/rpmbuild/rpmbuild.log 文件了解编译的进度情况,例如下面这样,可见进度大约到了91%,胜利在望 ~ ... [ 91%] Building...最后,查看编译结果,会有类似下面的日志: [root@c8 rpmbuild]# tail rpmbuild.log Wrote: /root/rpmbuild/RPMS/x86_64/greatsql-client-debuginfo
创建打包必须的目录 mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} echo '%\_topdir %(echo $HOME)/rpmbuild...cd rpmbuild rpmbuild -bb --target x86_64 SPECS/coding3min.spec > rpmbuild.log & 输出 + umask 022 + cd /...home/vagrant/rpmbuild/BUILD + cd /home/vagrant/rpmbuild/BUILD + rm -rf coding3min-0.0.1 + /usr/bin/gzip.../rpmbuild/BUILDROOT/coding3min-0.0.1-1.el7.x86_64 + mkdir -p /home/vagrant/rpmbuild/BUILDROOT + mkdir...vagrant/rpmbuild/BUILDROOT/coding3min-0.0.1-1.el7.x86_64/data/coding3min + mkdir -p /home/vagrant/rpmbuild
(%prep): /bin/sh -e /var/tmp/rpm-tmp.dALIRC + umask 022 + cd /root/rpmbuild/BUILD + cd /root/rpmbuild.../rpmbuild/BUILD/libvirt-8.1.0/tests/virsh-output)Program virsh-read-bufsiz found: YES (/root/rpmbuild...)Program /root/rpmbuild/BUILD/libvirt-8.1.0/scripts/meson-python.sh found: YES (/root/rpmbuild/BUILD/...Installing /root/rpmbuild/BUILD/libvirt-8.1.0/docs/schemas/storagevol.rng to /root/rpmbuild/BUILDROOT.../rpmbuild/RPMS/x86_64/libvirt-daemon-driver-storage-rbd-8.1.0-1.el8.x86_64.rpm Wrote: /root/rpmbuild/
直接开始尝试编译RPM包 [root@oe rpm]# cd /root/rpmbuild [root@oe rpmbuild]# time rpmbuild --define 'dist .oe20...' --define "_topdir /root/rpmbuild/" -bb ....最后,查看编译结果,会有类似下面的日志: [root@oe rpmbuild]# tail rpmbuild.log Wrote: /root/rpmbuild/RPMS/x86_64/greatsql-test...0 再看下编译生成的RPM文件包: [root@oe rpmbuild]# du -sch * 43G BUILD 0 BUILDROOT 64K greatsql.spec 36M rpmbuild.log...492M RPMS 472M SOURCES 472M SRPMS 45G total [root@oe rpmbuild]# cd /root/rpmbuild/RPMS/x86_64 [root
+ umask 022 + cd /home/neo/rpmbuild/BUILD + mkdir -p /home/neo/rpmbuild/BUILDROOT/netkiller-1.0.1-1....(%install): /bin/sh -e /var/tmp/rpm-tmp.VQkPUn + umask 022 + cd /home/neo/rpmbuild/BUILD + rsync -auzv.../BUILDROOT/netkiller-1.0.1-1.x86_64 Wrote: /home/neo/rpmbuild/SRPMS/netkiller-1.0.1-1.src.rpm Wrote:...+ umask 022 + cd /home/neo/rpmbuild/BUILD + /bin/rm -rf /home/neo/rpmbuild/BUILDROOT/netkiller-1.0.1.../neo/rpmbuild/RPMS/x86_64/netkiller-1.0.1-1.x86_64.rpm /home/neo/rpmbuild/SRPMS/netkiller-1.0.1-1.src.rpm
安装rpm-build软件并配置SPEC文件 1)安装rpm-build软件包 # yum -y install rpm-build 2)生成rpmbuild目录结构 # rpmbuild -ba...nginx.spec # ls /root/rpmbuild BUILD BUILDROOT RPMS SOURCES SPECS SRPMS 3)将源码软件复制到SOURCES目录 # cp...nginx-1.8.0.tar.gz /root/rpmbuild/SOURCES/ 4)创建并修改SPEC配置文件 # vim SPECS/nginx.spec Name:nginx...usr/local/nginx/* %changelog 使用配置文件创建RPM包 1)安装依赖软件包 # yum –y install gcc pcre-devel zlib-devel 2)rpmbuild...创建RPM软件包 # rpmbuild -ba SPECS/nginx.spec # ls RPMS/x86_64/nginx-1.8.0-1.x86_64.rpm # rpm -qpi RPMS/x86
tar.gz tar -zcvf atop-2.4.0.tar.gz atop-2.4.0/ (图片点击放大查看) (图片点击放大查看) (图片点击放大查看) (图片点击放大查看) 3、准备atop的rpmbuild...相关文件 cp /opt/atop-2.4.0/atop.spec ./ rpmbuild atop.spec 使用该命令生成rpmbuild的相关目录 cd rpmbuild/ cp /opt/atop...-2.4.0/atop.spec SPECS/ cp /opt/atop-2.4.0.tar.gz SOURCES/ (图片点击放大查看) (图片点击放大查看) 4、rpmbuild生成rpm包...cd /root rpmbuild -ba rpmbuild/SPECS/atop.spec 生成的rpm包位于 cd /root/rpmbuild/RPMS/x86_64/ (图片点击放大查看
rpmbuild 命令的安装 rpmbuild 命令也是一个程序,但是这个程序不会默认安装,所以要想使用 rpmbuild 命令就必须提前安装。...使用 rpmbuild 安装 SRPM 包的命令格式如下: [root@localhost ~]# rpmbuild [选项] 包全名 可使用如下 2 个选项: -rebuild:编译 SRPM 包生成...这里不是报错,不用紧张 …省略部分输出… Wrote: /root/rpmbuild/RPMS/i386/ httpd-2.2.15-5.el6.i386.rpm Wrote: /root/rpmbuild...el6.noarch.rpm Wrote: /root/rpmbuild/RPMS/i386/httpd-tools-2.2.15-5.el6.i386.rpm Wrote: /root/rpmbuild...通过此命令,也可以在当前目录下生成 rpmbuild 目录,但与表 2 不同,此 rpmbuild 目录中仅有 SOURCES 和 SPECS 两个子目录。
包制作方法 最近有同学问我制作RPM包相关的问题,我发现我以前做过,但是忘记记录了,现在记录一下: 以打包nginx并带有nginx-rtmp的工程为rpm为例: 首先,需要安装一个rpmbuild...: 点击(此处)折叠或打开 yum install rpm-build 安装完成之后,系统中可以使用rpmbuild命令 然后下载nginx与nginx-rtmp,当然...,做包的前提是我们手动能够编译,安装nginx+nginx-rtmp 接下来就可以开始写spec,因为打包rpm时,rpmbuild会根据spec来进行操作,将源码包解压,然后按照我们的手动操作的步骤进行操作.../nginx.spec > /dev/null + umask 022 + cd /root/rpmbuild/BUILD + cd /root/rpmbuild/BUILD...+ exit 0 + umask 022 + cd /root/rpmbuild/BUILD + cd nginx-1.3.8.with.rtmp + .
rpm-build 1 sudo yum install -y gcc make rpm-build redhat-rpm-config vim lrzsz 创建必须的文件夹和文件 mkdir -p ~/rpmbuild.../{BUILD,RPMS,SOURCES,SPECS,SRPMS} echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros 制作spec文件 找spec.../SPECS/python.spec # 参照这个文件来写自己软件包的spec文件 写自己软件包的spec文件 spec文件中各个选项的意义参照这里 cd ~/rpmbuild cat ..../SOURCES/ 开始制作 cd ~/rpmbuild rpmbuild -bb --target x86_64 SPECS/python27-tstack.spec &> rpmbuild.log...# 这时可以打开另一个终端观察下rpmbuild.log 一切顺序的话,最终会在~/rpmbuild/RPMS/x86_64/目录下找到编译好的rpm包。
#清除缓存 yum clean all 安装rpm-build yum install rpm-build make rsync cd rpmbuild/ ll #将源码到/root/rpmbuild.../BUILDROOT/目录下,删除隐藏文件.vscode #进入/root/rpmbuild/SPECS/,编辑打包脚本test.spec cd /root/rpmbuild/SPECS/ vi...%pre %preun %postun %clean %files %defattr (-,root,root,0777) /usr /etc /var %post #运行制作rpm包 rpmbuild
开始尝试编译RPM包 $ cd /root/rpmbuild $ rpmbuild --define "_topdir /root/rpmbuild/" -bb ....第一次运行时,大概率会提示N多依赖包缺失,先耐心地逐个安装上: $ rpmbuild --define "_topdir /root/rpmbuild/" -bb ....$ cd /root/rpmbuild/ # 将编译过程输出到日志文件中,更方便观察的排查错误 $ rpmbuild --define "_topdir /root/rpmbuild/" -bb ....在这过程中,我们还可以通过观察 /root/rpmbuild/rpmbuild.log 文件了解编译的进度情况,例如下面这样,可见进度大约到了91%,胜利在望 ~ ... [ 91%] Building...最后,查看编译结果,会有类似下面的日志: $ tail rpmbuild.log Wrote: /root/rpmbuild/RPMS/x86_64/greatsql-client-debuginfo-
/libstdc++-4.3.0-8.i386.rpm | cpio -idv rpmbuild 创建RPM的二进制软件包和源码软件包 补充说明 rpmbuild命令被用于创建rpm的二进制软件包和源码软件包...语法 rpmbuild (选项) 选项 --initdb:初始化RPM数据库; --rebuilddb:从已安装的包头文件,方向重建RPM数据库; -ba:创建二进制和源代码包; -bb:创建二进制代码包...实例 rpmbuild -ba 'spec文件路径' build完后,可以在/usr/src/redhat/RPMS/下找到二进制rpm包,rpm包按照其对应的cpu体系结构分类,通常在/usr/src
wget net-tools 安装openvswitch wget http://openvswitch.org/releases/openvswitch-2.5.4.tar.gz mkdir -p ~/rpmbuild.../SOURCES tar -zxvf openvswitch-2.5.4.tar.gz cp openvswitch-2.5.4.tar.gz ~/rpmbuild/SOURCES/ ls /lib/modules.../$(uname -r) -ln rpmbuild -bb --without check openvswitch-2.5.4/rhel/openvswitch.spec cd rpmbuild/RPMS
可以看到运行了这个命令之后,在$HOME家目录下多了一个叫做rpmbuild的文件夹,里边内容如下: $ tree rpmbuild rpmbuild ├── BUILD ├── RPMS ├── SOURCES...源代码目录 保存源码包(如 .tar 包)和所有 patch 补丁 ~/rpmbuild/BUILD %_builddir 构建目录 源码包被解压至此,并在该目录的子目录完成编译 ~/rpmbuild...rpmbuild命令如何去打包。...命令瞅瞅吧: $ rpmbuild -ba hello.spec OK,执行成功了,看看成果吧: $ tree ~/rpmbuild/*RPMS /root/rpmbuild/RPMS └── x86_...会保存至 ~/rpmbuild/SRPMS。
ncurses-devel newt-devel numactl-devel pciutils-devel python-devel zlib-devel 2.创建内核源码树 mkdir -p ~/rpmbuild...updates/Source/SPackages/ 5.安装rpm至目录树 rpm -i kernel-2.6.32-431.el6.src.rpm 2>&1 | grep -v exist cd ~/rpmbuild.../SPECS rpmbuild -bp --target=$(uname -m) kernel.spec 经过几分钟后内核源码应该在: ~/rpmbuild/BUILD/kernel-2.6.32-431
卸载后需要运行的脚本 软件打包流程:准备源码软件-安装rpm-build-编写编译配置文件-编译RPM包 安装rpm-build,编译打包RPM的命令工具 yum -y install rpm-build rpmbuild...-ba nginx.spec 注意:这一步会报错,但是仍然会生成rpmbuild文件夹 ls /root/rpmbuild 将源码软件复制到sources目录下 创建并修改SPECS配置文件,...smp_mflags} %install make install DESTDIR=%{buildroot} %files %doc /usr/local/nginx/* %changelog rpmbuild
/{BUILD,RPMS,SOURCES,SPECS,SRPMS} cp ~/openssl/openssl.spec /root/rpmbuild/SPECS/openssl.spec mv openssl...-1.1.1i.tar.gz /root/rpmbuild/SOURCES cd /root/rpmbuild/SPECS && \ rpmbuild \ -D "version 1.1.1i...openssl # Uninstall Current Openssl Vesion : yum -y remove openssl # For install: rpm -ivvh /root/rpmbuild...(图片可放大查看) rpm升级到openssl1.1.1i rpm -aq openssl yum -y remove openssl rpm -ivh /root/rpmbuild/RPMS/x86...openssl1.1.1i RPM包并升级的步骤 尝试过git clone https://src.fedoraproject.org/rpms/openssl.git,利用openssl.spec进行rpmbuild
目录 [root@centos ~]# ll ~ | grep rpmbuild drwxr-xr-x 4 root root 34 10月 17 15:42 rpmbuild # 通过...tree命令查看一下rpmbuild下的文件结构,可以看到所有文件的用户和组都是mockbuild:mockbuild [root@centos ~]# tree -ug ~/rpmbuild/ /root...上一步是根据自己的需要修改源码包,修改完成后的最后一个步骤就是构建新的rpm包 # 进入到rpmbuild/SPECS目录下 [root@centos ~]# cd ~/rpmbuild/SPECS...rpmbuild -ba xxx.spec: 编译后生成*.rpm和*.src.rpm # rpmbuild -bb xxx.spec: 编译后只生成*.rpm # rpmbuild -bs xxx.spec...: 编译后只生成*.src.rpm # 我们此处不需要源码包,所以使用rpmbuild -bb命令就可以了(构建可能需要一些依赖包,需要先手动安装上) [root@centos ~]# rpmbuild
/SPECS/python.spec # 参照这个文件来写自己软件包的spec文件 rpmbuild内置变量 rpmbuild --showrc可查看内置的变量 常用的几个变量: $RPM_BUILD_DIR.../$HOME/rpmbuild/BUILD $RPM_BUILD_ROOT /$HOME/rpmbuild/BUILDROOT %{_sysconfigdir} /etc %{_sbindir} /usr.../SOURCES/ 开始制作 cd ~/rpmbuild rpmbuild -bb --target x86_64 SPECS/python27-tstack.spec > rpmbuild.log...总结来说,rpmbuild编出来的包是特例,而mock编出来包在具有共性。mock相当于给rpmbuild增加了一个外壳,包装了一下。...总结 rpmbuild打包一般步骤 根据rpmbuild标准,创建打包的目录结构 将源码和辅助文件放到指定目录 编写spec文件,放到指定目录 根据需要构建rpm,或者rpm和srpm等。
领取专属 10元无门槛券
手把手带您无忧上云