Failed to set locale, defaulting to C warning message on CentOS Linux when running yum

Originally published at: https://www.cyberciti.biz/faq/failed-to-set-locale-defaulting-to-c-warning-message-on-centoslinux/

Whenever I run , I get an error or warning that read as Failed to set locale, defaulting to C. How do I fix this issue on CentOS 7 Linux server? Why do I get “Failed to set locale, defaulting to C” when using yum on CentOS 6 or Fedora Linux system? How do I fix it?