13.3. Build, Install software on your system

You will see from the next chapter right through Part 6 that we use many different compile commands to build and install programs on the server. These commands are UNIX compatible and are used on all variant off *nix machines to compile and install software.

The procedures to compile and install software tarballs on your server follow:

  1. First of all, you must download the tarball from your trusted software archive site. Usually from the main site of the software you hope to install.

  2. After downloading the tarball change to the /var/tmp/ directory, note that other paths are possible, as personal discretion and untar the archive by typing the commands as root as in the following example:

    Example 13-1. Using tar

    
         [root@deep] /#tar xzpf foo.tar.gz
             
    The above command will extract all files from the example foo.tar.gz compressed archive and will create a new directory for them with the name of this software from the path where you are executing the command.

    The x option

    tells tar to extract all files from the archive.

    The z option

    tells tar that the archive is compressed with gzip.

    The p option

    maintains the original and permissions the files had as the archive was created.

    The f option

    tells tar that the very next argument is the file name.

Once the tarball has been decompressed into the appropriate directory, you will almost certainly find a README and/or an INSTALL file included with the newly decompressed files, with further instructions on how to build and compile the software package for use. You will need to enter commands similar to the following example:


         ./configure
         make
         make install
         

The above commands;

./configure will configure the software to ensure your system has the necessary functionality and libraries to successfully compile the package
make will compile all the source files into executable binaries.
Finally, make install will install the binaries and any supporting files into the appropriate locations.

Other specifics commands that you'll see in our book for compilation and installation procedure will be:


         make depend
         strip
         chown
         

make depend

command will build and make the necessary dependencies for different files.

strip

command will discard all symbols from the object files. This means that our binary file will be smaller in size, will improve a bit the performance hit to the program since there will be fewer lines to read by the system when it executes the binary.

chown

command will set the correct files owner and group permission for the binaries.

Note: More commands when necessary will be explained in the concerned installation procedure.

13.3.1. Edit files with the vi editor

The vi program is a text editor that you can use to edit any text and particularly programs. During installation of software, the user will often have to edit text files like Makefiles or configuration files to make and fit they changes. The following are some of the most important keystroke commands to get around in vi.

i

To insert text before the cursor.

a

To append text after the cursor.

dd

To delete the current line.

x

To delete the current character.

Esc

To end the insert or append mode.

u

To undo the last command.

Ctrl+f

Scroll up one page.

Ctrl+b

Scroll down one page.

/string

Search forward for string.

:f

Display filename and current line nmber.

:q

Quit editor.

:q!

Quit editor without saving changes.

:wq

Save changes and exit editor.

Warning

Before proceeding to read the rest of this book, it should be noted that the text assumes that certain files are placed in certain directories. Where they have been specified, the conventions we adopt here for locating these files are those of the Red Hat Linux distribution. If you are using a distribution of Linux or some other operating system that chooses to distribute these files in a different way, you should be careful when copying examples directly from the text.