How To Install ccache on CentOS 7

In this tutorial we learn how to install ccache on CentOS 7. ccache is C/C++ compiler cache

Introduction

In this tutorial we learn how to install ccache on CentOS 7.

What is ccache

ccache is a compiler cache. It speeds up recompilation of C/C++ code by caching previous compiles and detecting when the same compile is being done again. The main focus is to handle the GNU C/C++ compiler (GCC), but it may also work with compilers that mimic GCC good enough.

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

Install ccache on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

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

sudo yum -y install ccache

Install ccache on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

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

sudo dnf -y install ccache

How To Uninstall ccache on CentOS 7

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

sudo dnf remove ccache

References

Summary

In this tutorial we learn how to install ccache on CentOS 7 using yum and dnf.