Installing Non-rpm Software


Installing Non-rpm Software

Most software that is not in rpm format comes with detailed instructions on how to configure, build (if necessary), and install it. Some binary distributions (those containing prebuilt executables that run on CentOS Linux) require you to unpack the software from the root directory.

The /opt and /usr/local Directories

Some newer application packages include scripts to install themselves automatically into a directory hierarchy under /opt, with files in a /opt subdirectory that is named after the package and executables in /opt/bin or /opt/package/bin. These scripts are relatively new additions to CentOS Linux but are familiar to Sun Solaris users.

Other software packages allow you to choose where you unpack them. Because many different people develop software for Linux, there is no consistent method for installing it. As you acquire software, install it on the local system in as consistent and predictable a manner as possible. The standard Linux file structure has a directory hierarchy under /usr/local for binaries (/usr/local/bin), manual pages (/usr/local/man), and so forth. To prevent confusion later and to avoid overwriting or losing the software when you install standard software upgrades in the future, avoid installing nonstandard software in standard system directories (such as /usr/bin). On a multiuser system, make sure that users know where to find the local software and make an announcement whenever you install, change, or remove local tools.

GNU Configure and Build System

The GNU Configure and Build System makes it easy to build a program that is distributed as source code (see autoconf at ). This two-step process does not require special tools other than a shell, make, and gcc (the GNU C compiler). You do not need to work with root privileges for either of these steps.

The following example assumes you have downloaded the GNU chess program () to the working directory. First unpack and decompress the file and cd to the new directory:

$ tar -xvzf gnuchess*
gnuchess-5.03/
gnuchess-5.03/book/
gnuchess-5.03/book/README
...
$ cd gnuchess*

After reading the README and INSTALL files, run the configure script, which gathers information about the local system and generates the Makefile file:

$ ./configure
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for mawk... mawk
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 for memset... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/config.h

Refer to the configure info page, specifically the prefix option, which causes the install phase to place the software in a directory other than /usr/local. The second step is to run make:

$ make
Making all in src
make[1]: Entering directory '/hdd4/gnuchess-5.03/src'
cd .. \
&& CONFIG_FILES= CONFIG_HEADERS=src/config.h \
/bin/sh ./config.status
config.status: creating src/config.h
config.status: src/config.h is unchanged
make  all-am
make[2]: Entering directory '/hdd4/gnuchess-5.03/src'
source='atak.c' object='atak.o' libtool=no \
depfile='.deps/atak.Po' tmpdepfile='.deps/atak.TPo' \
depmode=gcc3 /bin/sh ../depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -c 'test -f atak.c || echo './''atak.c
...
gcc  -g -O2   -o gnuchess  atak.o book.o cmd.o epd.o eval.o genmove.o hash.o hung.o init.o
iterate.o main.o move.o null.o output.o players.o pgn.o quiesce.o random.o repeat.o
search.o solve.o sort.o swap.o test.o ttable.o util.o version.o  -lreadline -lncurses -lm
make[2]: Leaving directory '/hdd4/gnuchess-5.03/src'
make[1]: Leaving directory '/hdd4/gnuchess-5.03/src'
make[1]: Entering directory '/hdd4/gnuchess-5.03'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/hdd4/gnuchess-5.03'
$ ls src/gnuchess
src/gnuchess

After make finishes, the gnuchess executable is found in the src directory. If you want to install it, give the following command while running with root privileges:

# make install
Making install in src
make[1]: Entering directory '/hdd4/gnuchess-5.03/src'
make[2]: Entering directory '/hdd4/gnuchess-5.03/src'
/bin/sh ../mkinstalldirs /usr/local/bin
/usr/bin/install -c gnuchess /usr/local/bin/gnuchess
make[2]: Nothing to be done for 'install-data-am'.
...

You can run the two steps and install the software with this command line:

# ./configure && make && make install

The Boolean AND operator, &&, allows the execution of the second step only if the first step returned a successful exit status.