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.
           
               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:
               
                     PUBDIR=/usr/local/sbin
                   To read:
                     PUBDIR=/usr/sbin
                   
                   PRIVDIR=/usr/local/lib/ipsec
                 To read:
                   PRIVDIR=/usr/lib/ipsec
                 
                   FINALPRIVDIR=/usr/local/lib/ipsec
                 To read:
                   FINALPRIVDIR=/usr/lib/ipsec
                 
                   MANTREE=/usr/local/man
                 To read:
                   MANTREE=/usr/man
                 
               Edit the Makefile file of the subdirectory utils, vi utils/Makefile and change the following lines:
               
                   PUBDIR=/usr/local/sbin
                 To read:
                   PUBDIR=/usr/sbin
                 
                 PRIVDIR=/usr/local/lib/ipsec
               To read:
                 PRIVDIR=/usr/lib/ipsec
               
                 FINALPRIVDIR=/usr/local/lib/ipsec
               To read:
                 FINALPRIVDIR=/usr/lib/ipsec
               
                 MANTREE=/usr/local/man
               To read:
                 MANTREE=/usr/man
               
               Edit the Makefile file of the subdirectory klips/utils, vi klips/utils/Makefile and change the following lines:
               
                     BINDIR=/usr/local/lib/ipsec
                   To read:
                     BINDIR=/usr/lib/ipsec
                   
                   MANTREE=/usr/local/man
                 To read:
                   MANTREE=/usr/man
                 
               Edit the Makefile file of the subdirectory pluto, vi pluto/Makefile and change the following lines:
               
                     BINDIR=/usr/local/lib/ipsec
                   To read:
                     BINDIR=/usr/lib/ipsec
                   
                   MANTREE=/usr/local/man
                 To read:
                   MANTREE=/usr/man
                 
               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
               
               Edit the Makefile file of the subdirectory libdes, vi libdes/Makefile and change the following lines:
               
                     LIBDIR=/usr/local/lib
                   To read:
                     LIBDIR=/usr/lib
                   
                   BINDIR=/usr/local/bin
                 To read:
                   BINDIR=/usr/bin
                 
                   INCDIR=/usr/local/include
                 To read:
                   INCDIR=/usr/include
                 
                   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
             
                 The make insert command creates a symbolic link /usr/src/linux/net/ipsec, pointing to the KLIPS source directory. It patches some kernel files, where 
                 necessary, to know about KLIPS and/or to fix bugs. It also adds its default configuration to the kernel configuration file, and finally, it makes the KLIPS communication file, /dev/ipsec, 
                 if it's not already there.
               
The make programs command builds the libraries, Pluto, and various user-level utilities.
The make install will install the Pluto daemon and user-level utilities, and set things up for boot-time startup.