How to Install Siege on Ubuntu Linux

When you need to test how your web server performs under load by simulating multiple concurrent users, learning how to install Siege on Ubuntu gives you a powerful benchmarking tool. While Siege is not installed by default, it is available in the official repositories and easy to set up. Whether you need to benchmark a new server deployment, identify performance bottlenecks before a product launch, or validate that your infrastructure handles traffic spikes, Siege provides the tools to simulate realistic load scenarios. By the end of this guide, you will have Siege installed and ready to run HTTP load tests with custom configurations for concurrent users, request delays, and logging.

Choose Your Siege Installation Method

Generally, Ubuntu offers two installation paths for Siege. Specifically, the APT package provides a stable, tested version with automatic security updates. In contrast, compiling from source gives you access to the latest release with the newest features.

MethodChannelVersionUpdatesBest For
APT Package ManagerUbuntu ReposDistribution defaultAutomatic via apt upgradeMost users who prefer distro-tested packages
Source CompilationOfficial SiegeLatest stableManual recompilationUsers needing cutting-edge features

For most users, the APT method is recommended because it provides automatic security updates and requires minimal maintenance. Only compile from source if you specifically need features unavailable in the repository version.

This guide supports Ubuntu 22.04 LTS and 24.04 LTS installations. Both installation methods use Ubuntu’s default repositories or upstream sources that work identically on both supported LTS releases.

Update Ubuntu Before Siege Installation

Before installing any new software, refresh your package lists and apply pending updates. Consequently, this ensures you install the latest available package versions and avoid dependency conflicts.

sudo apt update && sudo apt upgrade

Method 1: Install Siege via APT

Siege is available in Ubuntu’s default repositories, making installation straightforward with APT. Furthermore, this method provides automatic updates through the standard system upgrade process.

sudo apt install siege

Subsequently, verify the installation completed successfully by checking the version:

siege --version
SIEGE 4.0.7

Copyright (C) 2018 by Jeffrey Fulmer, et al.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.

Method 2: Compile Siege from Source

On the other hand, compiling from source provides access to the latest Siege release with the newest features and bug fixes. However, this method requires installing build dependencies first.

Install Build Dependencies

First, install the essential build tools and libraries required for compilation. The build-essential package provides the GCC compiler on Ubuntu and make utility, while zlib1g-dev provides compression support that Siege uses for handling gzip-compressed responses on Ubuntu:

sudo apt install build-essential zlib1g-dev wget

Download and Extract Source Code

Download the latest Siege source archive. The Siege project maintains a consistent URL that always points to the current release:

wget https://download.joedog.org/siege/siege-latest.tar.gz

Once the download is complete, extract the archive and navigate into the source directory:

tar -xvf siege-latest.tar.gz
cd siege-*/

Compile and Install Siege

After navigating to the directory, configure the build with zlib support, compile the source code, and install the binaries:

./configure --with-zlib
make
sudo make install

Technically, the configure script detects your system libraries and prepares the build environment. Consequently, after compilation, Siege installs to /usr/local/bin/ by default. The configure script produces output similar to this:

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for zlib.h... yes
checking for deflate in -lz... yes
config.status: creating Makefile
config.status: creating src/config.h

Verify Source Installation

Finally, confirm that the source-compiled version installed correctly:

siege --version
SIEGE 4.1.7

Copyright (C) 2024 by Jeffrey Fulmer, et al.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.

Update Source-Compiled Siege

To update a source-compiled Siege installation when new versions are released, use this bash script that checks for build dependencies, compares versions, and logs update history:

#!/bin/bash
set -e

# Configuration
INSTALL_PREFIX="/usr/local"
BUILD_DIR="/tmp"
LOG_FILE="$HOME/siege-update.log"

# Check for required build tools
for cmd in gcc make wget; do
    if ! command -v $cmd > /dev/null; then
        echo "Error: $cmd is required but not installed."
        echo "Run: sudo apt install build-essential wget"
        exit 1
    fi
done

# Get current installed version
CURRENT_VERSION=$($INSTALL_PREFIX/bin/siege --version 2>/dev/null | grep -oP 'SIEGE \K[0-9]+\.[0-9]+\.[0-9]+' | head -1 || echo "none")

