This is my first take to run openvas9 with Postgresql 9.5 on Ubuntu 16.04 LTS.

And it’s mostly taken from https://forums.kali.org/showthread.php?37859-Install-Openvas-9-with-Postgres-on-Kali-linux-Rolling with som tweaks for Ubuntu 16.04
As usual, this is an insecure installation that is supposed to be used as lab, or at least segmented from user interaction.

Do this on a newly installed VM or iron. But when you installed this, I do not guarantee that is plays nice with anything other on that box.

And this is “a works for me” documentation, and perhaps not for you :) If you have any suggestions or questions pls ask in the comments.

Lets start

Begin with an update of the repos.

sudo apt update; sudo apt -y dist-upgrade; sudo apt -y autoremove

Then we install postgresql locally on the server.

sudo apt install postgresql
sudo systemctl status postgresql

Lets do some user and db to host our Openvas db.

sudo -u postgres createuser root
sudo -u postgres createdb -O root tasks
sudo -u postgres psql tasks

create role dba with superuser noinherit;
grant dba to root;
create extension "uuid-ossp";

Exit with \q

Install deps

sudo apt install postgresql-contrib postgresql-server-dev-9.5

Download the src

cd /usr/local/src
sudo mkdir -p openvas/debs
cd openvas

Install repo

sudo add-apt-repository -s ppa:mrazavi/openvas
sudo apt update

Install dpkg build mgmt tools

sudo apt install dpkg-dev debhelper cmake pkg-config libglib2.0-dev libgnutls-dev libgcrypt11-dev libsqlite3-dev libgpgme11-dev rats libopenvas9-dev smbclient

Become mighty (scary) root.
And fetch some source pkgs

sudo su
apt source openvas9-manager

Check that all build deps is there

cd openvas9-manager-7.0.1
dpkg-checkbuilddeps

Add -DBACKEND=POSTGRESQL to rules

vim debian/rules

override_dh_auto_configure:
        dh_auto_configure -- -DLOCALSTATEDIR=/var -DSYSCONFDIR=/etc -DBACKEND=POSTGRESQL
echo "usr/lib/openvasmd/pg" >> debian/openvas-manager.dirs
echo "usr/lib/openvasmd/pg" >> debian/openvas-manager.install

Build and install the debs

dpkg-buildpackage -uc -us
mv ../*.deb ../debs/
dpkg -i ../debs/openvas9-manager*.deb
apt-mark hold openvas9-manager
apt install openvas9

This should make your Openvas save tasks in postgre instead of sqlite

And then to login GSA make do som voodoo.

openvasmd --user=admin --new-password=super_secret_password
openvas-manage-certs -a

And then some housekeeping.

greenbone-scapdata-sync --verbose
greenbone-certdata-sync --verbose
greenbone-nvt-sync --verbose
openvasmd --rebuild --progress

If you want to connect to GSA from another computer.

vim /etc/default/openvas-gsa

Uncomment #LISTEN_ADDRESS=“0.0.0.0”

sudo service openvas-gsa restart

Then browse top https://a.b.c.d:4000
User: admin
Passwd: super_secret_password

And at last do not forget your well earned Coffee.