How to Install Apache Bench (ab) Without Apache on Fedora: Yum vs Source Compilation


1 views

Apache Bench (ab) is actually packaged separately from the main Apache HTTP Server in most Linux distributions. The key package you need is httpd-tools, which contains ab along with other Apache utilities.

For Fedora systems using yum/dnf package manager:

sudo dnf install httpd-tools

Verify installation with:

ab -V

If you prefer compiling from source (useful for specific versions):

# Install dependencies
sudo dnf install gcc make apr-devel apr-util-devel

# Download Apache utils
wget https://archive.apache.org/dist/httpd/httpd-2.4.54.tar.gz
tar -xzf httpd-2.4.54.tar.gz
cd httpd-2.4.54/support/

# Compile just ab tool
./configure
make ab

The compiled binary will be at ./ab - you can move it to your PATH:

sudo cp ab /usr/local/bin/

Test your ab installation with a simple benchmark:

ab -n 100 -c 10 http://example.com/

This sends 100 requests with 10 concurrent connections to the specified URL.

The httpd-tools package includes these useful binaries:

  • ab (Apache HTTP server benchmarking tool)
  • htpasswd (Managing HTTP authentication)
  • htdigest (Managing digest authentication)
  • rotatelogs (Piping Apache logs)

If you encounter "command not found" after installation:

# Check if ab is in your PATH
which ab

# If not, locate the binary
sudo find / -name ab 2>/dev/null

# Add to PATH if necessary
export PATH=$PATH:/path/to/ab/directory

Apache Bench (ab) is a popular benchmarking tool that's traditionally bundled with the Apache HTTP server package. However, many developers only need the benchmarking utility without the full web server stack. Here's how to get just the ab tool on Fedora systems.

On modern Fedora systems, you can install just the benchmarking tool using:

sudo dnf install httpd-tools

This package contains only the essential Apache utilities including ab, without pulling in the full Apache web server dependencies.

For advanced users who need specific versions or custom builds:

# Install build dependencies
sudo dnf install -y gcc make apr-devel apr-util-devel

# Download Apache source
wget https://downloads.apache.org/httpd/httpd-2.4.57.tar.gz
tar -xzf httpd-2.4.57.tar.gz
cd httpd-2.4.57/support

# Build just the ab tool
./configure
make ab

# Install manually
sudo cp ab /usr/local/bin/

After installation, verify ab works without Apache:

ab -V

Sample benchmark test:

ab -n 1000 -c 10 http://example.com/

If you encounter connection limits, adjust system parameters:

# Increase available ports range
echo "net.ipv4.ip_local_port_range = 1024 65535" | sudo tee -a /etc/sysctl.conf

# Allow more open files
echo "* soft nofile 65535" | sudo tee -a /etc/security/limits.conf
echo "* hard nofile 65535" | sudo tee -a /etc/security/limits.conf

For accurate benchmarks with standalone ab:

  • Use -k flag for Keep-Alive connections
  • Set proper concurrency with -c parameter
  • Run tests multiple times for consistency