How to Solve “xz compression not available” Error in Centos

If you want to install or update use the yum command and got this error in Centos server:

error xz compression not available
error xz compression not available

Error: xz compression not available

Here is the solution.

This problem comes if you installed a wrong epel release on your machine. If so, then you need to remove the epel release by

yum remove epel-release

Sometimes that is not enough, you need to remove the cache as well by:

rm -rf /var/cache/yum/x86_64/6/epel

Then you can install the epel-release again

yum -y install epel-release

Hope this help you, I have solved this problem on my server.