Automated script to install Tenable Nessus on both Linux (Ubuntu, RHEL, CentOS) and Windows

set name servers from WHM

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

  1. Copy & paste the script into a file (install_nessus.sh).
  2. Give execute permission: chmod +x install_nessus.sh
  3. 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

  1. Copy & paste the following script into PowerShell.
  2. Save it as install_nessus.ps1.
  3. 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.

About Anant 443 Articles
Senior technical writer