You can find Caldera on GitHub, and the documentation here.
We’ll need to install git first:
apt install git
Clone the Caldera repository:
git clone <https://github.com/mitre/caldera.git> --recursive
cd caldera
We’ll need to install python3-pip and utilize the requirements.txt file to install all the needed dependencies.
apt install python3-pip
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
#Comment: The command above this line is --very-- common when deploying Python frameworks found on GitHub
You’ll want go installed.
- If you already have it, great.
- If not, use the script below to install it
pico install_go.sh
Copy and paste the following into install_go.sh
#!/bin/bash
# Ensure the script is executed as root
if [ "$EUID" -ne 0 ]; then
echo "Please run as root (or use sudo)."
exit
fi
# 1. Fetch the latest Go version directly from the official endpoint
GO_VERSION=$(curl -s "<https://go.dev/VERSION?m=text>" | head -n 1)
FILENAME="${GO_VERSION}.linux-amd64.tar.gz"
DOWNLOAD_URL="<https://go.dev/dl/${FILENAME}>"
echo "Downloading ${GO_VERSION}..."
wget "$DOWNLOAD_URL"
# 2. Remove any previous Go installation and extract the new archive
echo "Extracting to /usr/local..."
rm -rf /usr/local/go
tar -C /usr/local -xzf "$FILENAME"
# 3. Update /etc/environment safely
# We check if the path is already present to prevent duplicating entries on multiple script runs.
# The first sed handles PATH="value", retaining the quotes.
# The second sed handles PATH=value, retaining the lack of quotes.
echo "Updating /etc/environment..."
if ! grep -q "/usr/local/go/bin" /etc/environment; then
sed -i 's|^PATH="\([^"]*\)"|PATH="/usr/local/go/bin:/root/go/bin:\1"|' /etc/environment
sed -i 's|^PATH=\([^"]*\)$|PATH=/usr/local/go/bin:/root/go/bin:\1|' /etc/environment
fi
# 4. Export the PATH for the current script session so 'go install' executes successfully
export PATH="/usr/local/go/bin:/root/go/bin:$PATH"
echo "Done! The new PATH will be available globally when you open a new shell session."
Type:
chmod 777 install_go.sh
./install_go.sh
Refresh your environment
exit
sudo su
cd caldera
source venv/bin/activate
We will also need to install one more package:
apt install upx npm
Now that we have all of our dependencies installed, we can start the Caldera server. You’ll have to cd to the folder that contains the files we cloned from GitHub.