If Errors

In this page, we will post information about: how to solve an issues on Metasploit.

[Fix database connection issue]
#1) Open terminal & type 1 by 1:
assault@hackbook:~$ sudo service postgresql start
assault@hackbook:~$ sudo service metasploit start
#2) Open a new terminal tab and type:
assault@hackbook:~$ sudo msfconsole
*When msfconsole comes up & ready to go, type*
msf > msfdb init

*Now wait until msf will finish to build and connect to the DB*

#3) Exit from metasploit by the command:
msf > exit

#4) Rerun msfconsole, and type the command:
msf > db_status

If you’ve got this output, you are OK
[*] postgresql connected to msf

#5) Exit again from metasploit by the command:
msf > exit

#6) Open a new terminal tab, and type:
assault@hackbook:~$ sudo update-rc.d postgresql enable

It will prevent this message

##########
[-] Failed to connect to the database: could not connect to server: Connection refused
Is the server running on host “localhost” (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host “localhost” (127.0.0.1) and accepting
TCP/IP connections on port 5432?
##########

#7) Open a new terminal tab, and type:
assault@hackbook:~$ sudo msfupdate

*Once the msfupdate is finished, feel free to use Metasploit*