# Download and extract to check latest version
cd "$BUILD_DIR"
wget -q https://download.joedog.org/siege/siege-latest.tar.gz
tar -xzf siege-latest.tar.gz

# Get version from extracted directory name
LATEST_DIR=$(ls -d siege-*/ | head -1)
LATEST_VERSION=$(echo "$LATEST_DIR" | grep -oP '[0-9]+\.[0-9]+\.[0-9]+')

if [ -z "$LATEST_VERSION" ]; then
    echo "Error: Could not determine latest version from download."
    echo "Check https://www.joedog.org/siege-download/ manually."
    rm -rf siege-*
    exit 1
fi

echo "Current version: $CURRENT_VERSION"
echo "Latest version:  $LATEST_VERSION"

if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then
    echo "Already up to date."
    rm -rf siege-*
    exit 0
fi

echo "Updating from $CURRENT_VERSION to $LATEST_VERSION..."
echo "$(date): Starting update to $LATEST_VERSION" >> "$LOG_FILE"

# Build and install
cd "$LATEST_DIR"
./configure --with-zlib
make
sudo make install

# Verify
NEW_VERSION=$($INSTALL_PREFIX/bin/siege --version | grep -oP 'SIEGE \K[0-9]+\.[0-9]+\.[0-9]+' | head -1)
echo "$(date): Updated to $NEW_VERSION" >> "$LOG_FILE"
echo "Successfully updated to $NEW_VERSION"

# Cleanup
cd "$BUILD_DIR"
rm -rf siege-*

Make the script executable and run it manually when you want to check for updates:

chmod +x update-siege.sh
./update-siege.sh

Avoid automating this with cron. Compilation can fail due to missing dependencies, network issues, or build errors. Always run the script manually so you can monitor the output and address problems before they affect your system.

Configure Siege on Ubuntu

By default, Siege stores its configuration in a file that controls default behavior including concurrent users, request delays, and logging. The configuration file location depends on your installation method.

For example, the APT-installed Siege uses /etc/siege/siegerc as the system-wide configuration and creates a user configuration at ~/.siege/siege.conf on first run. Source-compiled Siege creates both /usr/local/etc/siegerc as the system template and ~/.siege/siege.conf as the active user configuration when you first run Siege.

View Current Configuration

First, view your current Siege settings with the -C flag. This displays all active configuration parameters:

siege -C

Alternatively, for APT installations, view the system-wide configuration file directly:

cat /etc/siege/siegerc

Modify Configuration Settings

To make changes, open the configuration file in a text editor to customize Siege behavior. For APT installations:

sudo nano /etc/siege/siegerc

Conversely, for source-compiled installations, edit the user configuration:

nano ~/.siege/siege.conf

Specifically, key configuration parameters you may want to adjust include:

  • verbose: Display detailed output during tests (true/false)
  • csv: Output results in CSV format for spreadsheet analysis (true/false)
  • concurrent: Number of simulated users (default: 25)
  • time: Test duration (e.g., 1M for one minute, 1H for one hour)
  • delay: Time between each user’s requests (e.g., 1S for one second)
  • benchmark: Run in benchmark mode with no delays (true/false)

Example configuration for a 25-user test running one hour with one-second delays:

verbose = false
csv = true
concurrent = 25
time = 1H
delay = 1S
internet = false
benchmark = false

After making changes, save and exit by pressing Ctrl+X, then Y to confirm, and Enter to write the file.

Run HTTP Load Tests with Siege

Important: Only run load tests against servers you own or have explicit permission to test. Unauthorized load testing may violate terms of service, trigger security alerts, or constitute a denial-of-service attack, which carries legal consequences.

Now that Siege is installed and configured, you can run load tests to evaluate your server’s performance under simulated traffic.

Basic Load Test

To start, run a basic test with 25 concurrent users for one minute using the -t flag:

siege https://www.example.com -t 1m

In this mode, Siege simulates 25 users continuously requesting the URL for the specified duration. Upon completion, it displays a summary including transactions completed, availability percentage, response times, and throughput.

