If it's the first time you have run Metasploit Framework, you need to start the database service and initialize it. Metasploit uses a PostgreSQL database to store the logs and results, so the first thing we do is start the service:
service postgresql start
Then, we use the Metasploit database tool to create and initialize the database:
msfdb init
Then, we start the Metasploit console:
msfconsole