In this article, we will discuss how to install Metasploit Framework on Ubuntu / Debian. 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 / Debian.
- 2 GHz+ processor
- 4 GB RAM available (8 GB recommended)
- 1 GB available disk space (50 GB recommended)
- 64-bit version of Ubuntu / Debian
Install Metasploit Framework on Ubuntu / Debian
The easiest way of installing Metasploit Framework on Ubuntu / Debian 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..Updating package cache..OK
Checking for and installing update..
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
metasploit-framework
0 upgraded, 1 newly installed, 0 to remove and 39 not upgraded.
Need to get 374 MB of archives.
After this operation, 836 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 6.4.4+20240415102543~1rapid7-1 [374 MB]
Fetched 374 MB in 5s (72.4 MB/s)
Selecting previously unselected package metasploit-framework.
(Reading database ... 39618 files and directories currently installed.)
Preparing to unpack .../metasploit-framework_6.4.4+20240415102543~1rapid7-1_amd64.deb ...
Unpacking metasploit-framework (6.4.4+20240415102543~1rapid7-1) ...
Setting up metasploit-framework (6.4.4+20240415102543~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
Scanning processes...
Scanning linux images...
Create and initialize the msf database.
$ msfdb init
Clearing http web data service credentials in msfconsole
Running the 'init' command for the database:
Creating database at /home/devops/.msf4/db
Creating db socket file at /tmp
Starting database at /home/devops/.msf4/db...success
Creating database users
Writing client authentication configuration file /home/devops/.msf4/db/pg_hba.conf
Stopping database at /home/devops/.msf4/db
Starting database at /home/devops/.msf4/db...success
Creating initial database schema
Database initialization successful
Launch msfconsole
msfconsole
Sample output:
Metasploit tip: Use the edit command to open the currently active module
in your editor
______________________________________________________________________________
| |
| METASPLOIT CYBER MISSILE COMMAND V5 |
|______________________________________________________________________________|
\ / /
\ . / / x
\ / /
\ / + /
\ + / /
* / /
/ . /
X / / X
/ ###
/ # % #
/ ###
. /
. / . * .
/
*
+ *
^
#### __ __ __ ####### __ __ __ ####
#### / \ / \ / \ ########### / \ / \ / \ ####
################################################################################
################################################################################
# WAVE 5 ######## SCORE 31337 ################################## HIGH FFFFFFFF #
################################################################################
https://metasploit.com
=[ metasploit v6.4.4-dev- ]
+ -- --=[ 2410 exploits - 1242 auxiliary - 423 post ]
+ -- --=[ 1465 payloads - 47 encoders - 11 nops ]
+ -- --=[ 9 evasion ]
Metasploit Documentation: https://docs.metasploit.com/
msf6 >
Verify database connectivity with the db_status
command as shown below.
msf > db_status
[*] Connected to msf. Connection type: postgresql.
msf >
Updating Metasploit Framework
To update your Metasploit Framework on Ubuntu / Debian. 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 (6.4.4+20240415102543~1rapid7-1).
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
You can check your Framework version using:
# msfconsole --version
Framework Version: 6.4.4-dev-
Cheers!. You now have Metasploit Framework installed on Ubuntu / Debian system.
Security books to read: