• 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.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Saturday, March 22, 2014

    How to install libraries manually in Linux

    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

    Follow the below links for more tutorials

    Configure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    How to configure Samba 4 Secondary Domain Controller
    How to secure Apache web server in Linux using password (.htaccess)
    How to register Red Hat Linux with RHN (Red Hat Network )
    Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
    15 tips to enhance security of your Linux machine
    Why is Linux more secure than windows and any other OS
    What is the difference between "su" and "su -" in Linux?
    What is kernel-PAE in Linux?
    What is swappiness and how do we change its value?
    How to log iptables messages in different log file
    What are the s and k scripts in the etc rcx.d directories
    How to check all the currently running services in Linux
    How to auto start service after reboot in Linux
    What is virtual memory, paging and swap space?

    0 comments:

    Post a Comment