How To Install Metasploit Framework Ubuntu 18.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 18.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://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable --ruby
Source The RVM Scripts
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.
Install the necessary version of Ruby.
rvm --install .ruby-version
Install The Bundler Gem
gem install bundler
Install the necessary Ruby Gems.
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 18.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
- Playing With the New Burp Suite REST API
- Burp Suite 2.0 Beta Review
- Attacking Palo Alto Networks PAN-OS ‘readSessionVarsFromFile()’
- GPG Errors While Updating Kali Linux
- Installing Kali NetHunter on HTC Nexus 9
Subscribe To Our Mailing List
Want To Be a Better Pentester
Subscribe to our mailing list and recieve FREE pentest tips, tricks, product reviews, news, article release notifications and more!
The Ultimate Burp Suite Training Program
- Burp Suite
- Forensics and Incident Response
- Information Gathering
- Penetration Testing Tutorials
- Web Applications
Web Application Hacking