How To Install gcc on CentOS 8
Introduction
In this tutorial we learn how to install gcc
on CentOS 8.
What is gcc
The gcc package contains the GNU Compiler Collection version 8. You’ll need this package in order to compile C code.
We can use yum
or dnf
to install gcc
on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install gcc.
Install gcc 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 gcc
using dnf
by running the following command:
sudo dnf -y install gcc
Install gcc 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 gcc
using yum
by running the following command:
sudo yum -y install gcc
How To Uninstall gcc on CentOS 8
To uninstall only the gcc
package we can use the following command:
sudo dnf remove gcc
gcc Package Contents on CentOS 8
/usr/bin/c89
/usr/bin/c99
/usr/bin/cc
/usr/bin/gcc
/usr/bin/gcc-ar
/usr/bin/gcc-nm
/usr/bin/gcc-ranlib
/usr/bin/gcov
/usr/bin/gcov-dump
/usr/bin/gcov-tool
/usr/bin/x86_64-redhat-linux-gcc
/usr/bin/x86_64-redhat-linux-gcc-8
/usr/lib/.build-id
/usr/lib/.build-id/23
/usr/lib/.build-id/23/cbf514426481aa8d141e5303c0ee3e268fde28
/usr/lib/.build-id/2b
/usr/lib/.build-id/2b/6ae6fc611ceb0a9f0bb286b55acf446091bbba
/usr/lib/.build-id/30
/usr/lib/.build-id/30/f98af2a705b5f81bd8a1b12b1e5d174b40e658
/usr/lib/.build-id/37
/usr/lib/.build-id/37/9064b657de6c26916fb3e007f1d426bc1c4a20
/usr/lib/.build-id/57
/usr/lib/.build-id/57/12815d16571944628b508ab7a8b60027356e14
/usr/lib/.build-id/60
/usr/lib/.build-id/60/23615ba8d309d6bd087075f457f9688eb16fe6
/usr/lib/.build-id/60/23615ba8d309d6bd087075f457f9688eb16fe6.1
/usr/lib/.build-id/60/23615ba8d309d6bd087075f457f9688eb16fe6.2
/usr/lib/.build-id/a0
/usr/lib/.build-id/a0/16ea8d3ae4cea7a77c3356a01b6a82663cc14b
/usr/lib/.build-id/d6
/usr/lib/.build-id/d6/14a3836f44f4e79f7fe9f36a269f9bd5dc3ebf
/usr/lib/.build-id/e3
/usr/lib/.build-id/e3/f35475dd41ad259dcd7eef70c696f4f23dfcca
/usr/lib/.build-id/e5
/usr/lib/.build-id/e5/888c305b35d824e2545720164427ad4b3dd825
/usr/lib/.build-id/ff
/usr/lib/.build-id/ff/ea7796d8dc02790010f9fca8cfa443362242cb
/usr/lib/gcc
/usr/lib/gcc/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/8
/usr/lib/gcc/x86_64-redhat-linux/8/32
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtbegin.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtbeginS.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtbeginT.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtendS.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtfastmath.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtoffloadbegin.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtoffloadend.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtoffloadtable.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtprec32.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtprec64.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/crtprec80.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/libasan.so
/usr/lib/gcc/x86_64-redhat-linux/8/32/libasan_preinit.o
/usr/lib/gcc/x86_64-redhat-linux/8/32/libatomic.a
/usr/lib/gcc/x86_64-redhat-linux/8/32/libatomic.so
/usr/lib/gcc/x86_64-redhat-linux/8/32/libgcc.a
/usr/lib/gcc/x86_64-redhat-linux/8/32/libgcc_eh.a
/usr/lib/gcc/x86_64-redhat-linux/8/32/libgcc_s.so
/usr/lib/gcc/x86_64-redhat-linux/8/32/libgcov.a
/usr/lib/gcc/x86_64-redhat-linux/8/32/libgomp.a
/usr/lib/gcc/x86_64-redhat-linux/8/32/libgomp.so
/usr/lib/gcc/x86_64-redhat-linux/8/32/libitm.so
/usr/lib/gcc/x86_64-redhat-linux/8/32/libquadmath.so
/usr/lib/gcc/x86_64-redhat-linux/8/32/libubsan.so
/usr/lib/gcc/x86_64-redhat-linux/8/crtbegin.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtbeginS.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtbeginT.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtendS.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtfastmath.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtoffloadbegin.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtoffloadend.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtoffloadtable.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtprec32.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtprec64.o
/usr/lib/gcc/x86_64-redhat-linux/8/crtprec80.o
/usr/lib/gcc/x86_64-redhat-linux/8/include
/usr/lib/gcc/x86_64-redhat-linux/8/include/adxintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/ammintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx2intrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx5124fmapsintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx5124vnniwintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512bitalgintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512bwintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512cdintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512dqintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512erintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512fintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512ifmaintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512ifmavlintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512pfintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vbmi2intrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vbmi2vlintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vbmiintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vbmivlintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vlbwintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vldqintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vlintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vnniintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vnnivlintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vpopcntdqintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avx512vpopcntdqvlintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/avxintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/bmi2intrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/bmiintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/bmmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/cet.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/cetintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/clflushoptintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/clwbintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/clzerointrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/cpuid.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/cross-stdarg.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/emmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/f16cintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/float.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/fma4intrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/fmaintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/fxsrintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/gcov.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/gfniintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/ia32intrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/immintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/iso646.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/limits.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/lwpintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/lzcntintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/mm3dnow.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/mm_malloc.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/mmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/movdirintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/mwaitxintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/nmmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/omp.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/openacc.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/pconfigintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/pkuintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/pmmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/popcntintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/prfchwintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/rdseedintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/rtmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/sanitizer
/usr/lib/gcc/x86_64-redhat-linux/8/include/sanitizer/asan_interface.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/sanitizer/common_interface_defs.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/sanitizer/lsan_interface.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/sanitizer/tsan_interface.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/sgxintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/shaintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/smmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdalign.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdarg.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdatomic.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdbool.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/stddef.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdfix.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdint-gcc.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdint.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/stdnoreturn.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/syslimits.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/tbmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/tmmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/unwind.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/vaesintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/varargs.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/vpclmulqdqintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/wbnoinvdintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/wmmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/x86intrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/xmmintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/xopintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/xsavecintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/xsaveintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/xsaveoptintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/xsavesintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/include/xtestintrin.h
/usr/lib/gcc/x86_64-redhat-linux/8/libasan.so
/usr/lib/gcc/x86_64-redhat-linux/8/libasan_preinit.o
/usr/lib/gcc/x86_64-redhat-linux/8/libatomic.so
/usr/lib/gcc/x86_64-redhat-linux/8/libgcc.a
/usr/lib/gcc/x86_64-redhat-linux/8/libgcc_eh.a
/usr/lib/gcc/x86_64-redhat-linux/8/libgcc_s.so
/usr/lib/gcc/x86_64-redhat-linux/8/libgcov.a
/usr/lib/gcc/x86_64-redhat-linux/8/libgomp.a
/usr/lib/gcc/x86_64-redhat-linux/8/libgomp.so
/usr/lib/gcc/x86_64-redhat-linux/8/libgomp.spec
/usr/lib/gcc/x86_64-redhat-linux/8/libitm.spec
/usr/lib/gcc/x86_64-redhat-linux/8/liblsan.so
/usr/lib/gcc/x86_64-redhat-linux/8/liblsan_preinit.o
/usr/lib/gcc/x86_64-redhat-linux/8/libsanitizer.spec
/usr/lib/gcc/x86_64-redhat-linux/8/libtsan.so
/usr/lib/gcc/x86_64-redhat-linux/8/libtsan_preinit.o
/usr/lib/gcc/x86_64-redhat-linux/8/libubsan.so
/usr/lib/gcc/x86_64-redhat-linux/8/rpmver
/usr/libexec/gcc
/usr/libexec/gcc/x86_64-redhat-linux
/usr/libexec/gcc/x86_64-redhat-linux/8
/usr/libexec/gcc/x86_64-redhat-linux/8/collect2
/usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so
/usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so.0
/usr/libexec/gcc/x86_64-redhat-linux/8/liblto_plugin.so.0.0.0
/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
/usr/libexec/gcc/x86_64-redhat-linux/8/lto1
/usr/libexec/getconf/default
/usr/share/doc/gcc
/usr/share/doc/gcc/ChangeLog-1997.bz2
/usr/share/doc/gcc/ChangeLog-1998.bz2
/usr/share/doc/gcc/ChangeLog-1999.bz2
/usr/share/doc/gcc/ChangeLog-2000.bz2
/usr/share/doc/gcc/ChangeLog-2001.bz2
/usr/share/doc/gcc/ChangeLog-2002.bz2
/usr/share/doc/gcc/ChangeLog-2003.bz2
/usr/share/doc/gcc/ChangeLog-2004.bz2
/usr/share/doc/gcc/ChangeLog-2005.bz2
/usr/share/doc/gcc/ChangeLog-2006.bz2
/usr/share/doc/gcc/ChangeLog-2007.bz2
/usr/share/doc/gcc/ChangeLog-2008.bz2
/usr/share/doc/gcc/ChangeLog-2009.bz2
/usr/share/doc/gcc/ChangeLog-2010.bz2
/usr/share/doc/gcc/ChangeLog-2011.bz2
/usr/share/doc/gcc/ChangeLog-2012.bz2
/usr/share/doc/gcc/ChangeLog-2013.bz2
/usr/share/doc/gcc/ChangeLog-2014.bz2
/usr/share/doc/gcc/ChangeLog-2015.bz2
/usr/share/doc/gcc/ChangeLog-2016.bz2
/usr/share/doc/gcc/ChangeLog-2017.bz2
/usr/share/doc/gcc/ChangeLog.bz2
/usr/share/doc/gcc/ChangeLog.dataflow.bz2
/usr/share/doc/gcc/ChangeLog.gimple-classes.bz2
/usr/share/doc/gcc/ChangeLog.graphite.bz2
/usr/share/doc/gcc/ChangeLog.jit.bz2
/usr/share/doc/gcc/ChangeLog.lib.bz2
/usr/share/doc/gcc/ChangeLog.ptr.bz2
/usr/share/doc/gcc/ChangeLog.tree-ssa.bz2
/usr/share/doc/gcc/ChangeLog.tuples.bz2
/usr/share/doc/gcc/README.Portability
/usr/share/info/gcc.info.gz
/usr/share/info/gccinstall.info.gz
/usr/share/info/gccint.info.gz
/usr/share/licenses/gcc
/usr/share/licenses/gcc/COPYING
/usr/share/licenses/gcc/COPYING.LIB
/usr/share/licenses/gcc/COPYING.RUNTIME
/usr/share/licenses/gcc/COPYING3
/usr/share/licenses/gcc/COPYING3.LIB
/usr/share/locale/be/LC_MESSAGES/gcc.mo
/usr/share/locale/da/LC_MESSAGES/gcc.mo
/usr/share/locale/de/LC_MESSAGES/gcc.mo
/usr/share/locale/el/LC_MESSAGES/gcc.mo
/usr/share/locale/es/LC_MESSAGES/gcc.mo
/usr/share/locale/fi/LC_MESSAGES/gcc.mo
/usr/share/locale/fr/LC_MESSAGES/gcc.mo
/usr/share/locale/hr/LC_MESSAGES/gcc.mo
/usr/share/locale/id/LC_MESSAGES/gcc.mo
/usr/share/locale/ja/LC_MESSAGES/gcc.mo
/usr/share/locale/nl/LC_MESSAGES/gcc.mo
/usr/share/locale/ru/LC_MESSAGES/gcc.mo
/usr/share/locale/sr/LC_MESSAGES/gcc.mo
/usr/share/locale/sv/LC_MESSAGES/gcc.mo
/usr/share/locale/tr/LC_MESSAGES/gcc.mo
/usr/share/locale/uk/LC_MESSAGES/gcc.mo
/usr/share/locale/vi/LC_MESSAGES/gcc.mo
/usr/share/locale/zh_CN/LC_MESSAGES/gcc.mo
/usr/share/locale/zh_TW/LC_MESSAGES/gcc.mo
/usr/share/man/man1/gcc.1.gz
/usr/share/man/man1/gcov-dump.1.gz
/usr/share/man/man1/gcov-tool.1.gz
/usr/share/man/man1/gcov.1.gz
References
Summary
In this tutorial we learn how to install gcc
on CentOS 8 using yum and dnf.