Migrate database from one OS/GVM version to another

Hi All,
New to the discussion and relatively new to the GSE.
I am looking to move my database from one OS to another. I originally ran a pre built version of GVM on CentOS 7, but was not happy with that version. It was 10 something and had converted the sqlite DB to postgresql.
So I could use and build the GSE, I created a CentOS 8 machine, and would now like to move all the sqlite or postgresql database from the CentOS 7 to the new CentOS 8.

GVM is all built from sources and all ready to run, it just needs the tasks, targets, reports, etc so I can continue to monitor the history of targets scanned by the old system.
Any ideas or help would be gratefully appreciated.

Note, I did try a pg_dump -O gvmd >somefile on the “converted” CentOS 7 postgresql database and imported it on the CentOS 8 one, but none of the tasks, targets, etc appear in the CentOS 8 GVM. Perhaps a permissions issue?
Thanks in advance.

GVM versions

gsa-9.0.1
gvmd-9.0.1
gvm-libs-11.0.1
openvas-7.0.1
openvas-smb-1.0.5
ospd-2.0.1
ospd-openvas-1.0.1

Environment

CentOS 7, now CentOS 8
Linux localhost.localdomain 4.18.0-193.6.3.el8_2.x86_64 #1 SMP Wed Jun 10 11:09:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Built from source.

Hi All,
Well, I figured it out. Basic process was as follows:

  1. Make sure gvmd, gsad, etc are shut down on both hosts.

  2. If you started gvmd on the new host at some point, and you are migrating GVM versions as well, make sure you have dropped the gvmd database before you begin the migration. Create an empty gvmd database with the required extensions.

  3. Dump the database from the original server using pg_dump -O gvmd >/tmp/gvmd_dump.sql

  4. Copy the file to the new host. I copied it from oldhost:/tmp to newhost:/tmp

  5. Import it using (as user gvm in my case) psql -d gvmd -f /tmp/gvmd_dump.sql

  6. If you are also upgrading gvm (as I was), make sure you run (as user gvm in my case) gvmd -m

  7. Start it all back up, and log in as the admin user you had in your old GVM.

Hope that helps someone else.
Cheers

1 Like