A few weeks ago I read an article on Vagrant using libvirt, my preferred solution for virtualization on Fedora/RedHat/Centos using QEMU/kvm.
https://developer.fedoraproject.org/tools/vagrant/vagrant-libvirt.html
RedHat decides to end support on Centos 8 as of end 2021.
(see: https://blog.cpanel.com/centos-8-end-of-life-announcement/ and https://www.redhat.com/en/blog/centos-stream-building-innovative-future-enterprise-linux).
An alternative existing today is Oracle Linux 8 which is an easy conversion of your existing Centos 8 https://linux.oracle.com/switch/centos/.
I will show you how to setup an Oracle Linux 8 with Vagrant and install PostgreSQL 12 directly from AppStream, the RedHat replacement for Software Collection.
Create a Vagrantfile with:
Vagrant.configure("2") do |config|
config.vm.box = "generic/oracle8"
end
$ vagrant up
$ vagrant ssh
Then you start PostgreSQL installation:
$ sudo su -
# dnf module enable postgresql:12
# dnf install postgresql-server
# export PGSETUP_INITDB_OPTIONS="--pgdata=/dstpol/databases/postgres/data/ -E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8' -k"
# postgresql-setup --initdb
# su – postgres
$ /usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
$ psql -l