Skip to content
Home Β» Getting and Unpacking the Package, Configuring the Package, Compiling the Package, Installing the Package

Getting and Unpacking the Package, Configuring the Package, Compiling the Package, Installing the Package

Installing Software from Source in Linux

(Getting β†’ Unpacking β†’ Configuring β†’ Compiling β†’ Installing the Package)

This method is used when:

  • Software is not available in repositories
  • You need custom configuration
  • You want the latest version or source-level control

1. Getting the Package (Source Code)

The source package is usually downloaded as a compressed archive (.tar.gz, .tar.bz2, .zip) from:

  • Official project website
  • GitHub / GitLab
  • FTP servers

Using wget

wget https://example.com/package-name.tar.gz

Using curl

curl -O https://example.com/package-name.tar.gz

πŸ“Œ Source packages commonly contain C/C++ source code and build scripts.


2. Unpacking the Package

After downloading, the package must be extracted.

For .tar.gz

tar -xvzf package-name.tar.gz

For .tar.bz2

tar -xvjf package-name.tar.bz2

For .zip

unzip package-name.zip

This creates a source directory:

cd package-name/

3. Configuring the Package

Configuration checks whether:

  • Required libraries are available
  • Compiler exists
  • System is compatible
  • Installation paths are set

Using ./configure

./configure

Custom Installation Path

./configure --prefix=/usr/local/package

πŸ“Œ This step:

  • Creates a Makefile
  • Detects system dependencies
  • Fails if dependencies are missing

4. Compiling the Package

Compilation converts source code into binary executable files.

Using make

make

What happens:

  • Source files are compiled
  • Object files are created
  • Binary executables are generated

πŸ“Œ This step may take time depending on package size.


5. Installing the Package

Installation copies compiled binaries and files to system directories.

Using make install

sudo make install

Files are installed into:

  • /usr/local/bin
  • /usr/local/lib
  • /usr/local/share

πŸ“Œ sudo is required because system directories are modified.


6. Complete Installation Flow (Exam-Focused)

wget package.tar.gz
tar -xvzf package.tar.gz
cd package/
./configure
make
sudo make install

7. Verifying Installation

package-name --version

or

which package-name

8. Uninstalling Source-Installed Package

If supported:

sudo make uninstall

Otherwise:

  • Manually remove installed files
  • Or use package manager alternatives

9. Advantages of Installing from Source

  • Full customization
  • Latest features
  • Optimized for your system
  • No dependency on repositories

10. Disadvantages

  • Time-consuming
  • Dependency issues
  • Harder to uninstall
  • No automatic updates

11. Comparison: Source vs Package Manager

Source InstallationPackage Manager
Manual processAutomatic
CustomizableStandard
No auto updatesAuto updates
ComplexEasy

12. Real-World Example

Installing Apache from source to enable custom modules not available in repo.


13. Conclusion

Installing software from source gives maximum control and flexibility, making it suitable for advanced users and administrators. The processβ€”getting, unpacking, configuring, compiling, and installingβ€”follows a standard and logical workflow in Linux.