{"id":6965,"date":"2025-03-23T17:28:48","date_gmt":"2025-03-23T17:28:48","guid":{"rendered":"https:\/\/www.ktchost.com\/blog\/?p=6965"},"modified":"2025-03-23T17:29:57","modified_gmt":"2025-03-23T17:29:57","slug":"automated-script-to-install-tenable-nessus-on-both-linux-ubuntu-rhel-centos-and-windows","status":"publish","type":"post","link":"https:\/\/www.ktchost.com\/blog\/automated-script-to-install-tenable-nessus-on-both-linux-ubuntu-rhel-centos-and-windows\/","title":{"rendered":"Automated script to install Tenable Nessus on both Linux (Ubuntu, RHEL, CentOS) and Windows"},"content":{"rendered":"\n<p>Here\u2019s an <strong>automated script<\/strong> to install <strong>Tenable Nessus<\/strong> on both <strong>Linux (Ubuntu, RHEL, CentOS)<\/strong> and <strong>Windows<\/strong>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\ud83d\udd39 Automated Installation Script for Linux<\/strong><\/h2>\n\n\n\n<p>This script detects your OS and installs Nessus accordingly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\udccc Steps to Use<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Copy &amp; paste<\/strong> the script into a file (<code>install_nessus.sh<\/code>).<\/li>\n\n\n\n<li><strong>Give execute permission<\/strong>: <code>chmod +x install_nessus.sh<\/code><\/li>\n\n\n\n<li><strong>Run the script<\/strong>: <code>sudo .\/install_nessus.sh<\/code><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\ude80 Linux Installation Script<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\n# Detect Linux Distribution\nif &#91; -f \/etc\/os-release ]; then\n    . \/etc\/os-release\n    OS=$ID\nelse\n    echo \"Unsupported Linux distribution\"\n    exit 1\nfi\n\n# Set Nessus Download URL\nNESSUS_VERSION=\"10.5.0\"\nif &#91;&#91; \"$OS\" == \"ubuntu\" || \"$OS\" == \"debian\" ]]; then\n    FILE=\"Nessus-${NESSUS_VERSION}-ubuntu_amd64.deb\"\n    URL=\"https:\/\/downloads.nessus.org\/nessus\/${NESSUS_VERSION}\/${FILE}\"\n    INSTALL_CMD=\"dpkg -i $FILE\"\nelif &#91;&#91; \"$OS\" == \"rhel\" || \"$OS\" == \"centos\" || \"$OS\" == \"amzn\" ]]; then\n    FILE=\"Nessus-${NESSUS_VERSION}-es8.x86_64.rpm\"\n    URL=\"https:\/\/downloads.nessus.org\/nessus\/${NESSUS_VERSION}\/${FILE}\"\n    INSTALL_CMD=\"rpm -ivh $FILE\"\nelse\n    echo \"Unsupported OS: $OS\"\n    exit 1\nfi\n\n# Download Nessus\necho \"Downloading Nessus...\"\ncurl -O $URL\n\n# Install Nessus\necho \"Installing Nessus...\"\nsudo $INSTALL_CMD\n\n# Start and Enable Nessus Service\necho \"Starting Nessus Service...\"\nsudo systemctl start nessusd\nsudo systemctl enable nessusd\n\n# Show Service Status\nsudo systemctl status nessusd --no-pager\n\n# Show Access URL\nIP=$(hostname -I | awk '{print $1}')\necho \"Nessus is installed. Access it at: https:\/\/$IP:8834\"\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\ud83d\udd39 Automated Installation for Windows<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\udccc Steps to Use<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Copy &amp; paste the following script into <strong>PowerShell<\/strong>.<\/li>\n\n\n\n<li>Save it as <code>install_nessus.ps1<\/code>.<\/li>\n\n\n\n<li>Open <strong>PowerShell as Administrator<\/strong> and run: <code>Set-ExecutionPolicy Bypass -Scope Process -Force .\\install_nessus.ps1<\/code><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\ud83d\ude80 Windows PowerShell Installation Script<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code># Define Nessus Version\n$nessusVersion = \"10.5.0\"\n$downloadUrl = \"https:\/\/downloads.nessus.org\/nessus\/$nessusVersion\/Nessus-$nessusVersion-x64.msi\"\n$installerPath = \"$env:TEMP\\NessusInstaller.msi\"\n\n# Download Nessus\nWrite-Host \"Downloading Nessus...\"\nInvoke-WebRequest -Uri $downloadUrl -OutFile $installerPath\n\n# Install Nessus\nWrite-Host \"Installing Nessus...\"\nStart-Process -FilePath \"msiexec.exe\" -ArgumentList \"\/i $installerPath \/quiet \/norestart\" -Wait\n\n# Start Nessus Service\nWrite-Host \"Starting Nessus Service...\"\nStart-Service -Name \"Tenable Nessus\"\n\n# Check if Nessus is Running\nWrite-Host \"Checking Nessus Status...\"\nGet-Service -Name \"Tenable Nessus\"\n\n# Show Access URL\n$ip = (Get-NetIPAddress | Where-Object { $_.AddressFamily -eq \"IPv4\" -and $_.InterfaceAlias -notlike \"*Loopback*\" }).IPAddress\nWrite-Host \"Nessus is installed. Access it at: https:\/\/$ip:8834\"\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u2705 Features of These Scripts<\/strong><\/h2>\n\n\n\n<p>\u2714 <strong>Automatically detects OS<\/strong> (Linux version).<br>\u2714 <strong>Downloads the correct Nessus package<\/strong> based on OS.<br>\u2714 <strong>Starts &amp; enables Nessus service<\/strong> after installation.<br>\u2714 <strong>Shows Nessus Web UI URL<\/strong> after installation.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Here\u2019s an automated script to install Tenable Nessus on both Linux (Ubuntu, RHEL, CentOS) and Windows. \ud83d\udd39 Automated Installation Script for Linux This script detects <a class=\"mh-excerpt-more\" href=\"https:\/\/www.ktchost.com\/blog\/automated-script-to-install-tenable-nessus-on-both-linux-ubuntu-rhel-centos-and-windows\/\" title=\"Automated script to install Tenable Nessus on both Linux (Ubuntu, RHEL, CentOS) and Windows\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":6686,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40,42,91],"tags":[764,502,978,722,975,981,474,976,971,979,974,980,982,968,966,977],"class_list":["post-6965","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripts","category-security","category-third-party-script","tag-cloud-security","tag-compliance","tag-cyber-threats","tag-cybersecurity","tag-ethical-hacking","tag-it-security","tag-linux-security","tag-nessus","tag-network-security","tag-penetration-testing","tag-risk-management","tag-security-scanner","tag-system-hardening","tag-tenable","tag-vulnerability-management","tag-windows-security"],"_links":{"self":[{"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/posts\/6965"}],"collection":[{"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/comments?post=6965"}],"version-history":[{"count":1,"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/posts\/6965\/revisions"}],"predecessor-version":[{"id":6966,"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/posts\/6965\/revisions\/6966"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/media\/6686"}],"wp:attachment":[{"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/media?parent=6965"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/categories?post=6965"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ktchost.com\/blog\/wp-json\/wp\/v2\/tags?post=6965"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}