https://www.atoptool.nl/downloadatop.php 这个网址下载src.rpm 源码,通过rpm -ivh 安装源码
打开spec 文件
Name: atop
Version: 2.5.0
Release: 1
Source0: %{name}-%{version}.tar.gz
URL: https://www.atoptool.nl
Packager: Gerlof Langeveld <gerlof.langeveld@atoptool.nl>
Summary: Advanced System and Process Monitor
License: GPL
Group: System Environment
Requires: zlib, ncurses
BuildRequires: zlib-devel, ncurses-devel
BuildRoot: /var/tmp/rpm-buildroot-atop
可以发现有依赖zlib-devel, ncurses-devel,通过下面的命令安装
64 yum install zlib-devel -y
65 yum install ncurses-devel -y
遇到的错误
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
*** ERROR: ambiguous python shebang in /usr/sbin/atopgpud: #!/usr/bin/python -Es. Change it to python3 (or python2) explicitly.
Processing files: atop-2.5.0-1.aarch64
处理方法:找到源文件中/usr/sbin/atopgpud 中去掉#!/usr/bin/python -Es,改成#!/usr/bin/python2
Processing files: atop-debugsource-2.5.0-1.aarch64
error: Empty %files file /root/rpmbuild/BUILD/atop-2.5.0/debugsourcefiles.list
RPM build errors:
Empty %files file /root/rpmbuild/BUILD/atop-2.5.0/debugsourcefiles.list
处理方法是spec 文件中增加global 表示不要debug_package的包
%global debug_package %{nil}
%prep
%setup -q
编译乘车rpm 包并成功安装
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/atop-2.5.0-1.aarch64
Wrote: /root/rpmbuild/SRPMS/atop-2.5.0-1.src.rpm
Wrote: /root/rpmbuild/RPMS/aarch64/atop-2.5.0-1.aarch64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.KoPwhX
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd atop-2.5.0
+ rm -rf /root/rpmbuild/BUILDROOT/atop-2.5.0-1.aarch64
+ exit 0
[root@localhost SPECS]# yum install /root/rpmbuild/RPMS/aarch64/atop-2.5.0-1.aarch64.rpm
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 2:41:11 ago on Fri Nov 13 03:30:48 2020.
Dependencies resolved.
========================================================================================================================================================================
Package Architecture Version Repository Size
========================================================================================================================================================================
Installing:
atop aarch64 2.5.0-1 @commandline 196 k
Transaction Summary
========================================================================================================================================================================
Install 1 Package
Total size: 196 k
Installed size: 653 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : atop-2.5.0-1.aarch64 1/1
Running scriptlet: atop-2.5.0-1.aarch64 1/1
Created symlink /etc/systemd/system/multi-user.target.wants/atopacct.service → /usr/lib/systemd/system/atopacct.service.
Created symlink /etc/systemd/system/multi-user.target.wants/atop.service → /usr/lib/systemd/system/atop.service.
Created symlink /etc/systemd/system/timers.target.wants/atop-rotate.timer → /usr/lib/systemd/system/atop-rotate.timer.
Verifying : atop-2.5.0-1.aarch64 1/1
Installed products updated.
Installed:
atop-2.5.0-1.aarch64