Compile and install OpenVas from source on ubuntu 18.04 live server


////////// Install & Running PostgreSQL on Ubuntu 18.04
sudo apt install postgresql postgresql-contrib postgresql-server-dev-10
sudo systemctl status postgresql
systemctl is-enabled postgresql

////////// Create PostgreSQL User and Database
sudo -Hiu postgres
createuser root
createdb -O root tasks

////////// Grant PostgreSQL User DBA Roles
sudo -Hiu postgres
psql tasks
create role dba with superuser noinherit;
grant dba to root;
create extension "uuid-ossp";

///////// Build OpenVAS 9 Manager From Source
sudo mkdir -p /usr/local/src/openvas/debs
sudo apt install software-properties-common
sudo add-apt-repository ppa:mrazavi/openvas

sudo nano /etc/apt/sources.list.d/mrazavi-ubuntu-openvas-bionic.list
deb bionic main
deb-src bionic main

sudo apt update

///////// Install Required Build Tools and Dependencies
sudo apt install dpkg-dev debhelper cmake pkg-config libglib2.0-dev libgnutls28-dev build-essential libgcrypt11-dev libsqlite3-dev libgpgme-dev rats libopenvas9-dev

///////// Download OpenVAS Manager Source code
cd /usr/local/src/openvas
sudo apt source openvas9-manager

///////// Verify OpenVAS build dependencies
cd /usr/local/src/openvas/openvas9-manager-7.0.3
sudo dpkg-checkbuilddeps

///////// Configure OpenVAS Source code to use PostgreSQL
sudo nano debian/rules

Add '-DBACKEND=POSTGRESQL' to the line below to enable support for PostgreSQL

sudo sh -c "echo 'usr/lib/openvasmd/pg' >> debian/openvas9-manager.dirs"
sudo sh -c "echo 'usr/lib/openvasmd/pg' >> debian/openvas9-manager.install"

///////// Compile and Install OpenVAS 9 on Ubuntu 18.04
sudo dpkg-buildpackage -uc -us
sudo mv /usr/local/src/openvas/.deb /usr/local/src/openvas/debs/
sudo apt install /usr/local/src/openvas/debs/

sudo apt-mark hold openvas9-manager

sudo su

//////// Sync the OpenVAS NVT feed

/////// Synchronize Security Content Automation Protocol (SCAP) and Computer Emergency Readiness Team (CERT) vulnerability data.

systemctl restart openvas-scanner
systemctl restart openvas-manager
systemctl restart openvas-gsa

systemctl enable openvas-scanner
systemctl enable openvas-manager
systemctl enable openvas-gsa

///////// OpenVAS database must be rebuilt so the OpenVAS manager can access the newly updated data.
openvasmd --rebuild --progress --verbose
......Rebuilding NVT cache... done.

ps aux | grep openvas | grep -v grep

/////// For to export the reports as PDF we need the latex fonts support
sudo apt install texlive-latex-extra --no-install-recommends
sudo apt install texlive-fonts-recommended --no-install-recommends

///////// Accessing OpenVAS web interface
nano /etc/default/openvas-gsa

To set listening address:

sudo systemctl restart openvas-gsa

///////// Set new password for user admin
openvasmd --user=admin --new-password=yourpwd

//////// Via Browser
https://yourserverip:4000 (default:admin:yourpwd)
openvasmd --get-users