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


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • Ed Frome Nov 19, 2007 @ 15:05

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

  • 🐧 nixCraft Nov 20, 2007 @ 7:30

    Ed,

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

  • Debashis Mohapatra Feb 13, 2009 @ 10:33

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

    Thanks
    Debashis Mohapatra

  • luke Feb 16, 2009 @ 6:29

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

  • neeraj sinha Jul 28, 2009 @ 14:27

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

  • QQQ Dec 30, 2009 @ 11:06

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

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum