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 https://github.com/rapid7/metasploit-framework.git

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
exit

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

production:
   adapter: postgresql
   database: msf
   username: msf
   password: 
   host: 127.0.0.1
   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

  1. http://www.darkoperator.com/installing-metasploit-in-ubuntu/
  2. http://www.upubuntu.com/2011/09/how-to-install-metasploit-on-debian.html