Install and uninstall debuginfo package on CentOS

Install debuginfo package

On CentOS, we can install debuginfo package as below.

  • Modify /etc/yum.repos.d/CentOS-Debuginfo.repo by setting “enabled=1”

  • Run “yum install kernel-debuginfo”

    [root@host1 ~]# uname -r
    3.10.0-1160.el7.x86_64

    [root@host1 ~]# vim /etc/yum.repos.d/CentOS-Debuginfo.repo
    [base-debuginfo]
    name=CentOS-7 - Debuginfo
    baseurl=http://debuginfo.centos.org/7/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-Debug-7
    enabled=1

    [root@host1 ~]# yum install kernel-debuginfo
    Installed:
    kernel-debuginfo.x86_64 0:4.19.113-300.el7
    Dependency Installed:
    kernel-debuginfo-common-x86_64.x86_64 0:4.19.113-300.el7
    [root@host1 ~]# rpm -qa | grep debuginfo
    kernel-debuginfo-4.19.113-300.el7.x86_64
    kernel-debuginfo-common-x86_64-4.19.113-300.el7.x86_64

Notice that the installed kernel-debuginfo package version does not match with the kernel version. We can use the following commands to install the identical version as kernel.

[root@host1 ~]# yum install -y kernel-devel-$(uname -r) \
kernel-debuginfo-$(uname -r) \
kernel-debuginfo-common-$(uname -m)-$(uname -r)

Installed:
  kernel-debuginfo.x86_64 0:3.10.0-1160.el7  kernel-debuginfo-common-x86_64.x86_64 0:3.10.0-1160.el7

Remove debuginfo package

[root@host1 ~]# rpm -qa | grep debuginfo
kernel-debuginfo-4.19.113-300.el7.x86_64
kernel-debuginfo-common-x86_64-4.19.113-300.el7.x86_64

[root@host1 ~]# yum remove kernel-debuginfo
[root@host1 ~]# yum remove kernel-debuginfo-common-x86_64-4.19.113-300.el7.x86_64

[root@host1 ~]# rpm -qa | grep debug