(Last Updated On: January 7, 2019)

In this article, we will discuss how to Install Metasploit Framework on Ubuntu 18.04 / Debian 9. Metasploit Framework is an open source project that provides the infrastructure, content, and tools to perform extensive security auditing and penetration testing.

The commercial editions of Metasploit are available to users who prefer to use a web interface to pentest. The Metasploit Framework runs the following services.

  • PostgreSQL Database server – used by Metasploit to store data from a project.
  • Ruby on Rails
  • Metasploit service

Metasploit Framework Requirements

Below are the minimum hardware requirements for running Metasploit Framework on Ubuntu 18.04 / Debian 9.

  • 2 GHz+ processor
  • 4 GB RAM available (8 GB recommended)
  • 1 GB available disk space (50 GB recommended)
  • 64-bit version of Ubuntu 18.04 / Debian 9

Install Metasploit Framework on Ubuntu 18.04 / Debian 9

The easiest way of installing Metasploit Framework on Ubuntu 18.04 / Debian 9 is from the Metasploit installer. This installer ships with all the dependencies and tools required to run the Metasploit Framework.

Download Metasploit installer by running the commands below in your terminal.

curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall

Once the script is downloaded,make it executable

chmod 755 msfinstall

Then execute:

# ./msfinstall
Adding metasploit-framework to your repository list..OK
Updating package cache..OK
Checking for and installing update..
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
metasploit-framework
0 upgraded, 1 newly installed, 0 to remove and 122 not upgraded.
Need to get 169 MB of archives.
After this operation, 397 MB of additional disk space will be used.
Get:1 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid/main amd64 metasploit-framework amd64 4.17.35+20190105104028~1rapid7-1 [169 MB]
Fetched 169 MB in 4s (42.3 MB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package metasploit-framework.
(Reading database … 34892 files and directories currently installed.)
Preparing to unpack …/metasploit-framework_4.17.35+20190105104028~1rapid7-1_amd64.deb …
Unpacking metasploit-framework (4.17.35+20190105104028~1rapid7-1) …
Setting up metasploit-framework (4.17.35+20190105104028~1rapid7-1) …
update-alternatives: using /opt/metasploit-framework/bin/msfbinscan to provide /usr/bin/msfbinscan (msfbinscan) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfconsole to provide /usr/bin/msfconsole (msfconsole) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfd to provide /usr/bin/msfd (msfd) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfdb to provide /usr/bin/msfdb (msfdb) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfelfscan to provide /usr/bin/msfelfscan (msfelfscan) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfmachscan to provide /usr/bin/msfmachscan (msfmachscan) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfpescan to provide /usr/bin/msfpescan (msfpescan) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfrop to provide /usr/bin/msfrop (msfrop) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfrpc to provide /usr/bin/msfrpc (msfrpc) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfrpcd to provide /usr/bin/msfrpcd (msfrpcd) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfupdate to provide /usr/bin/msfupdate (msfupdate) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/msfvenom to provide /usr/bin/msfvenom (msfvenom) in auto mode
update-alternatives: using /opt/metasploit-framework/bin/metasploit-aggregator to provide /usr/bin/metasploit-aggregator (metasploit-aggregator) in auto mode
Run msfconsole to get started

Create and initialize the msf database.

$ msfdb init
Creating database at /home/jmutai/.msf4/db
Starting database at /home/jmutai/.msf4/db…success
Creating database users
Creating initial database schema

Launch msfconsole

Now  that database is initialized, you can launch msfconsole

$ msfconsole

Sample output

Verify database connectivity with the db_status command as shown below.

msf > db_status
[*] postgresql connected to msf
msf >

Updating Metasploit Framework

To update your Metasploit Framework on Ubuntu 18.04 / Debian 9. run the command:

# msfupdate
Updating package cache..OK
Checking for and installing update..
Reading package lists… Done
Building dependency tree
Reading state information… Done
metasploit-framework is already the newest version (4.17.35+20190105104028~1rapid7-1).
0 upgraded, 0 newly installed, 0 to remove and 123 not upgraded.

You can check your Framework version using:

# msfconsole  --version
Framework Version: 4.17.35-dev-

Cheers!. You now have Metasploit Framework installed on Ubuntu 18.04 / Debian 9 system.