Page 84 - DCAP106_OPERATING_SYSTEM_TOOLS
P. 84

Unit 4: Installing Software




          compile software directly from source code – download the source code which comes in a tarball,   Notes
          unzip it and then compile it.
          In fact, this is the way source packages were distributed in the old days, and you might still have
          to go by this route in some cases. However, to most people out there, compiling from source still
          feels like voodoo. Here is a quick guide to all that you need to know about compiling from source
          and what goes behind the scenes, without leaving anything to chance.

          Unpacking

          Command to use: [tar xvzf mypackage.tar.gz] or [tar xvjf mypackage.tar.bz2]
          This is the first thing to be done when you download the software. All the source files, associated
          libraries and  documentation  are  distributed as  compressed  archives  called  tarballs. They  are
          compressed  using  either  gzip  or  bzip2,  and  hence  the  different  extensions  and  the  slightly
          differing switches used in the command.
          After unpacking, a directory will be created with the name of the package in the destination
          folder. Change the directory using cd mypackage and then use ls to explore the directory tree.
          Make sure to read the readme, install and other documentation. Some packages might need some
          additional libraries or might suffer from dependency issues, so it makes sense to know what’s
          needed.

          Configuring

          Command to use: ./configure
          After you have unpacked the tarball and have also solved any dependency issues by installing
          required libraries it’s time to go to the next step: configuration. You have to run the command while
          inside the installed package directory. This command does not change anything substantially. It
          basically does a house-keeping job, checking whether all the required resources in the form of
          system libraries are present and then assigning values for system dependent variables. Various
          switches  can  be  used  along  with  the  ./configure  command  to  change  the  behaviour  of  the
          program.

                 Example: Appending -quiet would stop printing the checking… messages during the
          configure process.
          If you know what you are doing you can use -no-create to inspect the output files before they are
          created. Using -prefix=mydirectory you can change the path where the Makefile will be created.

          After the ./configure command has run – during which you will see a bunch of messages scrolling
          up the screen in rapid fire sequence – a Makefile will be created. This Makefile is then used to
          build the binary which then needs to be installed.

          Building

          Command to use: make

          The  make  command  uses  the  Makefile  to  create  installable  binaries.  Binaries  are  the  Unix
          equivalent of executables, or .exe files. The make command is time consuming and results in
          a whole bunch of messages scrolling across your screen. This part is going to take a lot of time,
          depending on the package being compiled as well as the system configuration. There will be
          another bunch of messages scrolling across the screen, sometimes with warnings about some
          resource being absent. If all is okay, it will display the command prompt. If however, there is
          some problem it prompts you with appropriate status messages.





                                           LOVELY PROFESSIONAL UNIVERSITY                                    77
   79   80   81   82   83   84   85   86   87   88   89