≡ Menu

How to compile program under Linux / UNIX / FreeBSD

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?

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

Share this tutorial on:

Your support makes a big difference:
I have a small favor to ask. More people are reading the nixCraft. Many of you block advertising which is your right, and advertising revenues are not sufficient to cover my operating costs. So you can see why I need to ask for your help. The nixCraft, takes a lot of my time and hard work to produce. If you use nixCraft, who likes it, helps me with donations:
Become a Supporter →    Make a contribution via Paypal/Bitcoin →   

Don't Miss Any Linux and Unix Tips

Get nixCraft in your inbox. It's free:



{ 6 comments… add one }
  • Ed Frome November 19, 2007, 3:05 pm

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

  • nixCraft November 20, 2007, 7:30 am

    Ed,

    Yup, README or INSTALL will save tons of time. Appreciate your post.

  • Debashis Mohapatra February 13, 2009, 10:33 am

    I did not get clear picture about this scenario,which you have written

    Thanks
    Debashis Mohapatra

  • luke February 16, 2009, 6:29 am

    Hey folks
    I managed to compile the program, but how do I run it
    any help will be greatly appreciated
    Luke

  • neeraj sinha July 28, 2009, 2:27 pm

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

  • QQQ December 30, 2009, 11:06 am

    hey guys, if i want to remove a program i have compiled what can i do?

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">


   Tagged with: , , , , , , , , , , ,