How to Install Software from Source on Ubuntu Using make install: A Complete Beginner’s Guide

1. Introduction

When using Ubuntu, you may encounter the step “make install” when installing software. Typically, installing applications is as simple as running the apt command to install packages, but not all software is available in the official repositories. If you want to use the latest version or run your own programs, you’ll need to download the source code, build (compile) it yourself, and then install it.

This is where “make install” comes in handy.

The “make install” command is used to place programs compiled from source code into the appropriate locations. It not only builds the program (make), but also automates the process of copying files to system directories. In Linux environments, this is one of the basic procedures used quite frequently.

This article will clearly explain how to build source code and use make install to install software on Ubuntu—even for beginners. We’ll also cover common errors you might encounter during the process and how to solve them.

Let’s start by preparing the development tools required for building software.

2. Installing Essential Development Tools

To build and install software from source code, you first need to set up the required development tools on Ubuntu. Without these, you may not be able to use the “make” command or you may run into frequent build errors. To avoid such problems, let’s make sure your development environment is ready from the start.

Installing the Essential Package: build-essential

On Ubuntu, there’s a package called build-essential that bundles the C compiler (gcc), build tools (make), and related libraries. Installing this package sets up all the basic tools you’ll need.

Here’s how to install it:

sudo apt update
sudo apt install build-essential

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

Verifying the Installation

You can check whether everything is installed correctly with these commands:

gcc --version
make --version

If you see the version information for both gcc (the C compiler) and make (the build tool), the setup was successful. If you get any errors, check the messages carefully and try reinstalling as needed.

Now your Ubuntu system is ready to start building from source code. Next, let’s see how to obtain and extract the source code.

3. Obtaining and Extracting Source Code

After installing the development tools, the next step is to get the source code you want to build. Download the source code provided by the software developer and extract it into your working directory. Here, we’ll explain how to obtain and extract the source code.

How to Get Source Code

You can usually get source code using one of the following methods:

Download from the Official Website

Many open-source projects distribute source code as compressed files like “tar.gz” or “tar.bz2” on their official websites. For example, use a command like this to download:

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

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

Clone from GitHub and Other Platforms

More and more projects use code hosting services like GitHub. In this case, you can clone the source code with the Git command.

If Git isn’t installed, set it up first:

sudo apt install git

Then, run the clone command:

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

The repository URL varies for each project, so be sure to check the official page.

Extracting Compressed Files

If the source code is provided as a compressed file, use the right command to extract it.

Here are some common formats and the commands for extracting them:

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

Once extracted, you’ll get a directory named after the software and version. Change into that directory to proceed:

cd software-1.2.3

Now you’re ready to start building the software. Let’s move on to the actual build and install steps.

4. Building and Installing the Software

With the source code ready, it’s time to build and install it. This section explains the general flow for building and installing software on Ubuntu, step by step.

Preparation: Running ./configure

Many source code packages provide a “configure script” to prepare the environment before building. Usually, run this command inside the source directory:

./configure

This checks your system and automatically generates a Makefile (a file listing build steps). If any required libraries or tools are missing, you’ll get errors here. Read the error messages and install the missing packages as needed.

If the configure script doesn’t exist, check the README or INSTALL files for specific build instructions.

Building the Software: make Command

Once configured, build the software by compiling the source code into executable programs:

make

This command follows the instructions in the Makefile and compiles everything automatically. Building may take some time; watch for any errors along the way.

If you get errors, resolve missing library or dependency issues based on the error messages.

Installing the Program: sudo make install

After a successful build, you can install the program into your system. Since this writes to system directories (like /usr/local/bin), you need administrator privileges.

Run this command:

sudo make install

This copies the built files to the right places, making the program available system-wide.

Common Errors and Solutions

During build and install, you may encounter errors such as:

  • Permission denied
    → Make sure you’re using sudo with make install.
  • Missing dependencies
    → Read the error messages and install any required libraries or packages.
  • configure: command not found
    → The configure script may be missing or not executable. Run chmod +x configure or review the build instructions.

Don’t panic—read each message carefully and address the issues step by step.

5. Post-Installation Checks

After installing software with “sudo make install,” always confirm it was installed correctly. If the install wasn’t successful, commands may not be found or may not work as expected. Here are the basic checks you should perform right after installation.

Check Where the Program Was Installed

First, find out where the program was placed on your system. Use the which command to locate the executable:

which program-name

For example, if you installed a program named sample, enter:

which sample

If installed correctly, you’ll see something like /usr/local/bin/sample or /usr/bin/sample. If nothing appears, the installation may have failed or the program may not be in your PATH.

Verify Operation with Version Information

Most programs can show their version information using --version or -v. This is a quick way to check if your program works as expected:

sample --version

If you see the correct version, the installation was successful. If you get an error or command not found, review the installation steps.

Check the PATH Environment Variable

Programs installed with make install often go into /usr/local/bin. If this directory isn’t in your system PATH, the program may not be recognized as a command.

Check your current PATH with:

echo $PATH

If /usr/local/bin is listed, you’re good. If not, add it to your shell configuration file (like ~/.bashrc or ~/.zshrc):

export PATH=/usr/local/bin:$PATH

Apply the changes by restarting the terminal or running:

source ~/.bashrc

With this setup, you can launch programs smoothly from the terminal.

6. How to Uninstall

Programs installed from source aren’t managed by regular package managers like apt. So, if you need to remove them, you’ll usually have to uninstall manually. This section explains how to properly uninstall software installed with make install on Ubuntu.

Uninstalling with make uninstall

Some Makefiles provide an “uninstall target” for removing installed files. If available, run this command in the original source directory:

sudo make uninstall

This removes files that were copied during installation. However, not all software supports make uninstall, so always check the README or INSTALL files first.

Important Notes:

  • You must run this in the same source directory used for installation.
  • If you’ve deleted the source code, you can’t use make uninstall.

Manually Deleting Files

If make uninstall isn’t available, you’ll need to remove the files manually. Programs are usually installed in directories like /usr/local/bin or /usr/local/lib.

Identify all installed files and delete them carefully. For example, if the binary is in /usr/local/bin:

sudo rm /usr/local/bin/program-name

Manual removal can be tricky, so it’s best to know exactly what was installed beforehand.

Managing Installs with checkinstall

To make uninstallation easier in the future, consider using a tool called checkinstall. This tool lets you install software as a deb package, making management with apt or dpkg possible.

Install checkinstall with:

sudo apt install checkinstall

After building, use this command instead of make install:

sudo checkinstall

This approach makes uninstalling much easier and keeps your system clean—highly recommended if you often install from source.

7. Installing in Offline Environments

Sometimes, you might need to install software on Ubuntu systems without internet access. While online package retrieval is standard, it’s still possible to build and install with “make install” offline if you prepare in advance. Here’s how to handle offline installation scenarios.

Preparing build-essential Offline

The essential development tools (build-essential package) are still required offline. To set this up, use another Ubuntu machine with internet access to download the packages beforehand.

Using apt-offline

apt-offline helps you collect the required packages and dependencies for transfer via USB, etc.

Install apt-offline on the online machine with:

sudo apt install apt-offline

Then, generate a request file on the offline system, download packages on the online one, and finally install them offline.

Using the Ubuntu Installation Media as an APT Source

You can also use the Ubuntu installation media (DVD or USB) as an APT source, as it contains many basic packages, including build-essential.

Mount the media and set the APT source list like this:

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

Now you can install packages as usual:

sudo apt update
sudo apt install build-essential

This is a reliable way to set up a build environment offline.

Bringing in and Extracting Source Code

Once your build tools are ready, download the source code ahead of time, save it to a USB stick, and copy it to your offline environment. Extract the files as you would online:

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

Now proceed with the usual steps: ./configuremakesudo make install.

Tips for Offline Installs

Offline installs often fail due to missing dependencies, so double-check that you have all the libraries and header files needed. If possible, try a test build online first to generate a list of required packages.

8. Frequently Asked Questions (FAQ)

When installing software on Ubuntu using “make install,” users from beginners to intermediates often run into questions and issues. Here are some of the most common questions and their answers.

Q1. I get “Permission denied” when running make install. What should I do?

A1.
The “make install” command copies files to system areas (like /usr/local/bin), so administrator privileges are required. Always use sudo:

Correct example:

sudo make install

This will run the install process with the proper permissions.

Q2. I get “No such file or directory” when running ./configure. Why?

A2.
This error means there is no configure script in your current directory. Possible reasons:

  • The source code download was incomplete
  • The project doesn’t use autotools (it may use CMake, for example)
  • The configure script isn’t executable

First, check if the configure file is present, and if not, read the included README or INSTALL files for the correct build steps.

Q3. I get “make: command not found.” What should I do?

A3.
This means the build tools aren’t installed. Run the following commands to install them:

sudo apt update
sudo apt install build-essential

The build-essential package includes make and all necessary tools.

Q4. How can I install build-essential offline?

A4.
To install build-essential offline, download the packages ahead of time on an online machine and bring them to the offline environment. The two most common methods are:

  • Use apt-offline to download all dependencies
  • Use the Ubuntu installation media as an APT source

The installation media method is especially straightforward for completely offline environments.

9. Summary

On Ubuntu, “make install” plays a key role in installing software from source. It gives you flexibility to use the latest versions or custom builds, independent of the package manager—a big strength of Linux systems.

This article covered everything from setting up development tools, obtaining and building source code, installation, uninstallation, and even handling offline scenarios. By mastering these steps, you’ll be ready to tackle any unfamiliar software you come across.

We’ve also compiled solutions to common errors and questions in a FAQ format. Although Linux builds might look intimidating at first, they’re manageable once you grasp the basics.

If you want to try out various software on Ubuntu, master the “make install” procedure explained here and enjoy a highly flexible development environment.

年収訴求