Table des matières

Package Management

Compiling Software the Old Way

In order to learn how to compile software, download the hello-2.1.1.tar.gz archive:

[root@centos ~]# wget http://www.linuxelearning.com/downloads/file/hello-2.1.1.tar.gz
--2013-10-29 18:20:09--  http://www.linuxelearning.com/downloads/file/hello-2.1.1.tar.gz
Resolving www.linuxelearning.com... 88.173.201.50, 88.173.201.50
Connecting to www.linuxelearning.com|88.173.201.50|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 389363 (380K) [application/x-gzip]
Saving to: “hello-2.1.1.tar.gz”

100%[======================================>] 389,363     36.9K/s   in 10s     

2013-10-29 18:20:19 (38.1 KB/s) - “hello-2.1.1.tar.gz” saved [389363/389363]

Extract the archive:

[root@centos ~]# tar xvf hello-2.1.1.tar.gz 
hello-2.1.1/
hello-2.1.1/intl/
hello-2.1.1/intl/ChangeLog
hello-2.1.1/intl/Makefile.in
hello-2.1.1/intl/config.charset
hello-2.1.1/intl/locale.alias
hello-2.1.1/intl/ref-add.sin
hello-2.1.1/intl/ref-del.sin
hello-2.1.1/intl/gmo.h
hello-2.1.1/intl/gettextP.h
hello-2.1.1/intl/hash-string.h
hello-2.1.1/intl/plural-exp.h
hello-2.1.1/intl/eval-plural.h
hello-2.1.1/intl/os2compat.h
hello-2.1.1/intl/libgnuintl.h
hello-2.1.1/intl/loadinfo.h
hello-2.1.1/intl/bindtextdom.c
hello-2.1.1/intl/dcgettext.c
hello-2.1.1/intl/dgettext.c
hello-2.1.1/intl/gettext.c
hello-2.1.1/intl/finddomain.c
hello-2.1.1/intl/loadmsgcat.c
hello-2.1.1/intl/localealias.c
hello-2.1.1/intl/textdomain.c
hello-2.1.1/intl/l10nflist.c
hello-2.1.1/intl/explodename.c
hello-2.1.1/intl/dcigettext.c
hello-2.1.1/intl/dcngettext.c
hello-2.1.1/intl/dngettext.c
hello-2.1.1/intl/ngettext.c
hello-2.1.1/intl/plural.y
hello-2.1.1/intl/plural-exp.c
hello-2.1.1/intl/localcharset.c
hello-2.1.1/intl/localename.c
hello-2.1.1/intl/osdep.c
hello-2.1.1/intl/os2compat.c
hello-2.1.1/intl/intl-compat.c
hello-2.1.1/intl/plural.c
hello-2.1.1/intl/VERSION
hello-2.1.1/po/
hello-2.1.1/po/Makefile.in.in
hello-2.1.1/po/Makevars
hello-2.1.1/po/remove-potcdate.sin
hello-2.1.1/po/quot.sed
hello-2.1.1/po/boldquot.sed
hello-2.1.1/po/en@quot.header
hello-2.1.1/po/en@boldquot.header
hello-2.1.1/po/insert-header.sin
hello-2.1.1/po/Rules-quot
hello-2.1.1/po/POTFILES.in
hello-2.1.1/po/hello.pot
hello-2.1.1/po/ca.po
hello-2.1.1/po/da.po
hello-2.1.1/po/de.po
hello-2.1.1/po/de_DE.po
hello-2.1.1/po/el.po
hello-2.1.1/po/eo.po
hello-2.1.1/po/es.po
hello-2.1.1/po/et.po
hello-2.1.1/po/fi.po
hello-2.1.1/po/fr.po
hello-2.1.1/po/gl.po
hello-2.1.1/po/he.po
hello-2.1.1/po/hr.po
hello-2.1.1/po/hu.po
hello-2.1.1/po/id.po
hello-2.1.1/po/it.po
hello-2.1.1/po/ja.po
hello-2.1.1/po/ko.po
hello-2.1.1/po/lv.po
hello-2.1.1/po/nb.po
hello-2.1.1/po/nl.po
hello-2.1.1/po/nn.po
hello-2.1.1/po/pl.po
hello-2.1.1/po/pt.po
hello-2.1.1/po/pt_BR.po
hello-2.1.1/po/ru.po
hello-2.1.1/po/sk.po
hello-2.1.1/po/sl.po
hello-2.1.1/po/sv.po
hello-2.1.1/po/tr.po
hello-2.1.1/po/uk.po
hello-2.1.1/po/ca.gmo
hello-2.1.1/po/da.gmo
hello-2.1.1/po/de.gmo
hello-2.1.1/po/de_DE.gmo
hello-2.1.1/po/el.gmo
hello-2.1.1/po/eo.gmo
hello-2.1.1/po/es.gmo
hello-2.1.1/po/et.gmo
hello-2.1.1/po/fi.gmo
hello-2.1.1/po/fr.gmo
hello-2.1.1/po/gl.gmo
hello-2.1.1/po/he.gmo
hello-2.1.1/po/hr.gmo
hello-2.1.1/po/hu.gmo
hello-2.1.1/po/id.gmo
hello-2.1.1/po/it.gmo
hello-2.1.1/po/ja.gmo
hello-2.1.1/po/ko.gmo
hello-2.1.1/po/lv.gmo
hello-2.1.1/po/nb.gmo
hello-2.1.1/po/nl.gmo
hello-2.1.1/po/nn.gmo
hello-2.1.1/po/pl.gmo
hello-2.1.1/po/pt.gmo
hello-2.1.1/po/pt_BR.gmo
hello-2.1.1/po/ru.gmo
hello-2.1.1/po/sk.gmo
hello-2.1.1/po/sl.gmo
hello-2.1.1/po/sv.gmo
hello-2.1.1/po/tr.gmo
hello-2.1.1/po/uk.gmo
hello-2.1.1/po/ChangeLog
hello-2.1.1/po/LINGUAS
hello-2.1.1/README
hello-2.1.1/ABOUT-NLS
hello-2.1.1/AUTHORS
hello-2.1.1/COPYING
hello-2.1.1/ChangeLog
hello-2.1.1/INSTALL
hello-2.1.1/Makefile.am
hello-2.1.1/Makefile.in
hello-2.1.1/NEWS
hello-2.1.1/THANKS
hello-2.1.1/TODO
hello-2.1.1/aclocal.m4
hello-2.1.1/config.guess
hello-2.1.1/config.h.in
hello-2.1.1/config.rpath
hello-2.1.1/config.sub
hello-2.1.1/configure
hello-2.1.1/configure.ac
hello-2.1.1/depcomp
hello-2.1.1/install-sh
hello-2.1.1/missing
hello-2.1.1/mkinstalldirs
hello-2.1.1/BUGS
hello-2.1.1/ChangeLog.O
hello-2.1.1/contrib/
hello-2.1.1/contrib/ChangeLog
hello-2.1.1/contrib/Makefile.am
hello-2.1.1/contrib/Makefile.in
hello-2.1.1/contrib/de_franconian_po.txt
hello-2.1.1/contrib/evolution.txt
hello-2.1.1/contrib/hello.1
hello-2.1.1/doc/
hello-2.1.1/doc/gpl.texi
hello-2.1.1/doc/ChangeLog
hello-2.1.1/doc/Makefile.am
hello-2.1.1/doc/Makefile.in
hello-2.1.1/doc/mdate-sh
hello-2.1.1/doc/stamp-vti
hello-2.1.1/doc/texinfo.tex
hello-2.1.1/doc/version.texi
hello-2.1.1/doc/hello.texi
hello-2.1.1/doc/hello.info
hello-2.1.1/src/
hello-2.1.1/src/ChangeLog
hello-2.1.1/src/Makefile.am
hello-2.1.1/src/Makefile.in
hello-2.1.1/src/alloca.c
hello-2.1.1/src/hello.c
hello-2.1.1/src/version.c
hello-2.1.1/src/getopt.c
hello-2.1.1/src/getopt1.c
hello-2.1.1/src/getopt.h
hello-2.1.1/src/system.h
hello-2.1.1/man/
hello-2.1.1/man/ChangeLog
hello-2.1.1/man/Makefile.am
hello-2.1.1/man/Makefile.in
hello-2.1.1/man/hello.1
hello-2.1.1/man/help2man
hello-2.1.1/m4/
hello-2.1.1/m4/README
hello-2.1.1/m4/ChangeLog
hello-2.1.1/m4/Makefile.am
hello-2.1.1/m4/Makefile.in
hello-2.1.1/m4/codeset.m4
hello-2.1.1/m4/gettext.m4
hello-2.1.1/m4/glibc21.m4
hello-2.1.1/m4/iconv.m4
hello-2.1.1/m4/isc-posix.m4
hello-2.1.1/m4/lcmessage.m4
hello-2.1.1/m4/lib-ld.m4
hello-2.1.1/m4/lib-link.m4
hello-2.1.1/m4/lib-prefix.m4
hello-2.1.1/m4/progtest.m4
hello-2.1.1/tests/
hello-2.1.1/tests/ChangeLog
hello-2.1.1/tests/Makefile.am
hello-2.1.1/tests/Makefile.in
hello-2.1.1/tests/hello-1
hello-2.1.1/tests/world-1
hello-2.1.1/tests/nothing-1

