Share this blog

How to install Metasploit Framework on Ubuntu?

Many students are trying to learn ethical hacking by self-study. The Metasploit framework is one of the best tools for hacking different platforms. Students are using Ubuntu OS on personal computers and also in the computer lab. We can install metasploit framework on Ubuntu. To install Metasploit on Ubuntu, follow these step-by-step instructions: Note: You are making a changes on system, so you need to log in to root user or use “sudo su” for switch to the root user or you need to use sudo command before entering command in most of the case

Step 1: Update the Repository

Before installing the Metasploit framework, update the repository.

sudo apt update

How to install Metasploit Framework on Ubuntu

 

Step 2: Install Required Dependencies

Metasploit requires certain dependencies like curl, wget, and postgresql. Install them using:

sudo apt install curl wget postgresql -y

How to install Metasploit Framework on Ubuntu

 

Step 3: Download and Install Metasploit

Run the following command to download the latest Metasploit installer from Rapid7:

curl https://raw.githubusercontent.com/rapid7/metasploit-framework/master/msfinstall
> msfinstall

How to install Metasploit Framework on Ubuntu

Give execution permissions to the script and run the script to install Metasploit:

chmod +x msfinstall
./msfinstall

How to install Metasploit Framework on Ubuntu

 

Step 4: Start and Initialize the Database

Metasploit uses PostgreSQL as its database. Start and initialize it with:

sudo systemctl start postgresql
sudo msfdb init

How to install Metasploit Framework on Ubuntu

 

To ensure PostgreSQL starts automatically on system boot, enable it using:

sudo systemctl enable postgresql

How to install Metasploit Framework on Ubuntu

 

Step 5: Verify the Installation

To check if Metasploit is installed correctly, launch it using:

msfconsole

How to install Metasploit Framework on Ubuntu

 

If the Metasploit Framework console opens with the Metasploit banner, the installation was successful.

If it’s outdated then update it using

msfupdate

How to install Metasploit Framework on Ubuntu

Inside Metasploit, verify the database connection using:

db_status

How to install Metasploit Framework on Ubuntu

If it says “Connected to PostgreSQL database”, you’re all set!

Now, Metasploit is installed on your Ubuntu system and ready for penetration testing


For further reading on similar topics, check out article on : How to Configure Network Adapters in VirtualBox?