Pages

Wednesday, January 11, 2012

How to compile in linux

How to compile in linux

One benefit of using linux is it is open source. So if we have problem with our program, we can recompile it by our self. Actually, recompiling program is not difficult. We just need some steps as below :
  • Download source code
    We can download source code of our program from it's official web site. It is usually compressed using tar.gz or tar.bz2. For example, if we want to download apache source code, go to apache website
  • Extract downloaded file
    We can user tar -zxvf [file_name].tar.gz or tar -jxvf [file_name].tar.bz2. For example as below :
    # tar -zxvf httpd-2.0.49.tar.gz
    
  • Login as root
    # su -
    
  • Go to directory
    # cd httpd-2.0.49
    
  • Configure source code with option
    The configure option can be various, depend on software we want to compile. For example we want to compile apache with command as below :
    # ./configure --prefix=/usr/local/httpd --enable-so
    
  • Do Make
    After compiling, we need to make it using this command :
    # make
    
  • Install
    The last thing we need to do is install it using this command :
    # make install
    
If we want to change compiling option, recompile it with another option and add make clean after compiling.

No comments:

Post a Comment

Don't Forget To Join Our Community
×
Widget