Centos – Install libxml2 2.7.X on CentOS 5.X

centosglibcyum

CentOS ships with libxml2-2.6.26. I have to install at least 2.7.X version.

I downloaded RPMs for libxml2, libxml2-devel and libxml2-python (2.7.8) from XMLSOFT (http://xmlsoft.org/sources/).

I am trying to install it this way:

# yum localinstall libxml2-2.7.8-1.x86_64.rpm libxml2-devel-2.7.8-1.x86_64.rpm libxml2-python-2.7.8-1.x86_64.rpm

and I get:

Examining libxml2-devel-2.7.8-1.x86_64.rpm: libxml2-devel-2.7.8-1.x86_64
Marking libxml2-devel-2.7.8-1.x86_64.rpm as an update to libxml2-devel-2.6.26-2.1.2.8.el5_5.1.x86_64
Examining libxml2-python-2.7.8-1.x86_64.rpm: libxml2-python-2.7.8-1.x86_64
Marking libxml2-python-2.7.8-1.x86_64.rpm as an update to libxml2-python-2.6.26-2.1.2.8.el5_5.1.x86_64
Resolving Dependencies
--> Running transaction check
---> Package libxml2.x86_64 0:2.7.8-1 set to be updated
--> Processing Dependency: libc.so.6(GLIBC_2.7)(64bit) for package: libxml2
---> Package libxml2-devel.x86_64 0:2.7.8-1 set to be updated
---> Package libxml2-python.x86_64 0:2.7.8-1 set to be updated
--> Processing Dependency: python(abi) = 2.6 for package: libxml2-python
--> Processing Dependency: libpython2.6.so.1.0()(64bit) for package: libxml2-python
--> Running transaction check
---> Package libxml2.x86_64 0:2.7.8-1 set to be updated
--> Processing Dependency: libc.so.6(GLIBC_2.7)(64bit) for package: libxml2
---> Package python26.x86_64 0:2.6.5-6.el5 set to be updated
---> Package python26-libs.x86_64 0:2.6.5-6.el5 set to be updated
--> Finished Dependency Resolution
libxml2-2.7.8-1.x86_64 from /libxml2-2.7.8-1.x86_64 has depsolving problems
  --> Missing Dependency: libc.so.6(GLIBC_2.7)(64bit) is needed by package libxml2-2.7.8-1.x86_64 (/libxml2-2.7.8-1.x86_64)
Error: Missing Dependency: libc.so.6(GLIBC_2.7)(64bit) is needed by package libxml2-2.7.8-1.x86_64 (/libxml2-2.7.8-1.x86_64)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                    package-cleanup --dupes
                    rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.

Is it safe to update also glibc? Or install libxml2 from source?

Best Answer

Make sure you have your development tools installed:

yum groupinstall "Development Tools"

Grab the src rpm:

wget http://xmlsoft.org/sources/libxml2-2.7.8-1.src.rpm

you won't be able to call rpmbuild directly, due to rpm version differnces, so lets short circuit that:

rpm -ivh libxml2-2.7.8-1.src.rpm --nomd5

then:

rpmbuild -ba /usr/src/redhat/SPECS/libxml2.spec

you may be prompted for some dependencies at this point (if so, just yum install the dependencies in question, then rerun the rpmbuild -ba command above).

Assuming your build completes successfully (I just tested this on a CentOS 5 box here, and it built fine), the resulting RPMs will be in:

/usr/src/redhat/RPMS/arch

where "arch" is x86_64 or i386, depending on your system. You can yum localinstall --nogpgcheck the packages from there.