Change directory:

[root@centos ~]# cd hello-2.1.1/

The first file we need to look at is the README file. This file tells us to look at the INSTALL file:

[root@centos hello-2.1.1]# more INSTALL
Copyright 1994, 1995, 1996, 1999, 2000, 2001 Free Software Foundation,
Inc.

   This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.

Basic Installation
==================

   These are generic installation instructions.

   The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation.  It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions.  Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').

   It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring.  (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
--Plus--(11%)

Reading this file tells us that we need to use four commands:

./configure

<note important> configure is a script that creates makefiles for a specific architecture. makefiles are read by the make command. </note>

[root@centos hello-2.1.1]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets ${MAKE}... yes
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for strerror in -lcposix... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for struct stat.st_blksize... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking build system type... i686-pc-linux
checking host system type... i686-pc-linux
checking for ranlib... ranlib
checking for gcc option to accept ANSI C... none needed
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for off_t... yes
checking for size_t... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking whether we are using the GNU C Library 2.1 or newer... yes
checking for ld used by GCC... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
checking for iconv... yes
checking argz.h usability... yes
checking argz.h presence... yes
checking for argz.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking nl_types.h usability... yes
checking nl_types.h presence... yes
checking for nl_types.h... yes
checking malloc.h usability... yes
checking malloc.h presence... yes
checking for malloc.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... (cached) yes
checking for feof_unlocked... yes
checking for fgets_unlocked... yes
checking for getc_unlocked... yes
checking for getcwd... yes
checking for getegid... yes
checking for geteuid... yes
checking for getgid... yes
checking for getuid... yes
checking for mempcpy... yes
checking for munmap... yes
checking for putenv... yes
checking for setenv... yes
checking for setlocale... yes
checking for stpcpy... yes
checking for strcasecmp... yes
checking for strdup... yes
checking for strtoul... yes
checking for tsearch... yes
checking for __argz_count... yes
checking for __argz_stringify... yes
checking for __argz_next... yes
checking for iconv declaration... 
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for nl_langinfo and CODESET... yes
checking for LC_MESSAGES... yes
checking for bison... no
checking whether NLS is requested... yes
checking whether included gettext is requested... no
checking for GNU gettext in libc... yes
checking for perl... perl
configure: creating ./config.status
config.status: creating Makefile
config.status: creating contrib/Makefile
config.status: creating doc/Makefile
config.status: creating intl/Makefile
config.status: creating man/Makefile
config.status: creating po/Makefile.in
config.status: creating m4/Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default-1 commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
config.status: executing default commands

make

<note important> make calls the different commands that are used to create all the necessary files needed to install hello. </note>

[root@centos hello-2.1.1]# make
make  all-recursive
make[1]: entrant dans le répertoire « /root/hello-2.1.1 »
Making all in contrib
make[2]: entrant dans le répertoire « /root/hello-2.1.1/contrib »
make[2]: Rien à faire pour « all ».
make[2]: quittant le répertoire « /root/hello-2.1.1/contrib »
Making all in doc
make[2]: entrant dans le répertoire « /root/hello-2.1.1/doc »
make[2]: Rien à faire pour « all ».
make[2]: quittant le répertoire « /root/hello-2.1.1/doc »
Making all in intl
make[2]: entrant dans le répertoire « /root/hello-2.1.1/intl »
make[2]: Rien à faire pour « all ».
make[2]: quittant le répertoire « /root/hello-2.1.1/intl »
Making all in po
make[2]: entrant dans le répertoire « /root/hello-2.1.1/po »
make[2]: Rien à faire pour « all ».
make[2]: quittant le répertoire « /root/hello-2.1.1/po »
Making all in src
make[2]: entrant dans le répertoire « /root/hello-2.1.1/src »
source='hello.c' object='hello.o' libtool=no \
	depfile='.deps/hello.Po' tmpdepfile='.deps/hello.TPo' \
	depmode=gcc3 /bin/sh ../depcomp \
	gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl    -g -O2 -c `test -f 'hello.c' || echo './'`hello.c
source='version.c' object='version.o' libtool=no \
	depfile='.deps/version.Po' tmpdepfile='.deps/version.TPo' \
	depmode=gcc3 /bin/sh ../depcomp \
	gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl    -g -O2 -c `test -f 'version.c' || echo './'`version.c
source='getopt.c' object='getopt.o' libtool=no \
	depfile='.deps/getopt.Po' tmpdepfile='.deps/getopt.TPo' \
	depmode=gcc3 /bin/sh ../depcomp \
	gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl    -g -O2 -c `test -f 'getopt.c' || echo './'`getopt.c
source='getopt1.c' object='getopt1.o' libtool=no \
	depfile='.deps/getopt1.Po' tmpdepfile='.deps/getopt1.TPo' \
	depmode=gcc3 /bin/sh ../depcomp \
	gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I. -I.. -I. -I. -I.. -I../intl -I../intl    -g -O2 -c `test -f 'getopt1.c' || echo './'`getopt1.c
gcc  -g -O2   -o hello  hello.o version.o getopt.o getopt1.o  
make[2]: quittant le répertoire « /root/hello-2.1.1/src »
Making all in man
make[2]: entrant dans le répertoire « /root/hello-2.1.1/man »
perl help2man --name="Friendly Greeting Program" ../src/hello >hello.1
make[2]: quittant le répertoire « /root/hello-2.1.1/man »
Making all in m4
make[2]: entrant dans le répertoire « /root/hello-2.1.1/m4 »
make[2]: Rien à faire pour « all ».
make[2]: quittant le répertoire « /root/hello-2.1.1/m4 »
Making all in tests
make[2]: entrant dans le répertoire « /root/hello-2.1.1/tests »
make[2]: Rien à faire pour « all ».
make[2]: quittant le répertoire « /root/hello-2.1.1/tests »
make[2]: entrant dans le répertoire « /root/hello-2.1.1 »
make[2]: quittant le répertoire « /root/hello-2.1.1 »
make[1]: quittant le répertoire « /root/hello-2.1.1 »

make check

<note important> make check checks whether the previous command worked correctly. </note>

[root@centos hello-2.1.1]# make check
Making check in contrib
make[1]: entrant dans le répertoire « /root/hello-2.1.1/contrib »
make[1]: Rien à faire pour « check ».
make[1]: quittant le répertoire « /root/hello-2.1.1/contrib »
Making check in doc
make[1]: entrant dans le répertoire « /root/hello-2.1.1/doc »
make[1]: Rien à faire pour « check ».
make[1]: quittant le répertoire « /root/hello-2.1.1/doc »
Making check in intl
make[1]: entrant dans le répertoire « /root/hello-2.1.1/intl »
make[1]: Rien à faire pour « check ».
make[1]: quittant le répertoire « /root/hello-2.1.1/intl »
Making check in po
make[1]: entrant dans le répertoire « /root/hello-2.1.1/po »
make[1]: Rien à faire pour « check ».
make[1]: quittant le répertoire « /root/hello-2.1.1/po »
Making check in src
make[1]: entrant dans le répertoire « /root/hello-2.1.1/src »
make[1]: Rien à faire pour « check ».
make[1]: quittant le répertoire « /root/hello-2.1.1/src »
Making check in man
make[1]: entrant dans le répertoire « /root/hello-2.1.1/man »
make[1]: Rien à faire pour « check ».
make[1]: quittant le répertoire « /root/hello-2.1.1/man »
Making check in m4
make[1]: entrant dans le répertoire « /root/hello-2.1.1/m4 »
make[1]: Rien à faire pour « check ».
make[1]: quittant le répertoire « /root/hello-2.1.1/m4 »
Making check in tests
make[1]: entrant dans le répertoire « /root/hello-2.1.1/tests »
make  check-TESTS
make[2]: entrant dans le répertoire « /root/hello-2.1.1/tests »
PASS: hello-1
PASS: world-1
PASS: nothing-1
==================
All 3 tests passed
==================
make[2]: quittant le répertoire « /root/hello-2.1.1/tests »
make[1]: quittant le répertoire « /root/hello-2.1.1/tests »
make[1]: entrant dans le répertoire « /root/hello-2.1.1 »
make[1]: quittant le répertoire « /root/hello-2.1.1 »

make install

<note important> make install installs the software. </note>

[root@centos hello-2.1.1]# make install
Making install in contrib
make[1]: entrant dans le répertoire « /root/hello-2.1.1/contrib »
make[2]: entrant dans le répertoire « /root/hello-2.1.1/contrib »
make[2]: Rien à faire pour « install-exec-am ».
make[2]: Rien à faire pour « install-data-am ».
make[2]: quittant le répertoire « /root/hello-2.1.1/contrib »
make[1]: quittant le répertoire « /root/hello-2.1.1/contrib »
Making install in doc
make[1]: entrant dans le répertoire « /root/hello-2.1.1/doc »
make[2]: entrant dans le répertoire « /root/hello-2.1.1/doc »
make[2]: Rien à faire pour « install-exec-am ».
/bin/sh ../mkinstalldirs /usr/local/info
mkdir -p -- /usr/local/info
 /usr/bin/install -c -m 644 ./hello.info /usr/local/info/hello.info
 install-info --info-dir=/usr/local/info /usr/local/info/hello.info
make[2]: quittant le répertoire « /root/hello-2.1.1/doc »
make[1]: quittant le répertoire « /root/hello-2.1.1/doc »
Making install in intl
make[1]: entrant dans le répertoire « /root/hello-2.1.1/intl »
if test "hello" = "gettext" \
	   && test '' = 'intl-compat.o'; then \
	  /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/lib /usr/local/include; \
	  /usr/bin/install -c -m 644 libintl.h /usr/local/include/libintl.h; \
	  @LIBTOOL@ --mode=install \
	    /usr/bin/install -c -m 644 libintl.a /usr/local/lib/libintl.a; \
	else \
	  : ; \
	fi
if test 'no' = yes; then \
	  test yes != no || /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/lib; \
	  temp=/usr/local/lib/t-charset.alias; \
	  dest=/usr/local/lib/charset.alias; \
	  if test -f /usr/local/lib/charset.alias; then \
	    orig=/usr/local/lib/charset.alias; \
	    sed -f ref-add.sed $orig > $temp; \
	    /usr/bin/install -c -m 644 $temp $dest; \
	    rm -f $temp; \
	  else \
	    if test yes = no; then \
	      orig=charset.alias; \
	      sed -f ref-add.sed $orig > $temp; \
	      /usr/bin/install -c -m 644 $temp $dest; \
	      rm -f $temp; \
	    fi; \
	  fi; \
	  /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/share/locale; \
	  test -f /usr/local/share/locale/locale.alias \
	    && orig=/usr/local/share/locale/locale.alias \
	    || orig=./locale.alias; \
	  temp=/usr/local/share/locale/t-locale.alias; \
	  dest=/usr/local/share/locale/locale.alias; \
	  sed -f ref-add.sed $orig > $temp; \
	  /usr/bin/install -c -m 644 $temp $dest; \
	  rm -f $temp; \
	else \
	  : ; \
	fi
if test "hello" = "gettext"; then \
	  /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/share/gettext/intl; \
	  /usr/bin/install -c -m 644 VERSION /usr/local/share/gettext/intl/VERSION; \
	  /usr/bin/install -c -m 644 ChangeLog.inst /usr/local/share/gettext/intl/ChangeLog; \
	  dists="COPYING.LIB-2.0 COPYING.LIB-2.1 Makefile.in config.charset locale.alias ref-add.sin ref-del.sin gmo.h gettextP.h hash-string.h plural-exp.h eval-plural.h os2compat.h libgnuintl.h loadinfo.h bindtextdom.c dcgettext.c dgettext.c gettext.c finddomain.c loadmsgcat.c localealias.c textdomain.c l10nflist.c explodename.c dcigettext.c dcngettext.c dngettext.c ngettext.c plural.y plural-exp.c localcharset.c localename.c osdep.c os2compat.c intl-compat.c"; \
	  for file in $dists; do \
	    /usr/bin/install -c -m 644 ./$file \
			    /usr/local/share/gettext/intl/$file; \
	  done; \
	  chmod a+x /usr/local/share/gettext/intl/config.charset; \
	  dists="plural.c"; \
	  for file in $dists; do \
	    if test -f $file; then dir=.; else dir=.; fi; \
	    /usr/bin/install -c -m 644 $dir/$file \
			    /usr/local/share/gettext/intl/$file; \
	  done; \
	  dists="xopen-msg.sed linux-msg.sed po2tbl.sed.in cat-compat.c COPYING.LIB-2 gettext.h libgettext.h plural-eval.c"; \
	  for file in $dists; do \
	    rm -f /usr/local/share/gettext/intl/$file; \
	  done; \
	else \
	  : ; \
	fi
make[1]: quittant le répertoire « /root/hello-2.1.1/intl »
Making install in po
make[1]: entrant dans le répertoire « /root/hello-2.1.1/po »
/bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/share
mkdir -p -- /usr/local/share/locale/ca/LC_MESSAGES
installing ca.gmo as /usr/local/share/locale/ca/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/da/LC_MESSAGES
installing da.gmo as /usr/local/share/locale/da/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/de/LC_MESSAGES
installing de.gmo as /usr/local/share/locale/de/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/de_DE/LC_MESSAGES
installing de_DE.gmo as /usr/local/share/locale/de_DE/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/el/LC_MESSAGES
installing el.gmo as /usr/local/share/locale/el/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/eo/LC_MESSAGES
installing eo.gmo as /usr/local/share/locale/eo/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/es/LC_MESSAGES
installing es.gmo as /usr/local/share/locale/es/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/et/LC_MESSAGES
installing et.gmo as /usr/local/share/locale/et/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/fi/LC_MESSAGES
installing fi.gmo as /usr/local/share/locale/fi/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/fr/LC_MESSAGES
installing fr.gmo as /usr/local/share/locale/fr/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/gl/LC_MESSAGES
installing gl.gmo as /usr/local/share/locale/gl/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/he/LC_MESSAGES
installing he.gmo as /usr/local/share/locale/he/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/hr/LC_MESSAGES
installing hr.gmo as /usr/local/share/locale/hr/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/hu/LC_MESSAGES
installing hu.gmo as /usr/local/share/locale/hu/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/id/LC_MESSAGES
installing id.gmo as /usr/local/share/locale/id/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/it/LC_MESSAGES
installing it.gmo as /usr/local/share/locale/it/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/ja/LC_MESSAGES
installing ja.gmo as /usr/local/share/locale/ja/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/ko/LC_MESSAGES
installing ko.gmo as /usr/local/share/locale/ko/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/lv/LC_MESSAGES
installing lv.gmo as /usr/local/share/locale/lv/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/nb/LC_MESSAGES
installing nb.gmo as /usr/local/share/locale/nb/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/nl/LC_MESSAGES
installing nl.gmo as /usr/local/share/locale/nl/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/nn/LC_MESSAGES
installing nn.gmo as /usr/local/share/locale/nn/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/pl/LC_MESSAGES
installing pl.gmo as /usr/local/share/locale/pl/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/pt/LC_MESSAGES
installing pt.gmo as /usr/local/share/locale/pt/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/pt_BR/LC_MESSAGES
installing pt_BR.gmo as /usr/local/share/locale/pt_BR/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/ru/LC_MESSAGES
installing ru.gmo as /usr/local/share/locale/ru/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/sk/LC_MESSAGES
installing sk.gmo as /usr/local/share/locale/sk/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/sl/LC_MESSAGES
installing sl.gmo as /usr/local/share/locale/sl/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/sv/LC_MESSAGES
installing sv.gmo as /usr/local/share/locale/sv/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/tr/LC_MESSAGES
installing tr.gmo as /usr/local/share/locale/tr/LC_MESSAGES/hello.mo
mkdir -p -- /usr/local/share/locale/uk/LC_MESSAGES
installing uk.gmo as /usr/local/share/locale/uk/LC_MESSAGES/hello.mo
if test "hello" = "gettext"; then \
	  /bin/sh `case "./mkinstalldirs" in /*) echo "./mkinstalldirs" ;; *) echo ".././mkinstalldirs" ;; esac` /usr/local/share/gettext/po; \
	  for file in Makefile.in.in Makevars remove-potcdate.sin quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot  ; do \
	    /usr/bin/install -c -m 644 ./$file \
			    /usr/local/share/gettext/po/$file; \
	  done; \
	else \
	  : ; \
	fi
make[1]: quittant le répertoire « /root/hello-2.1.1/po »
Making install in src
make[1]: entrant dans le répertoire « /root/hello-2.1.1/src »
make[2]: entrant dans le répertoire « /root/hello-2.1.1/src »
/bin/sh ../mkinstalldirs /usr/local/bin
  /usr/bin/install -c hello /usr/local/bin/hello
make[2]: Rien à faire pour « install-data-am ».
make[2]: quittant le répertoire « /root/hello-2.1.1/src »
make[1]: quittant le répertoire « /root/hello-2.1.1/src »
Making install in man
make[1]: entrant dans le répertoire « /root/hello-2.1.1/man »
make[2]: entrant dans le répertoire « /root/hello-2.1.1/man »
make[2]: Rien à faire pour « install-exec-am ».
/bin/sh ../mkinstalldirs /usr/local/man/man1
mkdir -p -- /usr/local/man/man1
 /usr/bin/install -c -m 644 ./hello.1 /usr/local/man/man1/hello.1
make[2]: quittant le répertoire « /root/hello-2.1.1/man »
make[1]: quittant le répertoire « /root/hello-2.1.1/man »
Making install in m4
make[1]: entrant dans le répertoire « /root/hello-2.1.1/m4 »
make[2]: entrant dans le répertoire « /root/hello-2.1.1/m4 »
make[2]: Rien à faire pour « install-exec-am ».
make[2]: Rien à faire pour « install-data-am ».
make[2]: quittant le répertoire « /root/hello-2.1.1/m4 »
make[1]: quittant le répertoire « /root/hello-2.1.1/m4 »
Making install in tests
make[1]: entrant dans le répertoire « /root/hello-2.1.1/tests »
make[2]: entrant dans le répertoire « /root/hello-2.1.1/tests »
make[2]: Rien à faire pour « install-exec-am ».
make[2]: Rien à faire pour « install-data-am ».
make[2]: quittant le répertoire « /root/hello-2.1.1/tests »
make[1]: quittant le répertoire « /root/hello-2.1.1/tests »
make[1]: entrant dans le répertoire « /root/hello-2.1.1 »
make[2]: entrant dans le répertoire « /root/hello-2.1.1 »
make[2]: Rien à faire pour « install-exec-am ».
make[2]: Rien à faire pour « install-data-am ».
make[2]: quittant le répertoire « /root/hello-2.1.1 »
make[1]: quittant le répertoire « /root/hello-2.1.1 »

Now we can test our newly install software:

[root@centos hello-2.1.1]# hello
Hello, world!

All that work for just one line !

The rpm Command

<note> Move to the /root directory by typing cd ~ in your terminal. </note>

In order to ease the burden of installing, uninstalling and managing software, called packages, CentOS and Red Hat use a special file format called rpm for Redhat Package Manager. The command used to manage packages is also called rpm.

The command line switches of the rpm command are as follows:

[root@centos ~]# rpm --help
Usage: rpm [OPTION...]
  --quiet

Query/Verify package selection options:
  -a, --all                        query/verify all packages
  -f, --file                       query/verify package(s) owning file
  -g, --group                      query/verify package(s) in group
  -p, --package                    query/verify a package file
  -W, --ftswalk                    query/verify package(s) from TOP file tree
                                   walk
  --pkgid                          query/verify package(s) with package
                                   identifier
  --hdrid                          query/verify package(s) with header
                                   identifier
  --fileid                         query/verify package(s) with file identifier
  --specfile                       query a spec file
  --triggeredby                    query the package(s) triggered by the
                                   package
  --whatrequires                   query/verify the package(s) which require a
                                   dependency
  --whatprovides                   query/verify the package(s) which provide a
                                   dependency
  --nomanifest                     do not process non-package files as
                                   manifests

Query options (with -q or --query):
  -c, --configfiles                list all configuration files
  -d, --docfiles                   list all documentation files
  --dump                           dump basic file information
  -l, --list                       list files in package
  --queryformat=QUERYFORMAT        use the following query format
  -s, --state                      display the states of the listed files

Verify options (with -V or --verify):
  --nofiledigest                   don't verify digest of files
  --nomd5                          don't verify digest of files
  --nofiles                        don't verify files in package
  --nodeps                         don't verify package dependencies
  --noscript                       don't execute verify script(s)

File tree walk options (with --ftswalk):
  --comfollow                      follow command line symlinks
  --logical                        logical walk
  --nochdir                        don't change directories
  --nostat                         don't get stat info
  --physical                       physical walk
  --seedot                         return dot and dot-dot
  --xdev                           don't cross devices
  --whiteout                       return whiteout information

Signature options:
  --addsign                        sign package(s) (identical to --resign)
  -K, --checksig                   verify package signature(s)
  --delsign                        delete package signatures
  --import                         import an armored public key
  --resign                         sign package(s) (identical to --addsign)
  --nodigest                       don't verify package digest(s)
  --nosignature                    don't verify package signature(s)

Database options:
  --initdb                         initialize database
  --rebuilddb                      rebuild database inverted lists from
                                   installed package headers

Install/Upgrade/Erase options:
  --aid                            add suggested packages to transaction
  --allfiles                       install all files, even configurations
                                   which might otherwise be skipped
  --allmatches                     remove all packages which match <package>
                                   (normally an error is generated if
                                   <package> specified multiple packages)
  --badreloc                       relocate files in non-relocatable package
  -e, --erase=<package>+           erase (uninstall) package
  --excludedocs                    do not install documentation
  --excludepath=<path>             skip files with leading component <path> 
  --fileconflicts                  detect file conflicts between packages
  --force                          short hand for --replacepkgs --replacefiles
  -F, --freshen=<packagefile>+     upgrade package(s) if already installed
  -h, --hash                       print hash marks as package installs (good
                                   with -v)
  --ignorearch                     don't verify package architecture
  --ignoreos                       don't verify package operating system
  --ignoresize                     don't check disk space before installing
  -i, --install                    install package(s)
  --justdb                         update the database, but do not modify the
                                   filesystem
  --nodeps                         do not verify package dependencies
  --nofiledigest                   don't verify digest of files
  --nomd5                          don't verify digest of files (obsolete)
  --nocontexts                     don't install file security contexts
  --noorder                        do not reorder package installation to
                                   satisfy dependencies
  --nosuggest                      do not suggest missing dependency
                                   resolution(s)
  --noscripts                      do not execute package scriptlet(s)
  --notriggers                     do not execute any scriptlet(s) triggered
                                   by this package
  --oldpackage                     upgrade to an old version of the package
                                   (--force on upgrades does this
                                   automatically)
  --percent                        print percentages as package installs
  --prefix=<dir>                   relocate the package to <dir>, if
                                   relocatable
  --relocate=<old>=<new>           relocate files from path <old> to <new>
  --replacefiles                   ignore file conflicts between packages
  --replacepkgs                    reinstall if the package is already present
  --test                           don't install, but tell if it would work or
                                   not
  -U, --upgrade=<packagefile>+     upgrade package(s)

Common options for all rpm modes and executables:
  -D, --define='MACRO EXPR'        define MACRO with value EXPR
  -E, --eval='EXPR'                print macro expansion of EXPR
  --macros=<FILE:...>              read <FILE:...> instead of default file(s)
  --nodigest                       don't verify package digest(s)
  --nosignature                    don't verify package signature(s)
  --rcfile=<FILE:...>              read <FILE:...> instead of default file(s)
  -r, --root=ROOT                  use ROOT as top level directory (default:
                                   "/")
  --querytags                      display known query tags
  --showrc                         display final rpmrc and macro configuration
  --quiet                          provide less detailed output
  -v, --verbose                    provide more detailed output
  --version                        print the version of rpm being used

Options implemented via popt alias/exec:
  --scripts                        list install/erase scriptlets from
                                   package(s)
  --setperms                       set permissions of files in a package
  --setugids                       set user/group ownership of files in a
                                   package
  --conflicts                      list capabilities this package conflicts
                                   with
  --obsoletes                      list other packages removed by installing
                                   this package
  --provides                       list capabilities that this package provides
  --requires                       list capabilities required by package(s)
  --info                           list descriptive information from package(s)
  --changelog                      list change logs for this package
  --xml                            list metadata in xml
  --triggers                       list trigger scriptlets from package(s)
  --last                           list package(s) by install time, most
                                   recent first
  --dupes                          list duplicated packages
  --filesbypkg                     list all files from each package
  --fileclass                      list file names with classes
  --filecolor                      list file names with colors
  --fscontext                      list file names with security context from
                                   file system
  --fileprovide                    list file names with provides
  --filerequire                    list file names with requires
  --filecaps                       list file names with POSIX1.e capabilities

Help options:
  -?, --help                       Show this help message
  --usage                          Display brief usage message

To view a list of the packages installed on the machine, use the following command:

[root@centos ~]# rpm -qa | more
yum-plugin-security-1.1.30-14.el6.noarch
m17n-contrib-bengali-1.1.10-4.el6_1.1.noarch
libreport-plugin-logger-2.0.9-15.el6.centos.1.i686
device-mapper-libs-1.02.77-9.el6.i686
ca-certificates-2010.63-3.el6_1.5.noarch
system-config-firewall-tui-1.2.27-5.el6.noarch
m17n-contrib-kannada-1.1.10-4.el6_1.1.noarch
sssd-client-1.9.2-82.10.el6_4.i686
dracut-004-303.el6.noarch
iwl6050-firmware-41.28.5.1-2.el6.noarch
m17n-contrib-malayalam-1.1.10-4.el6_1.1.noarch
kpartx-0.4.9-64.el6_4.2.i686
foomatic-db-ppds-4.0-7.20091126.el6.noarch
dmz-cursor-themes-0.4-4.el6.noarch
man-pages-overrides-6.4.1-1.el6.noarch
libavc1394-0.5.3-9.1.el6.i686
samba-winbind-3.6.9-151.el6_4.1.i686
zenity-2.28.0-1.el6.i686
centos-release-6-4.el6.centos.10.i686
m17n-contrib-urdu-1.1.10-4.el6_1.1.noarch
gstreamer-tools-0.10.29-1.el6.i686
libsss_idmap-1.9.2-82.10.el6_4.i686
parted-2.1-19.el6.i686
--More--

You can also use the rpm command to find out how many packages are installed:

[root@centos ~]# rpm -qa | wc -l
964

To search for a specific package, you need to pipe the result into grep:

[root@centos ~]# rpm -qa | grep setup
cryptsetup-luks-1.2.0-7.el6.i686
setuptool-1.19.9-3.el6.i686
cryptsetup-luks-libs-1.2.0-7.el6.i686
setup-2.8.14-20.el6_4.1.noarch
system-setup-keyboard-0.7-4.el6.i686

You can find out the details of a specific package such as setup-2.8.14-20.el6_4.1.noarch by using the following command:

[root@centos ~]# rpm -qi setup
Name        : setup                        Relocations: (not relocatable)
Version     : 2.8.14                            Vendor: CentOS
Release     : 20.el6_4.1                    Build Date: Wed 02 Oct 2013 11:06:19 AM CEST
Install Date: Fri 25 Oct 2013 10:29:56 AM CEST      Build Host: c6b10.bsys.dev.centos.org
Group       : System Environment/Base       Source RPM: setup-2.8.14-20.el6_4.1.src.rpm
Size        : 666477                           License: Public Domain
Signature   : RSA/SHA1, Wed 02 Oct 2013 01:15:22 PM CEST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : https://fedorahosted.org/setup/
Summary     : A set of system configuration and setup files
Description :
The setup package contains a set of important system configuration and
setup files, such as passwd, group, and profile.

Using the l switch with rpm gives a list of all the files installed by a specific package:

[root@centos ~]# rpm -ql setup
/etc/aliases
/etc/bashrc
/etc/csh.cshrc
/etc/csh.login
/etc/environment
/etc/exports
/etc/filesystems
/etc/fstab
/etc/group
/etc/gshadow
/etc/host.conf
/etc/hosts
/etc/hosts.allow
/etc/hosts.deny
/etc/inputrc
/etc/motd
/etc/mtab
/etc/passwd
/etc/printcap
/etc/profile
/etc/profile.d
/etc/protocols
/etc/securetty
/etc/services
/etc/shadow
/etc/shells
/usr/share/doc/setup-2.8.14
/usr/share/doc/setup-2.8.14/COPYING
/usr/share/doc/setup-2.8.14/uidgid
/var/log/lastlog

whilst using the f switch shows the package that installed a specific file:

[root@centos ~]# rpm -qf /etc/exports
setup-2.8.14-20.el6_4.1.noarch

Using the V switch you can check what has changed since a package was first installed:

[root@centos ~]# rpm -qV setup

In the case where the command returns nothing, nothing has changed. If something has changed you would see a line per file with the following keywords:

Keyword Description
5 MD5 Control
S File size
L Symbolic link
T Modification date
D Peripheral
U Owner changed
G Group changed
M Permissions changed
? Unreadable file
Missing File removed

Yellow Dog Updater Modified

Yellow dog Updater, Modified (Yum) is the name of a package management utility, created by Yellow Dog Linux and used by, amongst others CentOS, Redhat and Fedora.

Yum is the equivalent of APT for Debian, urpmi for Mandriva and zypper for SLES/openSUSE.

The command takes the following form :

# yum <switches> <command> <package(s)> [Enter]

The switches and commands specific to yum are shown below:

[root@centos ~]#  yum --help
Loaded plugins: fastestmirror, refresh-packagekit, security
Usage: yum [options] COMMAND

List of Commands:

check          Check for problems in the rpmdb
check-update   Check for available package updates
clean          Remove cached data
deplist        List a package's dependencies
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade      downgrade a package
erase          Remove a package or packages from your system
groupinfo      Display details about a package group
groupinstall   Install the packages in a group on your system
grouplist      List available package groups
groupremove    Remove the packages in a group from your system
help           Display a helpful usage message
history        Display, or use, the transaction history
info           Display details about a package or group of packages
install        Install a package or packages on your system
list           List a package or groups of packages
load-transaction load a saved transaction from filename
makecache      Generate the metadata cache
provides       Find what package provides the given value
reinstall      reinstall a package
repolist       Display the configured software repositories
resolvedep     Determine which package provides the given dependency
search         Search package details for the given string
shell          Run an interactive yum shell
update         Update a package or packages on your system
update-minimal Works like update, but goes to the 'newest' package match which fixes a problem that affects your system
updateinfo     Acts on repository update information
upgrade        Update packages taking obsoletes into account
version        Display a version for the machine and/or available repos.


Options:
  -h, --help            show this help message and exit
  -t, --tolerant        be tolerant of errors
  -C, --cacheonly       run entirely from system cache, don't update cache
  -c [config file], --config=[config file]
                        config file location
  -R [minutes], --randomwait=[minutes]
                        maximum command wait time
  -d [debug level], --debuglevel=[debug level]
                        debugging output level
  --showduplicates      show duplicates, in repos, in list/search commands
  -e [error level], --errorlevel=[error level]
                        error output level
  --rpmverbosity=[debug level name]
                        debugging output level for rpm
  -q, --quiet           quiet operation
  -v, --verbose         verbose operation
  -y, --assumeyes       answer yes for all questions
  --version             show Yum version and exit
  --installroot=[path]  set install root
  --enablerepo=[repo]   enable one or more repositories (wildcards allowed)
  --disablerepo=[repo]  disable one or more repositories (wildcards allowed)
  -x [package], --exclude=[package]
                        exclude package(s) by name or glob
  --disableexcludes=[repo]
                        disable exclude from main, for a repo or for
                        everything
  --obsoletes           enable obsoletes processing during updates
  --noplugins           disable Yum plugins
  --nogpgcheck          disable gpg signature checking
  --disableplugin=[plugin]
                        disable plugins by name
  --enableplugin=[plugin]
                        enable plugins by name
  --skip-broken         skip packages with depsolving problems
  --color=COLOR         control whether color is used
  --releasever=RELEASEVER
                        set value of $releasever in yum config and repo files
  --setopt=SETOPTS      set arbitrary config and repo options

  Plugin Options:
    --security          Include security relevant packages
    --bugfixes          Include bugfix relevant packages
    --cve=CVE           Include packages needed to fix the given CVE
    --bz=BZ             Include packages needed to fix the given BZ
    --sec-severity=SEVERITY
                        Include security relevant packages, of this severity
    --advisory=ADVISORY
                        Include packages needed to fix the given advisory

Configuration

Yum's principal configuration file is /etc/yum.conf :

[root@centos ~]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

Repositories

<note important> A repository is generally an Internet based data base containing pre-compiled, installable packages. </note>

Repositories are listed in the yum.conf file, or in repository specific files in /etc/yum.repos.d:

[root@centos ~]#  ls /etc/yum.repos.d/
atomic.repo            chromium-el6.repo   mirrors-rpmforge-extras
CentOS-Base.repo       epel.repo           mirrors-rpmforge-testing
CentOS-Debuginfo.repo  epel-testing.repo   rpmforge.repo
CentOS-Media.repo      google-chrome.repo
CentOS-Vault.repo      mirrors-rpmforge

For example:

[root@centos ~]# cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

Usage

The most frequently used switches are as follows:

Switch Description
-y Automatically replies yes to any question asked by yum.
-t Makes yum tolerant. In other words if two packages are being installed and the first fails, yum will continue with the second installation.
- -exclude=<package> Exclude the package from the current transaction

The most frequently used commands are as follows:

Command Description
install Install one or several packages.
update Update one, several or all packages.
check-update Show a list of available updates.
remove Removes a package.
provides Show a list of packages that provide a particular file or characteristic.
search Find a package that has a specific string in it's description.
list Find a package that has a specific string in it's name.
localinstall Install one or several locally stored packages.

LAB #1 - Working with Yum

Start by installing the mc package:

[root@centos ~]# yum install mc
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: www7.atomicorp.com
 * base: ftp.ciril.fr
 * epel: mirror.ibcp.fr
 * extras: ftp.ciril.fr
 * rpmforge: ftp.fi.muni.cz
 * updates: mirror.in2p3.fr
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mc.i686 1:4.7.0.2-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================
 Package      Arch           Version                      Repository      Size
===============================================================================
Installing:
 mc           i686           1:4.7.0.2-3.el6              base           1.6 M

Transaction Summary
===============================================================================
Install       1 Package(s)

Total download size: 1.6 M
Installed size: 5.4 M
Is this ok [y/N]: y
Downloading Packages:
mc-4.7.0.2-3.el6.i686.rpm                               | 1.6 MB     00:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 1:mc-4.7.0.2-3.el6.i686                                     1/1 
  Verifying  : 1:mc-4.7.0.2-3.el6.i686                                     1/1 

Installed:
  mc.i686 1:4.7.0.2-3.el6                                                      

Complete!

<note important> mc is a terminal file manager. Type the command mc and spend 15 minutes experimenting with the graphical interface. </note>

Now uninstall it:

[root@centos ~]# yum remove mc
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package mc.i686 1:4.7.0.2-3.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================
 Package      Arch           Version                     Repository       Size
===============================================================================
Removing:
 mc           i686           1:4.7.0.2-3.el6             @base           5.4 M

Transaction Summary
===============================================================================
Remove        1 Package(s)

Installed size: 5.4 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : 1:mc-4.7.0.2-3.el6.i686                                     1/1 
  Verifying  : 1:mc-4.7.0.2-3.el6.i686                                     1/1 

Removed:
  mc.i686 1:4.7.0.2-3.el6                                                      

Complete!

Now search for a package called mc :

[root@centos ~]# yum list mc
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: www7.atomicorp.com
 * base: ftp.ciril.fr
 * epel: mirror.ibcp.fr
 * extras: ftp.ciril.fr
 * rpmforge: repository.vsb.cz
 * updates: mirror.in2p3.fr
Available Packages
mc.i686                          1:4.7.0.2-3.el6                           base

You can also search using wildcards such as:

[root@centos ~]# yum list kerne\*
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: www7.atomicorp.com
 * base: ftp.ciril.fr
 * epel: mirror.ibcp.fr
 * extras: ftp.ciril.fr
 * rpmforge: be.mirror.eurid.eu
 * updates: distrib-coffee.ipsl.jussieu.fr
Installed Packages
kernel.i686                                                        2.6.32-358.el6                                                 @anaconda-CentOS-201303020136.i386/6.4
kernel.i686                                                        2.6.32-358.23.2.el6                                            @updates                              
kernel-devel.i686                                                  2.6.32-358.23.2.el6                                            @updates                              
kernel-firmware.noarch                                             2.6.32-358.23.2.el6                                            @updates                              
kernel-headers.i686                                                2.6.32-358.23.2.el6                                            @updates                              
Available Packages
kernel-debug.i686                                                  2.6.32-358.23.2.el6                                            updates                               
kernel-debug-devel.i686                                            2.6.32-358.23.2.el6                                            updates                               
kernel-doc.noarch                                                  2.6.32-358.23.2.el6                                            updates                               
kerneloops.i686                                                    0.11-1.el6.rf                                                  rpmforge     

Searching can also be accomplished by using a string, in our case mc:

[root@centos ~]# yum search mc
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: www7.atomicorp.com
 * base: ftp.ciril.fr
 * epel: mirror.ibcp.fr
 * extras: ftp.ciril.fr
 * rpmforge: be.mirror.eurid.eu
 * updates: mirror.in2p3.fr
epel/pkgtags                                                                                                                                     | 648 kB     00:00     
=========================================================================== N/S Matched: mc ============================================================================
php-pecl-memcached.i686 : Extension to work with the Memcached caching daemon
php-pecl-memcache.i686 : Extension to work with the Memcached caching daemon
phpMemcachedAdmin.noarch : Graphic stand-alone administration for memcached to monitor and debug purpose
python-django-tinymce.noarch : A Django application that contains a widget to render a form field as a TinyMCE editor.
abrt-addon-vmcore.i686 : abrt's vmcore addon
apache-tomcat-apis.noarch : Tomcat Servlet and JSP APIs
atomic-php54-php-mcrypt.i686 : Standard PHP module provides mcrypt library support
atomic-php55-php-mcrypt.i686 : Standard PHP module provides mcrypt library support
compat-libtermcap.i686 : A basic system library for accessing the termcap database
dmlite-plugins-memcache.i686 : Memcached plugin for dmlite
emacs-systemc-mode.i686 : Elisp source files for systemc-mode under GNU Emacs
freeipmi-bmc-watchdog.i686 : IPMI BMC watchdog
hamcrest-demo.i686 : Demos for hamcrest
hamcrest-javadoc.noarch : Javadoc for hamcrest
jakarta-commons-collections-tomcat5.noarch : Jakarta Commons Collection dependency for Tomcat5
jakarta-commons-dbcp-tomcat5.noarch : DBCP dependency for Tomcat5
jakarta-commons-pool-tomcat5.i686 : Pool dependency for Tomcat5
jglobus-ssl-proxies-tomcat.noarch : Globus Java - SSL and proxy certificate support for Tomcat
libXdmcp-devel.i686 : Development files for libXdmcp
libXvMC.i686 : X.Org X11 libXvMC runtime library
libXvMC-devel.i686 : X.Org X11 libXvMC development package
libmcrypt-devel.i686 : Header files, libraries and development documentation for libmcrypt.
libmcrypto-devel.i686 : Development files for the libmcrypto library
libmcs-devel.i686 : Header files, libraries and development documentation for libmcs.
libmemcache.i686 : A client library for memcached
libmemcache-devel.i686 : Header files, libraries and development documentation for libmemcache
libmemcached.i686 : Client library and command line tools for memcached server
libmemcached-devel.i686 : Header files and development libraries for libmemcached
libtomcrypt-devel.i686 : Development files for libtomcrypt
libtomcrypt-doc.noarch : Documentation files for libtomcrypt
mcollective-client.noarch : Client tools for the mcollective application server
mcollective-common.noarch : Common libraries for the mcollective clients and servers
mcu8051ide.noarch : IDE for MCS-51 based microcontrollers
memcached-devel.i686 : Files needed for development using memcached protocol
pcmciautils.i686 : PCMCIA utilities and initialization programs
perl-Apache-Session-Memcached.noarch : Perl module to store persistent data using memcached
perl-Cache-Memcached.noarch : Perl client for memcached
perl-Memcached-libmemcached.i686 : Thin fast full interface to the libmemcached client API
php-ZendFramework-Cache-Backend-Libmemcached.noarch : Zend Framework libmemcache cache backend
php-ZendFramework-Cache-Backend-Memcached.noarch : Zend Framework memcache cache backend
php-horde-Horde-Memcache.noarch : Horde Memcache API
php-mcrypt.i686 : Standard PHP module provides mcrypt library support
php-symfony2-DomCrawler.noarch : Symfony2 DomCrawler Component
pythia8-hepmcinterface.i686 : Pythia 8 HepMC Interface
pythia8-hepmcinterface-devel.i686 : Pythia 8 HepMC Interface Development Files
python-memcached.noarch : A Python memcached client library
remctl-devel.i686 : Development files needed to compile C programs against remctl
remctl-perl.i686 : Perl interface to remctl
remctl-php.i686 : PHP interface to remctl
remctl-python.i686 : Python interface to remctl
remctl-ruby.i686 : Ruby interface to remctl
simcrs-devel.i686 : Header files, libraries and development helper tools for simcrs
simcrs-doc.noarch : HTML documentation for the simcrs library
smc-fonts-common.noarch : Common files for smc-fonts
strongswan-tnc-imcvs.i686 : Trusted network connect (TNC)'s IMC/IMV functionality
tinymce-spellchecker.noarch : TinyMCE spellchecker plugin
tomcat-native.i686 : Tomcat native library
tomcat6-admin-webapps.noarch : The host-manager and manager web applications for Apache Tomcat
tomcat6-docs-webapp.noarch : The docs web application for Apache Tomcat
tomcat6-javadoc.noarch : Javadoc generated documentation for Apache Tomcat
tomcat6-jsp-2.1-api.noarch : Apache Tomcat JSP API implementation classes
tomcat6-lib.noarch : Libraries needed to run the Tomcat Web container
tomcat6-log4j.noarch : Log4J support for Apache Tomcat
tomcat6-servlet-2.5-api.noarch : Apache Tomcat Servlet API implementation classes
tomcat6-webapps.noarch : The ROOT and examples web applications for Apache Tomcat
tomcatjss.noarch : JSSE implementation using JSS for Tomcat
HepMC.i686 : C++ Event Record for Monte Carlo Generators
HepMC-devel.i686 : C++ Event Record for Monte Carlo Generators - development files
HepMC-doc.noarch : C++ Event Record for Monte Carlo Generators - documentation
emacs-vregs-mode.noarch : Elisp source files for systemc-vregs under GNU Emacs
fence-virtd-serial.i686 : Serial VMChannel listener for fence-virtd
geda-gsymcheck.i686 : Symbol checker for electronics schematics editor
glite-security-trustmanager-tomcat6.noarch : Java trustmanager interface supporting a GSI grid name space
hamcrest.i686 : Library of matchers for building test expressions
imcom.i686 : Command line Jabber client written in Python
libXdmcp.i686 : X Display Manager Control Protocol library
libmcpp.i686 : Alternative C/C++ preprocessor (library build)
libmcpp-devel.i686 : Alternative C/C++ preprocessor (development package for library build)
libmcrypt.i686 : Data encryption library
libmcrypto.i686 : A C++ library providing various cryptography related utilities
libmcs.i686 : Configuration file abstraction library
libtomcrypt.i686 : A comprehensive, portable cryptographic toolkit
mc.i686 : User-friendly text console file manager and visual shell
mcabber.i686 : Console jabber client
mcollective.noarch : A framework to build server orchestration or parallel job execution systems
mcpp.i686 : Alternative C/C++ preprocessor
mcpp-doc.i686 : Alternative C/C++ preprocessor (manual for library build)
mcrypt.i686 : Replacement for crypt()
mcstrans.i686 : SELinux Translation Daemon
memcached.i686 : High Performance, Distributed Memory Object Cache
nodejs-npmconf.noarch : npm configuration module
perl-Acme-CramCode.noarch : Perl module to compress your code
perl-Class-DBI-FromCGI.noarch : Perl module to update Class::DBI data using CGI::Untaint
perl-Sys-AlarmCall.noarch : Perl module to handle the logic in timing out calls with alarm()
perl-SystemC-Vregs.noarch : Utility routines used by vregs
python-quantumclient.noarch : Python API and CLI for OpenStack Quantum
remctl.i686 : Client/server for Kerberos-authenticated command execution
root-montecarlo-vmc.i686 : Virtual Monte-Carlo (simulation) library for ROOT
rpmconf.noarch : Tool to handle rpmnew and rpmsave files
sblim-wbemcli.i686 : SBLIM WBEM Command Line Interface
simcrs.i686 : C++ Simulated Travel-Oriented Distribution System library
smc-anjalioldlipi-fonts.noarch : Open Type Fonts for Malayalam script
smc-dyuthi-fonts.noarch : Open Type Fonts for Malayalam script
smc-kalyani-fonts.noarch : Open Type Fonts for Malayalam script
smc-meera-fonts.noarch : Open Type Fonts for Malayalam script
smc-rachana-fonts.noarch : Open Type Fonts for Malayalam script
smc-raghumalayalam-fonts.noarch : Open Type Fonts for Malayalam script
smc-suruma-fonts.noarch : Open Type Fonts for Malayalam script
tinymce.noarch : Web based Javascript HTML WYSIWYG editor control
tomcat6.noarch : Apache Servlet/JSP Engine, RI for Servlet 2.5/JSP 2.1 API
tomcat6-el-2.1-api.noarch : Expression Language v1.0 API
wmctrl.i686 : Command line tool to interact with an X Window Manager
xorg-x11-drv-intel-devel.i686 : Xorg X11 Intel video driver XvMC development package
xorg-x11-drv-openchrome-devel.i686 : Xorg X11 openchrome video driver XvMC development package

  Name and summary matches only, use "search all" for everything.

Yum also allows you to search for a specific binary:

[root@centos ~]# yum provides mc
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: www7.atomicorp.com
 * base: ftp.ciril.fr
 * epel: mirror.ibcp.fr
 * extras: ftp.ciril.fr
 * rpmforge: be.mirror.eurid.eu
 * updates: mirror.in2p3.fr
1:mc-4.7.0.2-3.el6.i686 : User-friendly text console file manager and visual shell
Repo        : base
Matched from:

Now list the repositories known to Yum on your machine:

[root@centos ~]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: www7.atomicorp.com
 * base: ftp.ciril.fr
 * epel: mirror.ibcp.fr
 * extras: ftp.ciril.fr
 * rpmforge: nl.mirror.eurid.eu
 * updates: mirror.in2p3.fr
repo id                                                  repo name                                                                                                status
atomic                                                   CentOS / Red Hat Enterprise Linux 6 - atomicrocketturtle.com                                               762
base                                                     CentOS-6 - Base                                                                                          4,802
chromium-el6                                             CentOS-6 - Chromium EL6                                                                                      4
epel                                                     Extra Packages for Enterprise Linux 6 - i386                                                             8,176
extras                                                   CentOS-6 - Extras                                                                                           12
google-chrome                                            google-chrome - 32-bit                                                                                       3
rpmforge                                                 RHEL 6 - RPMforge.net - dag                                                                              4,711
updates                                                  CentOS-6 - Updates                                                                                       1,091
repolist: 19,561

Check for existing updates to the installed packages:

[root@centos ~]# yum check-update
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: www7.atomicorp.com
 * base: ftp.ciril.fr
 * epel: mirror.ibcp.fr
 * extras: ftp.ciril.fr
 * rpmforge: ftp.heanet.ie
 * updates: mirror.in2p3.fr

device-mapper.i686                                                                   1.02.77-9.el6_4.2                                                           updates
device-mapper-event.i686                                                             1.02.77-9.el6_4.2                                                           updates
device-mapper-event-libs.i686                                                        1.02.77-9.el6_4.2                                                           updates
device-mapper-libs.i686                                                              1.02.77-9.el6_4.2                                                           updates
firefox.i686                                                                         17.0.10-1.el6.centos                                                        updates
gnupg2.i686                                                                          2.0.14-6.el6_4                                                              updates
libgcrypt.i686                                                                       1.4.5-11.el6_4                                                              updates
lvm2.i686                                                                            2.02.98-9.el6_4.2                                                           updates
lvm2-libs.i686                                                                       2.02.98-9.el6_4.2                                                           updates
rsync.i686                                                                           3.0.6-9.el6_4.1                                                             updates
selinux-policy.noarch                                                                3.7.19-195.el6_4.18                                                         updates
selinux-policy-targeted.noarch                                                       3.7.19-195.el6_4.18                                                         updates
xulrunner.i686                                                                       17.0.10-1.el6.centos                                                        updates

Update your system:

[root@centos ~]# yum update
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * atomic: www7.atomicorp.com
 * base: ftp.ciril.fr
 * epel: mirror.ibcp.fr
 * extras: ftp.ciril.fr
 * rpmforge: be.mirror.eurid.eu
 * updates: mirror.in2p3.fr
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package device-mapper.i686 0:1.02.77-9.el6 will be updated
---> Package device-mapper.i686 0:1.02.77-9.el6_4.2 will be an update
---> Package device-mapper-event.i686 0:1.02.77-9.el6 will be updated
---> Package device-mapper-event.i686 0:1.02.77-9.el6_4.2 will be an update
---> Package device-mapper-event-libs.i686 0:1.02.77-9.el6 will be updated
---> Package device-mapper-event-libs.i686 0:1.02.77-9.el6_4.2 will be an update
---> Package device-mapper-libs.i686 0:1.02.77-9.el6 will be updated
---> Package device-mapper-libs.i686 0:1.02.77-9.el6_4.2 will be an update
---> Package firefox.i686 0:17.0.9-1.el6.centos will be updated
---> Package firefox.i686 0:17.0.10-1.el6.centos will be an update
---> Package gnupg2.i686 0:2.0.14-4.el6 will be updated
---> Package gnupg2.i686 0:2.0.14-6.el6_4 will be an update
---> Package libgcrypt.i686 0:1.4.5-9.el6_2.2 will be updated
---> Package libgcrypt.i686 0:1.4.5-11.el6_4 will be an update
---> Package lvm2.i686 0:2.02.98-9.el6 will be updated
---> Package lvm2.i686 0:2.02.98-9.el6_4.2 will be an update
---> Package lvm2-libs.i686 0:2.02.98-9.el6 will be updated
---> Package lvm2-libs.i686 0:2.02.98-9.el6_4.2 will be an update
---> Package rsync.i686 0:3.0.6-9.el6 will be updated
---> Package rsync.i686 0:3.0.6-9.el6_4.1 will be an update
---> Package selinux-policy.noarch 0:3.7.19-195.el6_4.12 will be updated
---> Package selinux-policy.noarch 0:3.7.19-195.el6_4.18 will be an update
---> Package selinux-policy-targeted.noarch 0:3.7.19-195.el6_4.12 will be updated
---> Package selinux-policy-targeted.noarch 0:3.7.19-195.el6_4.18 will be an update
---> Package xulrunner.i686 0:17.0.9-1.el6.centos will be updated
---> Package xulrunner.i686 0:17.0.10-1.el6.centos will be an update
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
 Package                                           Arch                            Version                                       Repository                        Size
========================================================================================================================================================================
Updating:
 device-mapper                                     i686                            1.02.77-9.el6_4.2                             updates                          144 k
 device-mapper-event                               i686                            1.02.77-9.el6_4.2                             updates                           97 k
 device-mapper-event-libs                          i686                            1.02.77-9.el6_4.2                             updates                           91 k
 device-mapper-libs                                i686                            1.02.77-9.el6_4.2                             updates                          170 k
 firefox                                           i686                            17.0.10-1.el6.centos                          updates                           25 M
 gnupg2                                            i686                            2.0.14-6.el6_4                                updates                          1.6 M
 libgcrypt                                         i686                            1.4.5-11.el6_4                                updates                          228 k
 lvm2                                              i686                            2.02.98-9.el6_4.2                             updates                          667 k
 lvm2-libs                                         i686                            2.02.98-9.el6_4.2                             updates                          730 k
 rsync                                             i686                            3.0.6-9.el6_4.1                               updates                          329 k
 selinux-policy                                    noarch                          3.7.19-195.el6_4.18                           updates                          1.8 M
 selinux-policy-targeted                           noarch                          3.7.19-195.el6_4.18                           updates                          2.8 M
 xulrunner                                         i686                            17.0.10-1.el6.centos                          updates                           14 M

Transaction Summary
========================================================================================================================================================================
Upgrade      13 Package(s)

Total download size: 48 M
Is this ok [y/N]: y

<note> Whilst the system updates, take 15 minutes to review the Yum manual. </note>

Shared Libraries

Presentation

Introduction

Shared Libraries are bits of common code used by several programs in the same domain ( sound, databases, video e.t.c. ). The functions porposed by one or several shared libraries are refered to as an API (Application Programming Interface). Under Linux, shared libraries are refered to as Shared Objects and have a .so suffix.

Shared Object Locations

Shared Objects are stored in lib directories, for example:

Directory Contents
/lib System Shared Objects
/usr/lib User Shared Objects
/usr/local/lib Local Shared Objects
/usr/X11R6/lib Graphical System Shared Objects
/opt/kde4/lib Shared Objects for KDE

<note important> The most important Shared Object is libc. Without libc, Linux will not function. </note>

ld-linux.so.2

The Shared Object ld-linux.so.2 is used to create a link between a Shared Object and an executable when the latter starts. For this reason, ld-linux.so.2 is often refered to as the Link Loader. ld-linux.so.2 looks for Shared Objects in the following places and in the order shown:

The contents of the cache file are built from the information contained within the /etc/ld.so.conf file.

In order to study the impact of a missing Shared Object, re-install mc.

The ldd Command

To determine which Shared Objects are linked to a binary, use the ldd command:

[root@centos ~]# ldd /usr/bin/mc
	linux-gate.so.1 =>  (0x002fd000)
	libgpm.so.2 => /usr/lib/libgpm.so.2 (0x00d75000)
	libslang.so.2 => /usr/lib/libslang.so.2 (0x00148000)
	libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x002fe000)
	libc.so.6 => /lib/libc.so.6 (0x00bb8000)
	libdl.so.2 => /lib/libdl.so.2 (0x00d51000)
	libm.so.6 => /lib/libm.so.6 (0x00d80000)
	/lib/ld-linux.so.2 (0x00b92000)

