Categories: TutorialsUbuntu

How to Install Metasploit Framework on Ubuntu 20.04

Penetration testing helps you to evaluate the security of your systems by simulating an attack from a malicious source. Metasploit Framework is a popular penetration testing platform that lets you find and exploit vulnerabilities in your systems. It is an open-source platform that provides a complete environment and set of tools which are required for penetration testing.

In today’s post, we will install Metasploit Framework on Ubuntu 20.04 LTS.

Prerequisites:

  • You should have sudo privileges on the system where you want to install and run the Metasploit framework.
  • Disable any antivirus program or firewall as they can cause interference during the installation and runtime of the Metasploit framework.

Installing
Sponsored
Metasploit Framework

To install Metasploit Framework on Ubuntu system, we will use the installer file provided by the Rapid7 site. This installer file contains all the necessary tools required for the running of Metasploit Framework. To install Metasploit Framework on Ubuntu OS, follow the steps below:

1. First, update your system repository index using the command below:

$ sudo apt update

Enter sudo password.

2. Now, we will download the Metasploit Framework installer on our Ubuntu machine. Move to the /tmp dir using the command below:

$ cd /tmp/

Then download the installer file for the Metasploit Framework using this command:

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

3. Make the installer file executable using the command below:

$ sudo chmod 755 msfinstall

4. Now, run the Metasploit Framework installer:

$ sudo ./msfinstall

This will start installing the Metasploit Framework package on your system.

After the installation is completed, start msfconsole using the command below:

$ sudo msfconsole

You will be asked if you want to setup a new database. Type yes and hit Enter.

Sponsored

Then it will ask if you would like to initiate the web service. Type yes and hit Enter. After that, it will create the database.

Then it will ask more information for the web service initiation. For web service account username, hit Enter to accept the default selected username or you can enter any other user account name. For web service account password, type any password or just hit Enter to set any random password.

It will then display web service credentials that can be used to connect to the Metasploit Framework web service.

Then in the end, you will see the following display.

To test the database connection, use the below command in the msf prompt:

$ db_status

If the database is connected, you will see the output similar to the below screenshot.

Remember, if you have not setup the database when running the msfconsole for the first time, you can setup it later using the command below:

$ msfdb init

That is all there is to it! In today’s post, we covered how to install Metasploit Framework on Ubuntu 20.04 LTS OS. Now you can start using Metasploit Framework to evaluate the security of your systems. For more information about the Metasploit framework, visit this documentation.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

4 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago