How To Install Metasploit Framework Ubuntu 14.04

Author: Royce Davis Posted In Tools On: 2016/09/30 Comments: 7
How-to-install-metasploit-framework-ubuntu-14-04

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

exit

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://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Install RVM

\curl -sSL https://get.rvm.io | 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 https://github.com/rapid7/metasploit-framework.git

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

./msfconsole

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
test:
  <<: *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

Facebooktwittergoogle_plusredditpinterestlinkedinmailFacebooktwittergoogle_plusredditpinterestlinkedinmail
Posted In:  Tools
7  comments
7 Comments
  • Hi,
    Do you have a general article about Red Team, blue Team and Hunt team at a penetration test?
    In Germany I found that

    https://www.janotta-partner.de/blog.red-blue-hunt-team.html
    Thank you for your reply

  • I’m getting this error message when trying to run msfconsole:
    https://github.com/pry/pry (at master@1f64463) is not yet checked out. Run `bundle install` first.

    but when i run bundle install I get:
    Bundle complete! 18 Gemfile dependencies, 132 gems now installed.
    Use `bundle show [gemname]` to see where a bundled gem is installed.

    Also I am unable to locate the “~/.msf4/” directory

    • Hey Ryan, thanks for your comment. I just ran a

      git pull

      to update to the latest code and when trying to run msfconsole I got the exact error you mentioned.

      https://github.com/pry/pry (at master@1f64463) is not yet checked out. Run `bundle install` first.

      However for me running

      bundle install

      resolved the issue.

      Also the ./msf4 directory doesn’t exist until you run msfconsole for the first time. Checkout this video tutorial for additional information. https://www.pentestgeek.com/lessons/installing-metasploit-framework

  • Metasploit Tutorial From Basic To Advance,Fast Track Hacking Tutorial,Fast-Track Mass Client-Side Attack,Nessus With Metasploit Tutorial,Integrate Nessus With Metasploit,Metasploit Remote Desktop Exploit,Metasploit Autopwn With Nessus,Social Engineering toolkit

  • awesome article bro thanks

  • 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.

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

  • Leave a Reply

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

    Share This

    Follow Pentest Geek

    twitterrssyoutubetwitterrssyoutube

    Recent Posts

    Free Course

    Penetration Testing

    Categories

    Metasploit

    Web Application Hacking


    Metasploit-The-Penetration-Testers-Guide-0

    Buy it on Amazon.com

    css.php