How To Install libxml2 on CentOS 7

In this tutorial we learn how to install libxml2 on CentOS 7. libxml2 is Library providing XML and HTML support

Introduction

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

What is libxml2

This library allows to manipulate XML files. It includes support to read, modify and write XML and HTML files. There is DTDs support this includes parsing and validation even with complex DtDs, either at parse time or later once the document has been modified. The output can be a simple SAX stream or and in-memory DOM like representations. In this case one can use the built-in XPath and XPointer implementation to select sub nodes or ranges. A flexible Input/Output mechanism is available, with existing HTTP and FTP modules and combined to an URI library.

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

Install libxml2 on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

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

sudo yum -y install libxml2

Install libxml2 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 libxml2 using dnf by running the following command:

sudo dnf -y install libxml2

How To Uninstall libxml2 on CentOS 7

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

sudo dnf remove libxml2

References

Summary

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