Now let us see what happens when a Shared Object is missing. Rename the /usr/lib/libslang.so.2 to /usr/lib/libslang.so.2.old:

[root@centos ~]# mv /usr/lib/libslang.so.2 /usr/lib/libslang.so.2.old

Run the ldd command again:

[root@centos ~]# ldd /usr/bin/mc
	linux-gate.so.1 =>  (0x00843000)
	libgpm.so.2 => /usr/lib/libgpm.so.2 (0x00d75000)
	libslang.so.2 => not found
	libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00101000)
	libc.so.6 => /lib/libc.so.6 (0x00bb8000)
	/lib/ld-linux.so.2 (0x00b92000)

Note the presence of the line libslang.so.2 ⇒ not found. In such a scenario mc will not launch:

[root@centos ~]# mc
mc: error while loading shared libraries: libslang.so.2: cannot open shared object file: No such file or directory

Correct the previous error and check that all is OK:

[root@centos ~]# mv /usr/lib/libslang.so.2.old /usr/lib/libslang.so.2
[root@centos ~]# ldd /usr/bin/mc 
	linux-gate.so.1 =>  (0x00aee000)
	libgpm.so.2 => /usr/lib/libgpm.so.2 (0x00b9e000)
	libslang.so.2 => /usr/lib/libslang.so.2 (0x00110000)
	libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00ba9000)
	libc.so.6 => /lib/libc.so.6 (0x00225000)
	libdl.so.2 => /lib/libdl.so.2 (0x00b4e000)
	libm.so.6 => /lib/libm.so.6 (0x00b72000)
	/lib/ld-linux.so.2 (0x0099e000)

