(Last Updated On: June 5, 2019)

In this article, we will discuss how to Install Metasploit Framework on Debian 10 / Debian 9. Metasploit Framework is the world’s most popular open source penetration testing framework for security professionals and researchers. It provides the infrastructure, content, and tools to perform extensive security auditing and penetration testing.

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

The minimum hardware requirements for running Metasploit Framework on Debian 10 / Debian 9 are:

  • CPU – 2 GHz+ processor
  • RAM – 4 GB RAM available (8 GB recommended)
  • Disk Space – 1 GB available disk space (50 GB recommended)

Install Metasploit Framework on Debian 10 / Debian 9

Installing Metasploit framework on Debian 10/9 has been made easy by provision of Metasploit installer script. You just need to download the installer and run it.

Download Metasploit installer using wget or curl command.

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 +x msfinstall

Then execute the installer to install Metasploit Framework on Debian 10/9.

$ ./msfinstall

Switching to root user to update the package
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 0 not upgraded.
Need to get 212 MB of archives.
After this operation, 476 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 5.0.27+20190604165801~1rapid7-1 [212 MB]
Fetched 212 MB in 3min 32s (1,001 kB/s)                                        
Selecting previously unselected package metasploit-framework.
(Reading database ... 140536 files and directories currently installed.)
Preparing to unpack .../metasploit-framework_5.0.27+20190604165801~1rapid7-1_amd64.deb ...
Unpacking metasploit-framework (5.0.27+20190604165801~1rapid7-1) ...
Setting up metasploit-framework (5.0.27+20190604165801~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
Run msfconsole to get started

The installer script will add Metasploit Framework repository to your repository list and install all tools required. If you have slower internet, the download may take a while.

Check your Framework version using:

$ msfconsole --version
Framework Version: 5.0.27-dev-

When installation is completed, 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
Writing client authentication configuration file /home/jmutai/.msf4/db/pg_hba.conf
Stopping database at /home/jmutai/.msf4/db
Starting database at /home/jmutai/.msf4/db...success
Creating initial database schema
[?] Initial MSF web service account username? [jmutai]: 
[?] Initial MSF web service account password? (Leave blank for random password): 
Generating SSL key and certificate for MSF web service
Attempting to start MSF web service...success
MSF web service started and online
Creating MSF web service user jmutai

    ############################################################
    ##              MSF Web Service Credentials               ##
    ##                                                        ##
    ##        Please store these credentials securely.        ##
    ##    You will need them to connect to the webservice.    ##
    ############################################################

MSF web service username: jmutai
MSF web service password: password
MSF web service user API token: 1852b337c09cf94b7ea9a467d3cab4c2dc78ae19e3e8620df21cf743a36ecf68308de0fdaae02eb4

MSF web service configuration complete
The web service has been configured as your default data service in msfconsole with the name "local-https-data-service"

If needed, manually reconnect to the data service in msfconsole using the command:
db_connect --token 1852b337c09cf94b7ea9a467d3cab4c2dc78ae19e3e8620df21cf743a36ecf68308de0fdaae02eb4 --cert /home/jmutai/.msf4/msf-ws-cert.pem --skip-verify https://localhost:5443

The username and password are credentials for the API account:
https://localhost:5443/api/v1/auth/account

This will create an initial database schema, set service account and start services. Output similar to below should be printed.

Use printed credentials to access MSF Web Service & API.

Launching msfconsole

Now  that database is initialized, you can launch msfconsole

$ msfconsole
                                                  

                 _---------.
             .' #######   ;."
  .---,.    ;@             @@`;   .---,..
." @@@@@'.,'@@            @@@@@',.'@@@@ ".
'[email protected]@@@@@@@@@@@@          @@@@@@@@@@@@@ @;
   `[email protected]@@@@@@@@@@@        @@@@@@@@@@@@@@ .'
     "--'[email protected]@@  [email protected]        @ ,'-   .'--"
          "[email protected]' ; @       @ `.  ;'
            |@@@@ @@@     @    .
             ' @@@ @@   @@    ,
              `[email protected]@@@    @@   .
                ',@@     @   ;           _____________
                 (   3 C    )     /|___ / Metasploit! \
                 ;@'. __*__,."    \|--- \_____________/
                  '(.,...."/


       =[ metasploit v5.0.27-dev-                         ]
+ -- --=[ 1895 exploits - 1067 auxiliary - 329 post       ]
+ -- --=[ 547 payloads - 44 encoders - 10 nops            ]
+ -- --=[ 2 evasion                                       ]

msf5 > 

Verify database connectivity with the db_status command as shown below.

msf5 > db_status --token 1852b337c09cf94b7ea9a467d3cab4c2dc78ae19e3e8620df21cf743a36ecf68308de0fdaae02eb4 --cert /home/jmutai/.msf4/msf-ws-cert.pem --skip-verify https://localhost:5443
[*] Connected to remote_data_service: (https://localhost:5443). Connection type: http. Connection name: local-https-data-service.

Updating Metasploit Framework

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

$ msfupdate
Switching to root user to update the package
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 (5.0.27+20190604165801~1rapid7-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

To ameliorate your understanding of Metasploit Framework, visit Wiki page.

Install and Use Linux Malware Detect on CentOS / Fedora / Ubuntu / Debian

Vuls – Best Vulnerability Scanner for Linux / FreeBSD / WordPress / Network

How to Install and Configure OPNSense Firewall

How to Install Nessus Scanner on Ubuntu / Debian