How To Install Metasploit Framework On Ubuntu 20.04

In this article, you will learn how to install Metasploit Framework On Ubuntu 20.04.

Metasploit is an open-source framework. Its uses are to find vulnerabilities, threats, offensive security tests, and research. the motive behind this framework is to find the various loophole in machines, networks, and software.

And also Metasploit comes with many exploits. It helps to create your own exploits and add them.

Updating and Upgrading your Ubuntu Machine With Latest Version

In this section, we are going to install the update and also upgrade with the latest security and patches. So you may find the below commands useful for that.

Firstly, check for an update

sudo apt update

Secondly, upgrading the machine

sudo apt upgrade

If you like to read more about updates and upgrade Kali Linux then you can read here.

Installing Metasploit Framework on Ubuntu 20.04 | Ubuntu 18.04

In this section, we are going to talk about dependencies. As Metasploit Framework is based on Ruby. So we have to install some dependencies. And you can find the list below.

apt install -y build-essential zlib1g zlib1g-dev libpq-dev libpcap-dev libsqlite3-dev ruby ruby-dev

Now you can install Metasploit Framework using the below command in the home directory in apps

Firstly, create a directory in the home using the below mkdir command

mkdir apps

Secondly, change the directory using the below cd command

cd apps

And now, you can use the following command to clone the repository to make it easier to get updates should msfupdate ever fail.

git clone

Note: You may get errors, so make sure you have installed git. if not then you can use the below command to install git.

sudo apt install git -y

Now change the directory again

cd metasploit-framework/

And run the below command,

sudo gem install bundler

Now run the below command

bundle install

How to use Metasploit on Ubuntu 20.04

In this section, we are going to discuss the uses of the Metasploit Framework. it’s time to run Metasploit from the command line in the Metasploit-frame directory


If you have done everything correctly, the msf6 console will be shown. Also, you can see in the below picture.

Metasploit Framework On Ubuntu

Now you can configure the system for updates. So you can set the git variables for it. And you can achieve it by setting your name. For setting your name you can use the below command.

git config --global "Your Name Here"

Also, you have to set your email address. And you can use the below command to set that.

git config --global ""

And now you can run the updates From the Metasploit Framework directory. So you can use the below command.

. /msfupdate

If you want to auto-update then you can put it in Cron. So you can use the below command to achieve this result.

crontab -e

And you have to add the below line for Metasploit auto-update. You can use any editor that you want.

0 1 * * * /home/$name/apps/metasploit-framework/msfupdate > /dev/null 2>&1

Note: Change the $name with your user name.

In this tutorial, you learned to install the Metasploit Framework on Ubuntu 20.04 and 18.04. If you are facing any problems in installation then you can ask in the comment section.

Also, you can find below a list of useful articles.

| Metasploit Framework On Ubuntu | Metasploit Framework Installation On Ubuntu | Ethical Hacking Related Tools | Linux Ethical Hacking | Pentesting Tools | Kali Linux | How to install easily Metasploit Framework On Ubuntu | What is Metasploit Framework | Best Use of the Metasploit framework

Leave a Reply