How to Install Software from Source on Ubuntu: A Complete Guide to make install

1. Introduction

When using Ubuntu, you may encounter the procedure called make install when installing software. In most cases, applications can be installed using package management commands such as apt. However, not all software is available in official repositories. If you want to use the latest version or run your own custom programs, you may need to download the source code and build (compile) it manually before installing.

This is where make install becomes essential.

make install is a command used to place compiled programs into appropriate system locations. It not only builds the program with make but also automates the process of copying files into system directories. In Linux environments, this is one of the most commonly used fundamental procedures.

In this article, we will explain in a clear and beginner-friendly manner how to build software from source on Ubuntu and install it using make install. We will also cover common errors that may occur during the process and how to resolve them.

Let’s begin by preparing the necessary development tools.

2. Installing Required Development Tools

To build and install software from source, you first need to prepare the required development tools on Ubuntu. Without them, the make command may not be available, or build errors may occur frequently. To ensure a smooth workflow, it is best to set up the development environment in advance.

Installing the Essential Package: build-essential

Ubuntu provides a package called build-essential, which bundles the C compiler (gcc), build tools (make), and related libraries. Installing this package allows you to quickly set up the minimum required environment.

The installation steps are as follows:

sudo apt update
sudo apt install build-essential

First, update the package information, then install build-essential. This will provide all the basic tools required for building software.

Verifying the Installation

You can verify that the tools were installed correctly by running the following commands:

gcc --version
make --version

If version information for gcc and make is displayed, the installation was successful. If an error occurs, carefully review the error message and try reinstalling the packages.

With this, the basic environment for building source code on Ubuntu is ready. Next, we will proceed to obtaining and extracting the source code.

3. Obtaining and Extracting Source Code

Once the development tools are installed, the next step is to obtain the source code to be built. This involves downloading the source code provided by the software developer and extracting it into a working directory.

Methods for Obtaining Source Code

Source code is typically obtained using one of the following methods:

Downloading from the Official Website

Many open-source projects distribute source code as compressed files such as .tar.gz or .tar.bz2. For example:

wget https://example.com/software-1.2.3.tar.gz

Replace the URL with the one provided on the official download page of the software.

Cloning from GitHub or Similar Platforms

Many projects host their source code on platforms such as GitHub. In this case, you can clone the repository using Git.

If Git is not installed, install it first:

sudo apt install git

Then clone the repository:

git clone https://github.com/username/repository.git

Be sure to check the official project page for the correct repository URL.

Extracting Compressed Files

If the source code is provided as a compressed file, extract it using the appropriate command:

  • .tar.gz format:
tar -xvzf software-1.2.3.tar.gz
  • .tar.bz2 format:
tar -xvjf software-1.2.3.tar.bz2
  • .zip format:
unzip software-1.2.3.zip

After extraction, a directory containing the software name and version will be created. Move into that directory to continue:

cd software-1.2.3

You are now ready to begin building the software.

4. Build and Installation Procedure

With the source code prepared, you can now proceed to the build and installation process.

Pre-Build Configuration: Running ./configure

Many source packages include a configuration script that prepares the build environment. Run the following command inside the source directory:

./configure

This command checks your system and automatically generates a Makefile. If required libraries or tools are missing, errors may appear. In that case, read the error messages carefully and install the missing dependencies.

If the configure script does not exist, consult the README or INSTALL file for instructions.

Building the Software: make

After configuration, build the software:

make

This compiles the source code according to the Makefile instructions. The process may take some time. Watch for errors during compilation.

Installing the Program: sudo make install

Once the build completes successfully, install the program into system directories:

sudo make install

This command copies the built files into appropriate system locations such as /usr/local/bin.

Common Errors and Solutions

  • Permission denied
    Check that you used sudo with make install.
  • Missing dependencies
    Review the error message and install the required libraries.
  • configure: command not found
    Ensure the configure script exists and has execute permissions. Use chmod +x configure if necessary.

5. Verifying the Installation

After installation, verify that the software was installed correctly.

Checking the Installation Path

which program_name

Checking Version Information

program_name --version

Checking the PATH Environment Variable

echo $PATH
export PATH=/usr/local/bin:$PATH
source ~/.bashrc

6. Uninstallation Methods

Using make uninstall

sudo make uninstall

Manual File Removal

sudo rm /usr/local/bin/program_name

Managing Installations with checkinstall

sudo apt install checkinstall
sudo checkinstall

7. Installing in an Offline Environment

Even without internet access, it is possible to build and install software from source.

Preparing build-essential Offline

sudo apt install apt-offline

Using Ubuntu Installation Media

sudo mount /dev/sdb1 /mnt
sudo apt-cdrom -d=/mnt add

Transferring and Extracting Source Code

tar -xvzf software-1.2.3.tar.gz
cd software-1.2.3

8. Frequently Asked Questions (FAQ)

Q1. Permission denied when running make install?

sudo make install

Q2. ./configure: No such file or directory?

Check whether the project uses autotools or another build system such as CMake.

Q3. make command not found?

sudo apt install build-essential

Q4. How to install build-essential offline?

Use apt-offline or Ubuntu installation media.

9. Conclusion

make install is an essential technique for installing software from source on Ubuntu. By understanding the full process—from preparing tools to installation and uninstallation—you gain greater flexibility and control over your Linux environment.

With this knowledge, you can confidently handle software that is not available through package managers and build a more customized development environment.

年収訴求