How to compile program under Linux / UNIX / FreeBSD

last updated in Categories , , , , , , , , , , ,

Q. I’ve downloaded tar ball software but I don’t know how to compile the same? Can you provide the instructions for compiling a program?


ADVERTISEMENTS


A. Many new users find it difficult to compiling programs in Linux. Usually following steps are involved:

a] Download tar ball using wget

b] Untar tar ball using tar command

c] Compile program using make or configure command

d] Install software

Task: compiling program

Step # 1: Download program tar ball:
$ wget http://url-com/prog.tar.gz
Step # 2: Untar tar ball :
$ tar -zxvf prog.tar.gz
$ cd prog

Step # 3: Untar tar ball:
Configure program:
$ ./configure
Compile program:
$ make
Install program (must be run as the root, login using su or use sudo):
$ sudo make install
or
$ su -
$ make install

ADVERTISEMENTS

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

6 comment

  1. Step # 3: Read README, INSTALL, and any other documentation. This will save a lot of hassles when configure and/or make fails.

  2. Everytime you don’t have configure or make files available…what can be done in those cases?

    Still, have a question? Get help on our forum!