Learn how to – Install Metasploit Framework on Kali Linux 2022.x

Learn how to – Install Metasploit Framework on Kali Linux 2022.x.

How can to Start / Install Metasploit Framework on Kali Linux?. The Metasploit Framework is a tool created by Massachusetts-based security company Rapid7 to help security professionals perform penetration testing tasks and discover security vulnerabilities and IDS signature development. The Metasploit Framework provides the infrastructure, content, and tools to perform extensive security auditing and penetration testing.

Metasploit Framework Services

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

Metasploit Framework Requirements

These are the minimum hardware requirements for running Metasploit Framework on any Linux machine.

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

So let’s see how you’ll run Metasploit Framework on Kali Linux Desktop distribution.

Install Metasploit Framework on Kali Linux 2022.x

These are the steps that need to be taken in order to get Metasploit up and running with database support on Kali Linux.

Step 1: Start PostgreSQL database server

The PostgreSQL database is installed but not started on Kali Linux. Start the service using the following command.

sudo systemctl enable --now postgresql

Confirm that the service is started and set to run on boot.

$ systemctl status postgresql@*-main.service
● postgresql@14-main.service - PostgreSQL Cluster 14-main
     Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor preset: disabled)
    Drop-In: /usr/lib/systemd/system/postgresql@.service.d
     Active: active (running) since Wed 2022-02-16 07:43:23 EST; 1min 6s ago
    Process: 7146 ExecStartPre=/usr/share/kali-defaults/postgresql_reduce_shared_buffers 14/main (code=exited, status=0/SUCCESS)
    Process: 7150 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 14-main start (code=exited, status=0/SUCCESS)
   Main PID: 7160 (postgres)
      Tasks: 7 (limit: 9444)
     Memory: 26.7M
        CPU: 149ms
     CGroup: /system.slice/system-postgresql.slice/postgresql@14-main.service
             ├─7160 /usr/lib/postgresql/14/bin/postgres -D /var/lib/postgresql/14/main -c config_file=/etc/postgresql/14/main/postgresql.conf
             ├─7164 "postgres: 14/main: checkpointer "
             ├─7165 "postgres: 14/main: background writer "
             ├─7167 "postgres: 14/main: walwriter "
             ├─7169 "postgres: 14/main: autovacuum launcher "
             ├─7171 "postgres: 14/main: stats collector "
             └─7174 "postgres: 14/main: logical replication launcher "

Feb 16 07:43:21 kali systemd[1]: Starting PostgreSQL Cluster 14-main...
Feb 16 07:43:23 kali systemd[1]: Started PostgreSQL Cluster 14-main.

You can also verify that PostgreSQL is running by checking the output of ss -ant and making sure that port 5432 is listening.

$ sudo  ss -ant | grep 5432
LISTEN  0       244   *               
LISTEN  0       244                [::1]:5432              [::]:* 

Step 2: Initialise the Metasploit PostgreSQL Database on Kali Linux

Once the PostgreSQL database server is running, proceed to initialise the Metasploit PostgreSQL Database.

$ sudo msfdb init
[i] Database already started
[+] Creating database user 'msf'
[+] Creating databases 'msf'
[+] Creating databases 'msf_test'
[+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml'
[+] Creating initial database schema

This will create and initialize the msf database.

Step 3: Launch msfconsole on Kali Linux

We now have the PostgreSQL service up and running and the database initialized. The last step required is to launch msfconsole and verify database connectivity with the db_status command:

$ sudo msfconsole
                       -++SecKCoin++e.AMd`       `.-://///+hbove.913.ElsMNh+-    
                      -~/.ssh/id_rsa.Des-                  `htN01UserWroteMe!-  
                      :dopeAW.No<nano>o                     :is:TЯiKC.sudo-.A:  
                      :we're.all.alike'`                     The.PFYroy.No.D7:  
                      :PLACEDRINKHERE!:                      yxp_cmdshell.Ab0:    
                      :msf>exploit -j.                       :Ns.BOB&ALICEes7:    
                      :---srwxrwx:-.`                        `MS146.52.No.Per:    
                      :<script>.Ac816/                        sENbove3101.404:    
                      :NT_AUTHORITY.Do                        `T:/shSYSTEM-.N:    
                      :09.14.2011.raid                       /STFU|wall.No.Pr:    
                      :hevnsntSurb025N.                      dNVRGOING2GIVUUP:    
                      :#OUTHOUSE-  -s:                       /corykennedyData:    
                      :$nmap -oS                              SSo.6178306Ence:    
                      :Awsm.da:                            /shMTl#beats3o.No.:    
                      :Ring0:                             `dDestRoyREXKC3ta/M:    
                      :23d:                               sSETEC.ASTRONOMYist:    
                       /-                        /yo-    .ence.N:(){ :|: & };:    

       =[ metasploit v6.1.29-dev                          ]
+ -- --=[ 2198 exploits - 1164 auxiliary - 400 post       ]
+ -- --=[ 596 payloads - 45 encoders - 11 nops            ]
+ -- --=[ 9 evasion                                       ]
msf5 > 

Verify database connectivity.

msf5 > db_status
[*] Connected to msf. Connection type: postgresql.
msf6 > exit

Since Metasploit Framework is part of the Kali Linux operating system, it is updated via the apt package manager.

sudo apt update
sudo apt install metasploit-framework


  • How to install Metasploit Framework on Kali Linux
  • Running Metasploit Framework on Kali Linux
  • How to start Metasploit Framework on Kali Linux
  • Using Metasploit Framework on Kali Linux

Top Cyber Security Learning Video Courses:

For other Linux distributions, check:

Leave a Reply