How To Install Metasploit Framework Ubuntu 14.04

Author: Royce Davis Posted In Tools On: 2016/09/30 Comments: 3

The Metasploit Framework is an integral component to every penetration testers tool-kit. This guide will teach you how to install Metasploit Framework in Ubuntu 14.04. You will also install and configure RVM and Postgres. For additional information and troubleshooting tips please checkout some of the links in the related content section at the bottom of this tutorial.

Install Metasploit Dependencies

The following is a list of dependencies can also be found on the Rapid7 Github page Setting Up a Metasploit Development Environment

sudo apt-get install gpgv2 autoconf bison build-essential curl git-core libapr1 libaprutil1 libcurl4-openssl-dev libgmp3-dev libpcap-dev libpq-dev libreadline6-dev libsqlite3-dev libssl-dev libsvn1 libtool libxml2 libxml2-dev libxslt-dev libyaml-dev locate ncurses-dev openssl postgresql postgresql-contrib wget xsel zlib1g zlib1g-dev

Configure The Postgres Database

In order to get the most functionality after you install Metasploit Framework you will want to have the Postgres database properly configured. This allows for faster searching as well as a ton of great features for reporting and organizing your penetration testing results. Here is how to setup your Postgres database afre you install Metasploit Framework.

Switch to the postgres user account

sudo su postgres

Create a postgres role for Metasploit

createuser msfuser -S -R -P

Create the database

createdb msfdb -O msfuser

Exit from the postgres user account


Enable Postgres to start automatically

sudo update-rc.d postgresql enable

Install & Configure RVM

RVM is recommended by Rapid7 for manually installing Metasploit Framework. The following steps should be all you need to get up and running. Checkout the official RVM documentation for additional information and troubleshooting help.

Install the public keys

gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Install RVM

\curl -sSL | bash -s stable --ruby

Source The RVM Scripts

source ~/.rvm/scripts/rvm

Install The Bundler Gem

gem install bundler

Download & Install Metasploit Framework

Checkout the latest source repository from Github.

git clone

Change into the new directory.

cd metasploit-framework/

Install the necessary version of Ruby.

rvm --install .ruby-version

Install the necessary Ruby Gems.

bundle install

Start Metasploit


Configuring Metasploit & Postgres

create a file called “database.yml” within the “~/.msf4/” directory and paste in the contents below. Make sure to edit your password appropriately.

# Development Database
development: &pgsql
  adapter: postgresql
  database: msfdb
  username: msfuser
  password: [PASSWORD]
  host: localhost
  port: 5432
  pool: 5
  timeout: 5

# Production database -- same as dev
production: &production
  <<: *pgsql

# Test database -- not the same, since it gets dropped all the time
  <<: *pgsql
  database: msfdb

Hopefully everything went smoothly for you and you should now be up and running with Metasploit Framework in Ubuntu 14.04. If you ran into any trouble following this guide please check out some of the additional references below. If all else fails, feel free to ask a question in the comment section.

Install Metasploit Framework Additional References

Share this article

Posted In:  Tools
  • awesome article bro thanks

  • Thanks for sharing, thats a great shortcut! I’m just a control freak so I like to do everything manually ;-)

  • Nice tutorial. one command I found out about last year was “msfdb init”. this automates creating the msf db and user, adding config and sets msf to use the newly created yaml. you still have to install and start postgresql first.

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    Follow Pentest Geek


    Subscribe to Pentest Geek

    Recent Posts

    Penetration Testing



    Web Application Hacking


    Buy it on