206.1. Make and install programs from source
Weight: 2
Description: Candidates should be able to build and install an executable program from source. This objective includes being able to unpack a file of sources.
Key Knowledge Areas:
- Unpack source code using common compression and archive utilities
- Understand basics of invoking make to compile programs
- Apply parameters to a configure script
- Know where sources are stored by default
Terms and Utilities:
- /usr/src/
- gunzip
- gzip
- bzip2
- xz
- tar
- configure
- make
- uname
- install
- patch
As you know any modern linux distribution has its own repository, where we can easily search for a program , get info and install from it. Although installing a program from repository is easy and make kind of security, but it limits that program source to a specific distribution. So many developers prefer to publish a program source code it self, and let other people to configure and compile it base on their distribution and needs.
3 basic steps to install a program from source code are:

before beginning We need to install some developers tool. in redhat use
yum groupinstall "Development Tools"
and in debian based and ubuntu run apt-get install build-essentia
:[email protected]:~# apt install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 172 not upgraded.
For demonstration lets have fun and mine bitcoin with cpuminer. First download the source:
[email protected]:~# wget https://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.5.0.tar.gz
--2018-02-04 02:37:14-- https://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.5.0.tar.gz
Resolving sourceforge.net (sourceforge.net)... 216.34.181.60
Connecting to sourceforge.net (sourceforge.net)|216.34.181.60|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.5.0.tar.gz/download [following]
--2018-02-04 02:37:19-- https://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.5.0.tar.gz/download
Connecting to sourceforge.net (sourceforge.net)|216.34.181.60|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://downloads.sourceforge.net/project/cpuminer/pooler-cpuminer-2.5.0.tar.gz?r=&ts=1517740642&use_mirror=jaist [following]
--2018-02-04 02:37:22-- https://downloads.sourceforge.net/project/cpuminer/pooler-cpuminer-2.5.0.tar.gz?r=&ts=1517740642&use_mirror=jaist
Resolving downloads.sourceforge.net (downloads.sourceforge.net)... 216.34.181.59
Connecting to downloads.sourceforge.net (downloads.sourceforge.net)|216.34.181.59|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://jaist.dl.sourceforge.net/project/cpuminer/pooler-cpuminer-2.5.0.tar.gz [following]
--2018-02-04 02:37:28-- https://jaist.dl.sourceforge.net/project/cpuminer/pooler-cpuminer-2.5.0.tar.gz
Resolving jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)... 150.65.7.130, 2001:df0:2ed:feed::feed
Connecting to jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)|150.65.7.130|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 257872 (252K) [application/x-gzip]
Saving to: ‘pooler-cpuminer-2.5.0.tar.gz’
pooler-cpuminer-2.5 100%[===================>] 251.83K 21.3KB/s in 12s
2018-02-04 02:37:43 (21.3 KB/s) - ‘pooler-cpuminer-2.5.0.tar.gz’ saved [257872/257872]