
Hereβs an automated script to install Tenable Nessus on both Linux (Ubuntu, RHEL, CentOS) and Windows.
πΉ Automated Installation Script for Linux
This script detects your OS and installs Nessus accordingly.
π Steps to Use
- Copy & paste the script into a file (
install_nessus.sh
). - Give execute permission:
chmod +x install_nessus.sh
- Run the script:
sudo ./install_nessus.sh
π Linux Installation Script
#!/bin/bash
# Detect Linux Distribution
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$ID
else
echo "Unsupported Linux distribution"
exit 1
fi
# Set Nessus Download URL
NESSUS_VERSION="10.5.0"
if [[ "$OS" == "ubuntu" || "$OS" == "debian" ]]; then
FILE="Nessus-${NESSUS_VERSION}-ubuntu_amd64.deb"
URL="https://downloads.nessus.org/nessus/${NESSUS_VERSION}/${FILE}"
INSTALL_CMD="dpkg -i $FILE"
elif [[ "$OS" == "rhel" || "$OS" == "centos" || "$OS" == "amzn" ]]; then
FILE="Nessus-${NESSUS_VERSION}-es8.x86_64.rpm"
URL="https://downloads.nessus.org/nessus/${NESSUS_VERSION}/${FILE}"
INSTALL_CMD="rpm -ivh $FILE"
else
echo "Unsupported OS: $OS"
exit 1
fi
# Download Nessus
echo "Downloading Nessus..."
curl -O $URL
# Install Nessus
echo "Installing Nessus..."
sudo $INSTALL_CMD
# Start and Enable Nessus Service
echo "Starting Nessus Service..."
sudo systemctl start nessusd
sudo systemctl enable nessusd
# Show Service Status
sudo systemctl status nessusd --no-pager
# Show Access URL
IP=$(hostname -I | awk '{print $1}')
echo "Nessus is installed. Access it at: https://$IP:8834"
πΉ Automated Installation for Windows
π Steps to Use
- Copy & paste the following script into PowerShell.
- Save it as
install_nessus.ps1
. - Open PowerShell as Administrator and run:
Set-ExecutionPolicy Bypass -Scope Process -Force .\install_nessus.ps1
π Windows PowerShell Installation Script
# Define Nessus Version
$nessusVersion = "10.5.0"
$downloadUrl = "https://downloads.nessus.org/nessus/$nessusVersion/Nessus-$nessusVersion-x64.msi"
$installerPath = "$env:TEMP\NessusInstaller.msi"
# Download Nessus
Write-Host "Downloading Nessus..."
Invoke-WebRequest -Uri $downloadUrl -OutFile $installerPath
# Install Nessus
Write-Host "Installing Nessus..."
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i $installerPath /quiet /norestart" -Wait
# Start Nessus Service
Write-Host "Starting Nessus Service..."
Start-Service -Name "Tenable Nessus"
# Check if Nessus is Running
Write-Host "Checking Nessus Status..."
Get-Service -Name "Tenable Nessus"
# Show Access URL
$ip = (Get-NetIPAddress | Where-Object { $_.AddressFamily -eq "IPv4" -and $_.InterfaceAlias -notlike "*Loopback*" }).IPAddress
Write-Host "Nessus is installed. Access it at: https://$ip:8834"
β Features of These Scripts
β Automatically detects OS (Linux version).
β Downloads the correct Nessus package based on OS.
β Starts & enables Nessus service after installation.
β Shows Nessus Web UI URL after installation.