Linux: How to compile program

Posted on in Categories C Programming, Howto, Linux last updated July 4, 2005

Many newbies find it difficult to compiling programs under Linux (command mentioned below should also work with FreeBSD or any other UNIX like system). The fact that Linux is open source OS, so most of the programs are also open sources. Improvements and security, bug patches needs to us compile not just Kernel but softwares/programs. Please note that you can download program with wget and extract the file with tar command.

If file extensions is .gz then use tar command as follows to extract tar ball:
$ tar -zxvf file.tar.gz

If file extensions is .bz2 then use tar command as follows to extract tar ball:
$ tar -jxvf file.tar.bz2

Three common steps to compiling program under Linux:

Step # 1: Configure (read as prepare) the program for compile on your system/architecture.

Generally configure command is used:
$ ./configure

Step # 2: Compiling the program
Use make command to compiling program:
$ make

Step # 3: Install the program
First become a root user:
$ su -


Next install the software with following command:
# make install

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

6 comment

  1. ok so im a newb and i get all these in every thing i d l but no one tells you where to open file to is it xmacs emacks tmacks rpm ark yast come on don’t be so veg i need some real help all i have is a tar. file i open it yes i see a read me file and a config make and source files but what do i open them in to my guess is emacs but no explanation to what ive playd w/ it for hours i tryd to open w/ icecream rpm yast emacs ark tem shell tried bash ash o god some one put it in lamen terms wright a book and u will make millions to much i find on the net linux/unix/os users try ro make it sound to hard for an average user to do

Leave a Comment