Failed to connect to the database: could not connect to server: connection refused
Udah Jelas banget dari Pesan nya, Database nya gak connected :)
Ok, Bgini cara Fix nya
1. Pastikan service postgresql, kalian berjalan
2. cek file config database metasploit nya ( /opt/metasploit-4.4.0/config/database.yml )
Jalankan Service Postgresql nya.
$ service postgresql start
Masih ada error ??
bisa jadi itu karna masalah config dengan dengan database msf kalian,
dan ini cara untuk setup new database msf dengan postgresql
Root@Ganteng:# su - postgres
postgres@localhost~$ createuser [Nama User] -P
postgres@localhost~$ [Enter password]
postgres@localhost~$ Validate password
postgres@localhost~$ Shall the new role be a superuser? n
postgres@localhost~$ Shall the new role be allowed to create databases? n
postgres@localhost~$ Shall the new role be allowed to create new roles? n
postgres@localhost~$ createdb --owner=[Nama User] [Name_Database]
postgres@localhost~$ exit
setelah membuat user di posgresql
next kita membuat file configure database Metasploiut nya.
kalian bisa liat contoh file nya di
"/usr/share/metasploit-framework/config/database.yml.example"
edit aja langsung itu file example nya..
Input data-data nya sesuai yg tadi dibuat di postgresql
Kemudia save
dan rename dari "database.yml.example" to "database.yml"
Ok,Next... Buka msfconsole
Jika masih belum connect,coba dengan meng'connectkan langsung di Metasploit nya
msf > db_connect NamaUser:Passwd@127.0.0.1:5432/name_database
Done..



