loading...

How to Install GVM Vulnerability Scanner on Ubuntu 20.04

Below is an overview of one proven method to install and configure GVM (formerly OpenVAS) on Ubuntu 20.04. There are two common approaches:

  1. Package-Based Installation
    Ubuntu 20.04 provides a “gvm” metapackage. In a simple scenario you can run:

    sudo apt update && sudo apt upgrade -y
    sudo apt install gvm
    sudo gvm-setup
    sudo gvm-check-setup
    

    This method installs the prebuilt components and runs some basic configuration (such as creating an admin user and updating feeds). However, note that sometimes the Ubuntu packages may be incomplete (for example, missing the Greenbone Security Assistant – GSA) so you might need to build or adjust further settings.

  2. Building from Source
    This method (detailed in guides like the HowtoForge tutorial) gives you more control and the latest features. The high-level steps are as follows:

    a. Prepare Your System and Install Dependencies:
    Update your system and install required packages:

    sudo apt update && sudo apt upgrade -y
    sudo apt install software-properties-common build-essential cmake pkg-config libglib2.0-dev libgpgme-dev libgnutls28-dev uuid-dev libssh-gcrypt-dev libldap2-dev doxygen graphviz libradcli-dev libhiredis-dev libpcap-dev bison libksba-dev libsnmp-dev nmap curl wget git texlive-latex-extra texlive-fonts-recommended -y
    

    Also install Yarn (used during build steps):

    curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
    echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
    sudo apt update
    sudo apt install yarn -y
    

    And install PostgreSQL (which is used by GVM):

    sudo apt install postgresql postgresql-contrib postgresql-server-dev-all -y
    

    Then configure the PostgreSQL database:

    sudo -u postgres createuser -DRS gvm
    sudo -u postgres createdb -O gvm gvmd
    sudo -u postgres psql gvmd -c "create role dba with superuser noinherit;"
    sudo -u postgres psql gvmd -c "grant dba to gvm;"
    sudo -u postgres psql gvmd -c "create extension "uuid-ossp";"
    sudo -u postgres psql gvmd -c "create extension "pgcrypto";"

    b. Create a Dedicated GVM User and Set Up Environment:

    sudo adduser --disabled-password --home /opt/gvm --gecos "GVM User" gvm
    sudo mkdir /opt/gvm
    sudo chown gvm:gvm /opt/gvm
    echo 'export PATH="$PATH:/opt/gvm/bin:/opt/gvm/sbin:/opt/gvm/.local/bin"' | sudo tee /etc/profile.d/gvm.sh
    sudo chmod 0755 /etc/profile.d/gvm.sh
    source /etc/profile.d/gvm.sh
    echo "/opt/gvm/lib" | sudo tee /etc/ld.so.conf.d/gvm.conf
    sudo ldconfig
    

    c. Download the Source Code:
    Switch to the gvm user and clone the repositories:

    sudo -u gvm -H mkdir -p /opt/gvm/src && cd /opt/gvm/src
    sudo -u gvm -H git clone -b gvm-libs-20.08 --single-branch https://github.com/greenbone/gvm-libs.git
    sudo -u gvm -H git clone -b openvas-20.08 --single-branch https://github.com/greenbone/openvas.git
    sudo -u gvm -H git clone -b gvmd-20.08 --single-branch https://github.com/greenbone/gvmd.git
    sudo -u gvm -H git clone -b gsa-20.08 --single-branch https://github.com/greenbone/gsa.git
    sudo -u gvm -H git clone -b ospd-openvas-20.08 --single-branch https://github.com/greenbone/ospd-openvas.git

    d. Build and Install the Components:
    For each component, create a build directory, run CMake, and install. For example, for gvm-libs:

    cd gvm-libs
    mkdir build && cd build
    cmake -DCMAKE_INSTALL_PREFIX=/opt/gvm ..
    make
    sudo make install
    

    Repeat similar steps for OpenVAS, gvmd, and finally GSA. Don’t forget to install ospd-openvas and adjust the scanner settings:

    sudo gvmd --create-user=admin --password=admin
    gvmd --get-scanners  # then modify the default scanner if needed:
    sudo gvmd --modify-scanner= --scanner-host=/var/run/ospd/ospd.sock

    e. Update Vulnerability Feeds and Generate Certificates:
    Update the NVTs, CERT, and SCAP feeds:

    sudo -u gvm greenbone-nvt-sync
    sudo -u gvm greenbone-feed-sync --type CERT
    sudo -u gvm greenbone-feed-sync --type SCAP
    

    Generate certificates:

    sudo gvm-manage-certs -a

    f. Configure and Start Services:
    Create and enable systemd service files for gvmd, gsad (the web interface), and ospd-openvas. Once services are set up and started (or use the provided script), you can verify that gvmd, gsad, and the scanner are running.

    Finally, access the GVM web interface (typically via HTTPS on port 443 or 9392) and log in using the admin credentials you set.

    Detailed instructions and sample systemd files are provided in guides like the HowtoForge tutorial.


In Summary:

  • The package-based approach (using apt install gvm) is the quickest but might require tweaks if components like GSA are missing.
  • The source build approach gives you the latest GVM 20.x components (or higher, if available) with full control over configuration.

Choose the method that best suits your experience and requirements. For more in-depth instructions and troubleshooting tips, refer to tutorials like the one on HowtoForge and discussions on the Greenbone Community Forum.

0 Comments

Leave a comment