• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • How to install libraries manually in Linux


    I have already written an article with step by step instructions to load modules from kernel during boot stage and also a Guide to blacklist any module during boot up stage.

    Shared libraries relies heavily on concept of libraries. These are the collection of software that are re used by other programs. This avoids having to rewrite the code for functions that are used repeatedly.

    Software libraries can be linked in two ways

    Statically

    These are compiled together with a program to produce a single piece of executable code. this can have advantage of producing executable code that runs quickly. However this disadvantage is that the resulting code tends to be long and so uses large amount of system resources.

    Dynamically

    These are also shared libraries and are loaded into memory as they are needed. This means that the code compiled with dynamically linked libraries has a smaller memory footprint then if it were linked statically.

    Shared libraries are frequently updated. Installing new libraries means that you need to maintain the software that depends on these libraries. We do this in order to avoid or resolve dependencies and conflicts.

    To list the shared libraries
    # ldd /bin/ls
            linux-vdso.so.1 =>  (0x00007fffa9bff000)
            libselinux.so.1 => /lib64/libselinux.so.1 (0x0000003f64600000)
            librt.so.1 => /lib64/librt.so.1 (0x0000003f63600000)
            libcap.so.2 => /lib64/libcap.so.2 (0x0000003f66e00000)
            libacl.so.1 => /lib64/libacl.so.1 (0x0000003f6da00000)
            libc.so.6 => /lib64/libc.so.6 (0x0000003f62e00000)
            libdl.so.2 => /lib64/libdl.so.2 (0x0000003f62a00000)
            /lib64/ld-linux-x86-64.so.2 (0x0000003f62600000)
            libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003f63200000)
            libattr.so.1 => /lib64/libattr.so.1 (0x0000003f73200000)






    Install a library manually

    To install a library file you need to copy the file inside /usr/lib and then run ldconfig (as root). It will install any new library in that directory
    # ldconfig -n -v /usr/lib
    ldconfig  creates  the  necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib).  The cache is used by the run-time linker, ld.so  or  ld-linux.so.ldconfig checks the header and filenames of the libraries it encounters when determining which versions should have their links updated.

    ldconfig  will attempt to deduce the type of ELF libs (i.e., libc5 or libc6/glibc) based on what C libs, if any, the library was linked against.

    NOTE: if you install library in a non standard directory you need to add this path LD_LIBRARY_PATH for Red Hat Linux and SHLIB_PATH for HP-UX

    You can add the path using the below command (path has to be added instead of /usr/lib followed by a colon ":")

    For Red Hat Linux
    # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/local/lib
    For HP-UX (Unix)
    # export SHLIB_PATH=$SHLIB_PATH:/usr/lib:/usr/local/lib



    For making these changes permanent add these path in .bash_profile. For more details follow the below link

    How to set environment (PATH) variable permanently in Linux

    References

    Deepak Prasad

    is a techie and an author who is still trying to survive in this IT generation with very little knowledge he has on Linux/Unix, VMware, SAN Storage, Automation, networking etc

    You can follow him on Facebook or Google+


    Do you also have something to share here?
    Join GoLinuxHub Team as an Author, Click here for more information
    How to install libraries manually in Linux How to install libraries manually in Linux Reviewed by Deepak Prasad on Saturday, March 22, 2014 Rating: 5

    No comments:

    Powered by Blogger.