25.2. Compile, insert FreeS/WAN into the kernel

You must modify the Makefile under the FreeS/WAN source directory and subdirectories named utils, klips/utils, Pluto, and lib to specify installation paths. We must modify these files to be compliant with Red Hat's file system structure and install FreeS/WAN files under our PATH environment variable.

  1. Move to the top-level directory of the new FreeS/WAN distribution and type the following commands on your terminal: Edit the Makefile file, vi Makefile and change the following lines:

    1. 
                     PUBDIR=/usr/local/sbin
                         
      To read:
      
                     PUBDIR=/usr/sbin
                         

    2. 
                   PRIVDIR=/usr/local/lib/ipsec
                       
      To read:
      
                   PRIVDIR=/usr/lib/ipsec
                       

    3. 
                   FINALPRIVDIR=/usr/local/lib/ipsec
                       
      To read:
      
                   FINALPRIVDIR=/usr/lib/ipsec
                       

    4. 
                   MANTREE=/usr/local/man
                       
      To read:
      
                   MANTREE=/usr/man
                       

  2. Edit the Makefile file of the subdirectory utils, vi utils/Makefile and change the following lines:

    1. 
                   PUBDIR=/usr/local/sbin
                       
      To read:
      
                   PUBDIR=/usr/sbin
                       

    2. 
                 PRIVDIR=/usr/local/lib/ipsec
                     
      To read:
      
                 PRIVDIR=/usr/lib/ipsec
                     

    3. 
                 FINALPRIVDIR=/usr/local/lib/ipsec
                     
      To read:
      
                 FINALPRIVDIR=/usr/lib/ipsec
                     

    4. 
                 MANTREE=/usr/local/man
                     
      To read:
      
                 MANTREE=/usr/man
                     

  3. Edit the Makefile file of the subdirectory klips/utils, vi klips/utils/Makefile and change the following lines:

    1. 
                     BINDIR=/usr/local/lib/ipsec
                         
      To read:
      
                     BINDIR=/usr/lib/ipsec
                         

    2. 
                   MANTREE=/usr/local/man
                       
      To read:
      
                   MANTREE=/usr/man
                       

  4. Edit the Makefile file of the subdirectory pluto, vi pluto/Makefile and change the following lines:

    1. 
                     BINDIR=/usr/local/lib/ipsec
                         
      To read:
      
                     BINDIR=/usr/lib/ipsec
                         

    2. 
                   MANTREE=/usr/local/man
                       
      To read:
      
                   MANTREE=/usr/man
                       

  5. Edit the Makefile file of the subdirectory lib, vi lib/Makefile and change the following lines:
    
                 MANTREE=/usr/local/man
                   
    To read:
    
                 MANTREE=/usr/man
                   

  6. Edit the Makefile file of the subdirectory libdes, vi libdes/Makefile and change the following lines:

    1. 
                     LIBDIR=/usr/local/lib
                         
      To read:
      
                     LIBDIR=/usr/lib
                         

    2. 
                   BINDIR=/usr/local/bin
                       
      To read:
      
                   BINDIR=/usr/bin
                       

    3. 
                   INCDIR=/usr/local/include
                       
      To read:
      
                   INCDIR=/usr/include
                       

    4. 
                   MANDIR=/usr/local/man
                       
      To read:
      
                   MANDIR=/usr/man
                       
      The above changes, from step1 to step 6, will locate all files related to the FreeS/WAN software to the destination target directories we have chosen in order to be compliant with the Red Hat file system structure.

Now, we must compile and install FreeSWAN on the server:

               [root@deep ]/freeswan-1.3#  make insert
               [root@deep ]/freeswan-1.3#  make programs
               [root@deep ]/freeswan-1.3#  make install