The /etc/ld.so.conf File

The /etc/ld.so.conf file is used to configure the cache: /etc/ld.so.cache :

[root@centos ~]# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf

As you can see, this file contains just one include directive that points to the /etc/ld.so.conf.d/ directory:

[root@centos ~]# ls -l /etc/ld.so.conf.d/
total 24
-r--r--r--. 1 root root 324 Oct 16 19:43 kernel-2.6.32-358.23.2.el6.i686.conf
-r--r--r--. 1 root root 324 Feb 21  2013 kernel-2.6.32-358.el6.i686.conf
-rw-r--r--. 1 root root  15 Feb 26  2012 mysqlclient16-i386.conf
-rw-r--r--. 1 root root  15 Aug  2 23:08 mysql-i386.conf
-rw-r--r--. 1 root root  20 Sep 23  2011 qt-i386.conf
-rw-r--r--. 1 root root  19 Oct 29 22:25 xulrunner-32.conf

The contents of the three files that concern applications are as follows:

[root@centos ~]# cat /etc/ld.so.conf.d/mysql-i386.conf
/usr/lib/mysql
[root@centos ~]# cat /etc/ld.so.conf.d/qt-i386.conf 
/usr/lib/qt-3.3/lib
[root@centos ~]# cat /etc/ld.so.conf.d/xulrunner-32.conf
/usr/lib/xulrunner-1.9.2

