CentOS-6-686: Maintaining Local Shared Libraries
Rationale
Red Hat Enterprise Linux and CentOS system
administrators may install and maintain software that is not
included in vendor-supported repositories. Such software should be
installed outside the base system, especially if the operating
system is supported by a vendor. For example, /usr/local/share/
is suitable for an application server when client machines that run
the same operating system mount /usr/local/share/ via NFS.
Linux computers use shared object libraries (*.so files) that are
loaded as necessary by the dynamic linker, ld.so(8) or
ld-linux.so(8). Configuration of this system is done by editing
/etc/ld.so.conf and files in the /etc/ld.so.conf.d/ directory.
The configuration can be installed and updated with the ldconfig(8)
command.
Local shared libraries can be maintained by adding one
line to /etc/ld.so.conf. This small modification works well in
enterprise environments where vendors maintain the base
Red Hat Enterprise Linux
or CentOS
system and enterprise system administrators maintain local software.
Local software installation may be done without any further changes
to the vendor-supported system.
Procedures
At Kyoto Notre Dame University I maintain some local software on a vendor-supported application server. The following steps have worked well with Red Hat Enterprise Linux
In order to use add shared library files in /usr/local/share/
directories, I use this method (username and hostname have been
changed for this document):
Edit system configuration for ldconfig(8) in
/etc/ld.so.conf(I did this when our current application server was installed in 2011)greg@gold% ls -l /etc/ld.so.conf -rw-r--r-- 1 root root 77 Oct 2 2011 /etc/ld.so.conf greg@gold% cat /etc/ld.so.conf include ld.so.conf.d/\*.conf include /usr/local/share/etc/ld.so.conf.d/*.confCreate a
*.conffile for each directory in/usr/local/share/:greg@gold% ls -l /usr/local/share/etc/ld.so.conf.d/ total 16 -rw-r--r-- 1 root root 38 Oct 2 2011 ImageMagick.conf -rw-r--r-- 1 root root 29 Feb 5 2012 lib-centos6.conf -rw-r--r-- 1 root root 34 Oct 2 2011 R.conf -rw-r--r-- 1 root root 286 Oct 2 2011 README greg@gold% cat /usr/local/share/etc/ld.so.conf.d/lib-centos6.conf /usr/local/share/lib-centos6I compiled GNU Emacs on a CentOS-6.4 machine with the latest libraries A successful installation of the latest version of GNU Emacs required a newer version of
libjpeg.sothan we had on our application server. The JPEG library in/usr/lib/is older, so I copied a newer library from another machine (latest version of CentOS-6-i686) to a local directory:greg@gold% ls -l /usr/local/share/lib-centos6/ | grep jpeg lrwxrwxrwx 1 root root 17 Mar 21 14:12 libjpeg.so -> libjpeg.so.62.0.0* lrwxrwxrwx 1 root root 17 Mar 21 14:12 libjpeg.so.62 -> libjpeg.so.62.0.0* -rwxr-xr-x 1 root root 291256 Feb 22 07:49 libjpeg.so.62.0.0*Each time we add a library (
*.sofile), "root" must update/etc/ld.so.cache:root@gold ~]# ldconfig [root@gold ~]# ldconfig -p | grep libjpeg libjpeg.so.62 (libc6) => /usr/local/share/lib-centos6/libjpeg.so.62 libjpeg.so.62 (libc6) => /usr/lib/libjpeg.so.62 libjpeg.so (libc6) => /usr/local/share/lib-centos6/libjpeg.so libjpeg.so (libc6) => /usr/lib/libjpeg.so [root@gold ~]#Client machines that mount
/usr/local/share/must update/etc/ld.so.cacheas well. This can be done by running ldconfig(8) if necessary. At our university all client machines are dual-boot Windows 7 and CentOS computers. Students and instructors who use Linux start from cold boot or reboot from Windows 7.
$Id: 20130323-shared-object-libraries.md,v 1.4 2013/03/23 06:40:38 peterson Exp $