Script to install LibXML2 on a Linux CentOS machine via RPM

Install libxml2In simplest terms, LibXML2 is am XML parser.  The project can be found here:

LibXML2 attempts to standardize XML formatting, compiling and rendering across different operating systems, machines and environments.  If you have code that will be doing XML parsing, chances are that you will need this package installed on your server.

At the time of this writing we are grabbing the LibXML2 package from a destination on SourceForge.  it is possible that this link will fail, be changed, etc.  So please keep that in mind when using this script.

During this script we will utilize the RPM package method and install the package via YUM.  Alternative options for installation are available from the projects website.

Lastly, this script already knows which version of the packages to use.  For this script we will use the CentOS 5 version as it is rather old.  If you need to find a different distribution or package you can do so at the following links.  Just replace the link in our WGET command for the link you need to use.



Now let’s get to the installation script

# Set PATH vars
export PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin

# Go to the installation folder 
cd /usr/local

# Download the libxml2 package

# Install the libxml2 package
sudo rpm-ivh libxml2-2.6.26-2.1.25.el5_11.src.rpm

Well, that’s about it.  it’s a pretty straight forward script.  Setup path variables, go to our installation folder, get the package, install it, update yum to grab the latest, all done.



Posted in and tagged , , , , .