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 DatabaseIn 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 for the Metasploit Framework.
Switch to the postgres user account
sudo su postgresCreate a postgres role for Metasploit
createuser msfuser -S -R -PCreate the database
createdb msfdb -O msfuserExit from the postgres user account
exitEnable Postgres to start automatically
sudo update-rc.d postgresql enable Install & Configure RVMRVM 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 409B6B1796C275462A1703113804BB82D39DC0E3Install RVM
\curl -sSL https://get.rvm.io | bash -s stable --rubySource The RVM Scripts
source ~/.rvm/scripts/rvmInstall The Bundler Gem
gem install bundler Download & Install Metasploit FrameworkCheckout the latest source repository from Github.
git clone https://github.com/rapid7/metasploit-framework.gitChange into the new directory.
cd metasploit-framework/Install the necessary version of Ruby.
rvm --install .ruby-versionInstall the necessary Ruby Gems.
bundle installStart the Metasploit Framework
./msfconsole Configuring Metasploit Framework & Postgrescreate 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: msfdbHopefully 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