Debian 7 Metasploit Setup

Written by Peter Davies on .

Install the pre-requisite APT dependancies:

apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev openjdk-7-jre subversion git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev ruby1.9.3

Install metasploit ruby dependancies:

gem install wirble sqlite3 bundler

Install a few network tools that are useful:

apt-get install nmap

Get the latest Metasploit from Git:

cd /opt
git clone

Create global commands and install the gems:

cd metasploit-framework
bash -c 'for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done'
bundle install

Setup the database:

su postgres
createuser msf -P -S -R -D
createdb -O msf msf

Create the database file: nano /opt/metasploit-framework/database.yml adding to it:

   adapter: postgresql
   database: msf
   username: msf
   port: 5432
   pool: 75
   timeout: 5

Create an environmental variable:

sh -c "echo export MSF_DATABASE_CONFIG=/opt/metasploit-framework/database.yml >> /etc/profilesource /etc/profile"

Install the port scanning gem:

gem install pcaprub

You can run the application from the following: msfconsole