How to Install and use Metasploit on Ubuntu 20.04

How to Install and use Metasploit on Ubuntu 20.04

The Metasploit Framework is an open-source project that provides public resources for vulnerability research and code development that allows security professionals to detect intrusions into their network and identify threats and vulnerabilities. It is important to be careful when using Metasploit, as scanning a network or environment that is not for you may be illegal in some cases. In this article, we are going to teach you How to Install and use Metasploit on Ubuntu 20.04. It should note that you can visit the packages available in Eldernode if you wish to purchase an Ubuntu VPS server.

Tutorial Install and use Metasploit on Ubuntu 20.04

Metasploit is an open-source framework written specifically for hackers, security researchers, and other network security activists. You can use this framework to exploit vulnerabilities in various systems, networks, and software. This framework has many exploits by default, but in addition, you can create your own exploit and add to it.

In the next section, we will teach you how to install Metasploit on Ubuntu 20.04. Please join us.

Recommended Article: How to install VNC on Debian 10

Module types in Metasploit

1- Payload: This module is using to perform operations such as connecting to the target system or performing tasks such as installing a service, etc. The next step after using a system is to run Payload. The most famous is Payload Metasploit Meterpreter.

2- Auxiliary: Auxiliary modules are a special type of modules that perform specific tasks. Tasks such as data collection, database fingerprinting, network scanning to find a specific service, and census are common functions of Auxiliary modules.

3- Encoder: Encoders are using to encrypt payloads and attack vectors to prevent detection by antivirus and firewalls.

4- NOPS: They stabilize the performance of Payloads.

5- Exploit: This is a piece of code that is using to run on the victim system and exploit vulnerabilities.

Install Metasploit on Ubuntu 20.04 | Ubuntu 18.04

In this section, we want to discuss how to install Metasploit on Ubuntu 20.04. Given that Metasploit is made in ruby so there are a number of dependencies that are required. You must first install the required dependencies using the following command:

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

Note: Installing dependencies may take a few minutes.

The second step is to install Metasploit using the following commands in your home directory in apps:

mkdir ~/apps
cd ~/apps

Next, you need to use the following command to clone the repo to make it easier to grab updates should msfupdate ever fail:

git clone

After you have successfully completed the above steps, you can finally install Metasploit using the following commands:

cd metasploit-framework/
sudo gem install bundler
bundle install

How to use Metasploit on Ubuntu 20.04

After successfully installing Metasploit, 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 displayed as shown below.


msfconsole on ubuntu 20.04


The next step is to configure the system for updates. You can set some GIT variables for this. To do this, you must first set your name using the following command:

git config --global "NAME HERE"

You must also Setup your email using the following command:

git config --global "[email protected]"

Now you should run updates from within the Metasploit-framework directory using the following command:

. /msfupdate

Note that the last thing you need to do is set the update to Cron, so you do not need to run msfupdate constantly:

crontab -e

In the final step you have to add the following line using your favorite editor:

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

Note: In the above command you have to replace the $ name with your username.

Recommended Article: Common Apache Errors Troubleshooting


Metasploit is a very powerful framework with many features. This tool was created as a result of the efforts of the Rapid7 community. With Metasploit, you can perform pre-identified attacks such as password-free victim logging, webcam hacking, web server hacking, email server hacking, and more. Under this framework, you can generate your exploits and use them privately. In this article, we tried to teach you how to Install and use Metasploit on Ubuntu 20.04.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave Your Comment

Your email address will not be published.

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way


7 days a week, 24 hours a day