How To Install gdb on CentOS 8

gdb is A stub package for GNU source-level debugger A stub package for GNU source-level debugger

Introduction

In this tutorial we learn how to install gdb on CentOS 8.

What is gdb

‘gdb’ package is only a stub to install gcc-gdb-plugin for ‘compile’ commands. See package ‘gdb-headless’. gdb 8.2 15.el8 x86_64 298 k gdb-8.2-15.el8.src.rpm appstream A stub package for GNU source-level debugger http GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL ‘gdb’ package is only a stub to install gcc-gdb-plugin for ‘compile’ commands. See package ‘gdb-headless’.

We can use yum or dnf to install gdb on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install gdb.

Install gdb on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install gdb using dnf by running the following command:

sudo dnf -y install gdb

Install gdb on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install gdb using yum by running the following command:

sudo yum -y install gdb

How To Uninstall gdb on CentOS 8

To uninstall only the gdb package we can use the following command:

sudo dnf remove gdb

gdb Package Contents on CentOS 8

/usr/bin/gcore
/usr/bin/gdb
/usr/bin/gstack
/usr/bin/pstack
/usr/include/gdb
/usr/include/gdb/jit-reader.h
/usr/share/doc/gdb
/usr/share/doc/gdb/NEWS
/usr/share/doc/gdb/README
/usr/share/licenses/gdb
/usr/share/licenses/gdb/COPYING
/usr/share/licenses/gdb/COPYING.LIB
/usr/share/licenses/gdb/COPYING3
/usr/share/licenses/gdb/COPYING3.LIB
/usr/share/man/man1/gcore.1.gz
/usr/share/man/man1/gstack.1.gz
/usr/share/man/man1/pstack.1.gz

References

Summary

In this tutorial we learn how to install gdb on CentOS 8 using yum and dnf.