Home arrow Site Administration arrow Page 4 - Linux Administration: Installing Software

Compile and Install GNU Software - Administration

Three basic software installations are covered here -- using the Red Hat Package Manager, compiling software using the standard GNU compilation method, and compiling and installing the software by hand. (From the book Linux Administration, A Beginner's Guide, third edition by Steven Graham and Steve Shah, McGraw-Hill/Osborne, 0072225629, 2002).

  1. Linux Administration: Installing Software
  2. Installing a New Package
  3. Uninstalling a Package
  4. Compile and Install GNU Software
  5. Looking for Documentation
  6. Installing the Package and Testing the Software
  7. Common Software Problems
  8. Cleanup and When There is No Configure Script
  9. Compiling and Installing a GNU Program
  10. Project Summary
By: McGraw-Hill/Osborne
Rating: starstarstarstarstar / 32
November 02, 2004

print this article



One of the key benefits of open-source software is that you have the source code in your hands. If the developer chooses to stop working on it, you can continue. If you find a problem, you can fix it. In other words, you are in control of the situation and not at the mercy of a commercial developer you canít control. But having the source code means you need to be able to compile it, too. Otherwise all you have is a bunch of text files that canít do much.

Although almost every piece of software in this book is available as an RPM, we will step through the process of compiling it yourself so that you can pick and choose compile time options, which is something you canít do with RPMs. Also, an RPM might be compiled for a specific architecture such as the Intel 486. That code might run better if you compiled it natively on your Intel 686 Pentium III class CPU.

In this section, we will step through the process of compiling the Hello package, a GNU software package that might seem useless at first, but there are reasons for its existence. Most GNU software conforms to a standard method of installing, so letís go ahead and get the package.

Getting and Unpacking the Package

Software that comes in source form is generally made available as a tarball--that is, it is archived into a single large file and then compressed. The tools used to do this are tar and gzip. tar handles the process of combining many files into a single large file, and gzip is responsible for the compression.

NOTE  Do not confuse gzip with WinZip. They are two different programs that use two different (but comparable) methods of compression. It should be noted, though, that WinZip does know how to handle tarballs.

Typically, a single directory is selected in which to build and store tarballs. This allows the system administrator to keep the tarball of each package in a safe place in the event he or she needs to pull something out of it later. It also lets all the administrators know which packages are installed on the system in addition to the base system. A good directory for this is /usr/local/src, since software local to a site is generally installed in /usr/local.

When unpacked, a tarball will generally create a new directory for all of its files. The hello tarball (hello-1.3.tar.gz), for example, creates the subdirectory hello-1.3. Most packages follow this standard. If you find a package that does not follow it, it is a good idea to create a subdirectory with a reasonable name and place all the unpacked source files there. This allows multiple builds to occur at the same time without the risk of the two builds conflicting.

First, letís get into the directory we want to compile in:

[root@ford /root]# cd /usr/local/src

Download the hello-1.3.tar.gz file from the GNU FTP site at ftp://ftp.gnu.org/gnu/hello/. You can type the URL into a browser and download the package or you can use the ftp command-line tool to download the package

[root@ford src]# ftp ftp.gnu.org
Connected to ftp.gnu.org
220 GNU FTP server ready.

330 Please specify the password.
Password:sgraham@cs.ucr.edu (You won't see this when you type it)
ftp>cd /gnu/hello
ftp>get hello-1.3.tar.gz

It is a common courtesy to type in your e-mail address as the password. If the ftp account doesnít work you might want to try anonymous. Once in the ftp command prompt, the bin option tells ftp that you want to transfer the files using binary mode. The hash option will print a hash mark for every 1024 bytes of data sent. Finally, you cd into the directory and then issue the FTP get command to grab the file. You exit the FTP program by typing bye. Then unpack the tarball with the following command:

[root@ford src]# tar -xvzf hello-1.3.tar.gz

NOTE  You might encounter files that end with the .tar.bz2 extension. Bzip2 is a compression algorithm that is gaining popularity, and GNU tar does support decompressing it on the command line with the y or j option (instead of the z parameter).

The z parameter in the tar command invokes gzip to decompress the file before the untar process occurs. The v parameter tells tar to show the name of the file it is untarring as it goes through the process. This way youíll know the name of the directory where all the sources are being unpacked. You should now have a directory called /usr/local/src/hello-1.3. You can test this by using the cd command to move into it:

[root@ford src]# cd /usr/local/src/hello-1.3

This chapter is from Linux Administration, A Beginner's Guide, third edition, by Graham and Shah. (McGraw-Hill/Osborne, 2002, ISBN: 0072225629). Check it out at your favorite bookstore today.

Buy this book now.

>>> More Site Administration Articles          >>> More By McGraw-Hill/Osborne

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates


Dev Shed Tutorial Topics: