Install Doxygen on Ubuntu 26.04

Install Doxygen on Ubuntu 26.04

Doxygen is a documentation generation tool widely used for producing technical documentation directly from annotated source code. It supports multiple programming languages including C, C++, C# and Java. Generated documentation can be exported in formats such as HTML, LaTeX, and PDF for easier sharing and review. This tutorial shows how to install Doxygen on Ubuntu 26.04.

Install Doxygen

Get Doxygen release version from the official changelog page:

DOXYGEN_VERSION=$(curl -s "https://www.doxygen.nl/manual/changelog.html" | grep -Po 'Release \K[0-9.]+' | head -n1)

Download the latest prebuilt archive from the GitHub releases page:

curl -sSLo doxygen.tar.gz https://github.com/doxygen/doxygen/releases/latest/download/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz

Create temporary directory and extract files into it:

mkdir doxygen-temp
tar xf doxygen.tar.gz --strip-components=1 -C doxygen-temp

Move the executable into a system-wide binary directory:

sudo mv doxygen-temp/bin/doxygen /usr/local/bin

Verify installation by checking Doxygen version:

doxygen --version

Remove the temporary files and directories after installation:

rm -rf doxygen.tar.gz doxygen-temp

Testing Doxygen

A small C project is commonly used to validate documentation generation. Create the main.c file:

mkdir src && nano src/main.c

Example source file with documentation comments:

/**
 * @file main.c
 * @brief Entry point and hello function.
 */

#include <stdio.h>

/**
 * @brief Prints "Hello world" to the console.
 *
 * This function demonstrates how to document a function.
 */
void hello(void) {
    printf("Hello world\n");
}

/**
 * @brief Program entry point.
 *
 * Calls hello() to display a message.
 *
 * @return int Exit status code (0 = success)
 */
int main(void) {
    hello();

    return 0;
}

Create a configuration file for Doxygen:

nano Doxyfile

Minimal configuration example:

INPUT = src
RECURSIVE = YES
GENERATE_LATEX = NO

Generate documentation using the command:

doxygen Doxyfile

After execution, an html directory is produced. The generated documentation can be viewed by opening the file html/index.html.

Uninstall Doxygen

If Doxygen is no longer needed, remove the installed binary as follows:

sudo rm -rf /usr/local/bin/doxygen

Leave a Comment

Cancel reply

Your email address will not be published.