How to build a Linux package from source

Home > Search > How-to

Let's say you download a package called sample. Typically, you will be downloading a compresed tar archive, such as sample.tar.gz. First, extract the compressed tar archive. The extracted archive should contain a few files and directories, such as build, configure, makefile, and readme. When building a package from source, a few programs are required, such as GCC+. Install build-essential, to ensure your system has the needed programs.

[root@server1 ~]# apt-get install build-essential


Configure the package. The system will be checked to determine if all of the required dependencies are already installed. If one or more dependency is not installed, configure will halt and list the required dependencies. In this example, the PAM development libraries dependency is not installed. Use apt-get or yum to installed the required dependencies, and then run ./configure again.

[root@server1 ~]# ./configure
. . .
configure: error: PAM development libraries not installed


Once configure completes successfully, use the make command.

[root@server1 ~]# make


After make completes, use the make install command. After make install completes, the package is ready for use.

[root@server1 ~]# make install


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.