The ldconfig Command

The ldconfig command is used to:

When used with the -p switch, the ldconfig command shows the cntents of the cache:

[root@centos ~]# ldconfig -p | more
654 libs found in cache `/etc/ld.so.cache'
	libz.so.1 (libc6) => /lib/libz.so.1
	libxul.so (libc6) => /usr/lib/xulrunner/libxul.so
	libxtables.so.4 (libc6) => /lib/libxtables.so.4
	libxslt.so.1 (libc6) => /usr/lib/libxslt.so.1
	libxpcom.so (libc6) => /usr/lib/xulrunner/libxpcom.so
	libxml2.so.2 (libc6) => /usr/lib/libxml2.so.2
	libxmlrpc_util.so.3 (libc6) => /usr/lib/libxmlrpc_util.so.3
	libxmlrpc_server_cgi.so.3 (libc6) => /usr/lib/libxmlrpc_server_cgi.so.3
	libxmlrpc_server_abyss.so.3 (libc6) => /usr/lib/libxmlrpc_server_abyss.so.3
	libxmlrpc_server.so.3 (libc6) => /usr/lib/libxmlrpc_server.so.3
	libxmlrpc_client.so.3 (libc6) => /usr/lib/libxmlrpc_client.so.3
	libxmlrpc_abyss.so.3 (libc6) => /usr/lib/libxmlrpc_abyss.so.3
	libxmlrpc.so.3 (libc6) => /usr/lib/libxmlrpc.so.3
	libxklavier.so.15 (libc6) => /usr/lib/libxklavier.so.15
	libxkbfile.so.1 (libc6) => /usr/lib/libxkbfile.so.1
	libxcb.so.1 (libc6) => /usr/lib/libxcb.so.1
	libxcb-xvmc.so.0 (libc6) => /usr/lib/libxcb-xvmc.so.0
	libxcb-xv.so.0 (libc6) => /usr/lib/libxcb-xv.so.0
	libxcb-xtest.so.0 (libc6) => /usr/lib/libxcb-xtest.so.0
	libxcb-xselinux.so.0 (libc6) => /usr/lib/libxcb-xselinux.so.0
	libxcb-xinerama.so.0 (libc6) => /usr/lib/libxcb-xinerama.so.0
	libxcb-xf86dri.so.0 (libc6) => /usr/lib/libxcb-xf86dri.so.0
	libxcb-xfixes.so.0 (libc6) => /usr/lib/libxcb-xfixes.so.0
	libxcb-xevie.so.0 (libc6) => /usr/lib/libxcb-xevie.so.0
	libxcb-sync.so.0 (libc6) => /usr/lib/libxcb-sync.so.0
	libxcb-shm.so.0 (libc6) => /usr/lib/libxcb-shm.so.0
	libxcb-shape.so.0 (libc6) => /usr/lib/libxcb-shape.so.0
	libxcb-screensaver.so.0 (libc6) => /usr/lib/libxcb-screensaver.so.0
	libxcb-res.so.0 (libc6) => /usr/lib/libxcb-res.so.0
	libxcb-reply.so.1 (libc6) => /usr/lib/libxcb-reply.so.1
	libxcb-render.so.0 (libc6) => /usr/lib/libxcb-render.so.0
--More--

To add your own Shared Objects to the system:

~~DISCUSSION:off~~


<html> <center> Copyright © 2011-2014 Hugh Norris.<br><br> <a rel=“license” href=“http://creativecommons.org/licenses/by-nc-nd/3.0/”><img alt=“Creative Commons License” style=“border-width:0” src=“https://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png” /></a><br />This work is licensed under a <a rel=“license” href=“http://creativecommons.org/licenses/by-nc-nd/3.0/”>Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License</a> </center> </html>