Therefore, for more meaningful results, run tests for 5-15 minutes. Short tests may not capture representative performance data.

Increase Concurrent Users

Next, use the -c flag to specify more concurrent users. This example simulates 100 users over two minutes:

siege https://www.example.com -c 100 -t 2m

Siege displays real-time progress and provides a summary report including transaction rate, response time, throughput, successful hits, and availability percentage. Use these metrics to identify bottlenecks and compare performance across configuration changes.

Test Multiple URLs

Additionally, Siege can cycle through multiple URLs during a test. To utilize this, create or edit the URLs file with your target addresses. The file location depends on your installation method:

For APT installations:

sudo nano /etc/siege/urls.txt

For source-compiled installations:

nano /usr/local/etc/urls.txt

Add one URL per line:

https://www.example.com
https://www.example.com/api/endpoint
https://www.example.com/products

Save and exit (Ctrl+X, then Y, then Enter), then run Siege with the URLs file:

siege -f /etc/siege/urls.txt

Additional Siege Commands

Beyond basic load testing, Siege also offers options for simulating realistic user behavior and capturing detailed results.

Add Delay Between Requests

The -d flag introduces random delays up to the specified seconds between each user’s requests, simulating more realistic browsing patterns:

siege https://www.example.com -c 50 -d 5

This tests with 50 concurrent users, each waiting 0-5 seconds randomly between requests.

Test POST and PUT Requests

To test API endpoints with POST or PUT requests, specify the HTTP method and data directly in your URLs file. For example, edit the URLs file:

nano /etc/siege/urls.txt

Add lines with the method and POST data after the URL:

https://api.example.com/users POST name=testuser&email=test@example.com
https://api.example.com/data PUT {"key":"value"}

You can also include POST data from a file using the < operator:

https://api.example.com/upload POST </path/to/data.json

Then run Siege with the URLs file and add custom headers using the -H flag:

siege -f /etc/siege/urls.txt -H "Content-Type: application/json"

Enable Logging

Finally, capture test results to a log file for later analysis using the -l flag:

siege -l https://www.example.com

Typically, results are written to the log file specified in your configuration. For APT installations, the default is /var/log/siege.log. For source-compiled installations, logs go to /usr/local/var/log/siege.log.

Remove Siege from Ubuntu

Eventually, if you no longer need Siege, remove it using the appropriate method for your installation type.

Remove APT-Installed Siege

To begin removal, remove the package and clean up unused dependencies:

sudo apt remove siege
sudo apt autoremove

Optionally, remove user configuration files as well. This deletes your custom Siege settings and test history:

The following command permanently deletes your Siege configuration directory including custom settings in siege.conf, saved cookies, and any URLs you added to the URLs file. Back up ~/.siege/siege.conf first if you want to preserve custom settings.

rm -rf ~/.siege

Verify Siege was removed by checking for the binary:

which siege

However, if no output appears, the removal was successful.

Remove Source-Compiled Siege

The following commands permanently delete the source-compiled Siege installation and your user configuration files. If you have custom settings in ~/.siege/siege.conf that you want to preserve, back them up first.

Explicitly remove the installed binaries and configuration files:

sudo rm /usr/local/bin/siege /usr/local/bin/bombardment /usr/local/bin/siege2csv.pl /usr/local/bin/siege.config
sudo rm /usr/local/etc/siegerc /usr/local/etc/urls.txt
sudo rm -f /usr/local/var/log/siege.log

The following command permanently deletes your Siege user configuration directory including custom settings and saved cookies. Back up ~/.siege/siege.conf first if you want to preserve custom settings.

rm -rf ~/.siege

Then, verify the removal succeeded:

which siege

No output confirms Siege binaries are removed.

If you kept the source directory, remove it as well:

rm -rf ~/siege-*/ ~/siege-latest.tar.gz

Conclusion

You now have Siege installed and configured for HTTP load testing on Ubuntu. Next, review your test logs to identify response time patterns, experiment with different concurrent user counts to find your server’s capacity limits, and consider integrating load tests into your deployment workflow for ongoing performance validation.

Leave a Comment