Install metasploit 4.12.15 on Ubuntu 16.04 with postgres compatibility

If you want install metasploit on your distro, follow these steps:
If you try Kali distribution, replace /opt by /usr/share and skip the git clone line

sudo su  
apt-get -y install build-essential zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev locate libreadline6-dev libcurl4-openssl-dev git-core libssl-dev libyaml-dev openssl autoconf libtool ncurses-dev bison curl wget postgresql postgresql-contrib libpq-dev libapr1 libaprutil1 libsvn1 libpcap-dev libsqlite3-dev git-core postgresql curl ruby2.3 nmap gem  
gem install wirble sqlite3 bundler  
cd /opt  
git clone https://github.com/rapid7/metasploit-framework.git  
cd metasploit-framework  
bundle install 

If you run ./msfconsole maybe you won't connect to postgres

msf > db_status
[*] postgresql selected, no connection

To solve it, you need to create an user an a database for postgres. I my case I name all values as msf4:

sudo -s
su postgres
createuser msf4 -P
Enter password for new role: msf4
Enter it again: msf4
createdb --owner=msf4 msf4

Now create a yml file in your config folder inside metasploit-framework with this follow content:

development: &pgsql
  adapter: postgresql
  database: msf4
  username: msf4
  password: msf4
  host: localhost
  port: 5432
  pool: 200
  timeout: 5

production: &production
  <<: *pgsql

test:
  <<: *pgsql
  database: msf4
  username: msf4
  wassword: msf4

Now, rut it again:

./msfconsole  
msf > db_status
[*] postgresql connected to msf4

Comments

Popular posts from this blog

from: can't read /var/mail/ in Python scripts

Fix "Set scan parameters failed: Input/output error" on Ubuntu 16.04

How to install a WhatsApp bot based on Python