Following the normal installation process of OpenVAS on Kali 2024.1 failed at database creation with the error:
The database was created using collation version 2.37, but the operating system provides version 2.38.
The install gets half way through by creating two templates named template0 and template1 but then doesn’t rename them and import the data.
Here is the installation with the fix steps
Step 1 – Update The System
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
Step 2 – Install OpenVAS
sudo apt install gvm
sudo greenbone-feed-sync
sudo apt install openvas
sudo gvm-setup
Step 3 – Fix the Databases
If at this point your databases have failed to be created properly, and you see errors as below, you can fix it with the following commands:
WARNING: database "postgres" has a collation version mismatch
DETAIL: The database was created using collation version 2.37, but the operating system provides version 2.38.
HINT: Rebuild all objects in this database that use the default collation and run ALTER DATABASE postgres REFRESH COLLATION VERSION, or build PostgreSQL with the right library version.
sudo -u postgres psql
/l
Validate your database names then fix the databases
ALTER DATABASE template0 REFRESH COLLATION VERSION;
ALTER DATABASE template1 REFRESH COLLATION VERSION;
/q
systemctl daemon-reload && systemctl restart gvmd.service gsad.service
Step 4 – Rerun Setup
Run setup again and this time it should create your databases properly.
sudo gvm-setup
Step 5 – Create a User
Create your user account, but with a stronger password:
sudo -E -u _gvm gvmd --user=admin --new-password='password'
Note some guides omit the -E and -u _gvm, but from my experience without this for some reason it doesn’t work.
Step 6 – Validate Installation
Now you can run the gvm-check-setup and if all passes it will start OpenVAS on the URL https://127.0.0.1:9392
sudo gvm-check-setup
Step 7 – Change Binding (optional)
If you require to access your server from other hosts you can configure it to listen on all interfaces by editing the configuration:
sudo vim /usr/lib/systemd/system/gsad.service
-ExecStart=/usr/local/sbin/gsad --foreground --listen=127.0.0.1 --port=9392
+ExecStart=/usr/local/sbin/gsad --foreground --listen=0.0.0.0 --port=443
sudo systemctl daemon-reload
sudo systemctl restart gsad