How to Install Metasploit Framework on Ubuntu 18.04 | 16.04

This brief tutorial shows students and new users how to install Metasploit Framework on Ubuntu 18.04 | 16.04.

Metasploit is probably the world’s most used open source penetration testing tool available today. This project is a collaboration between the open source community and Rapid7, and allow security teams find vulnerabilities, manage security assessments, and improve security awareness and more.

If you’re looking for an open source vulnerability testing tool for your business or projects, then you might want to take a look at Metasploit Framework.

For more about Metasploit, please visit its homepage.

If you’re a student or new user looking for a Linux system to learn on, the easiest place to start is Ubuntu Linux OS. It’s a great Linux operating system for beginners.

Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other device.

While learning Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.

To get started with Metasploit Framework on Ubuntu, follow the steps below:

Step 1: Update Ubuntu

Before installing packages on Ubuntu, it’s recommended to first update the system. To to that, run the commands below:

sudo apt update
sudo apt dist-upgrade
sudo apt autoremove

Step 2: Install Metasploit Framework

Now that Ubuntu is updated, you can now continue to installing Metasploit.

The easiest way to get the Metasploit Framework is to download the installer from the Rapid7 site. Using the installer, all the necessary dependencies are installed and configured for you during the installation process.

To get the installer, run the commands below:

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

After downloading the installer, simply run the commands below to make it executable, then install it.

chmod +x msfinstall
sudo ./msfinstall

The prompt asks you if you want to use and set up a new database. Type y or yes to run the initial configuration script to create the initial database.

To check to see if the database was set up, run the following command:

db_status

If the Metasploit Framework successfully connected to the database, the following status displays:

Output:
[*] postgresql connected to msf

If you did not opt to create a database when msfconsole loaded for the first time, you can use the msfdb script to configure postgresql to run as your local user and store the database in ~/.msf4/db/.

To enable and start using the local database, run the commands below:

msfdb init

After successfully installing, you will end up with a message similar to the one below:

Creating database users
Writing client authentication configuration file /home/richard/.msf4/db/pg_hba.conf
Stopping database at /home/richard/.msf4/db
Starting database at /home/richard/.msf4/db...success
Creating initial database schema
[?] Initial MSF web service account username? [richard]: 
[?] Initial MSF web service account password? (Leave blank for random password): 
Generating SSL key and certificate for MSF web service
Attempting to start MSF web service...success
MSF web service started and online
Creating MSF web service user richard

    ############################################################
    ##              MSF Web Service Credentials               ##
    ##                                                        ##
    ##        Please store these credentials securely.        ##
    ##    You will need them to connect to the webservice.    ##
    ############################################################

MSF web service username: richard
MSF web service password: user_password_here
MSF web service user API token: 551f065fee5e690113b004354f7ccea274491ab7598ef26ec0253c8f8706fde4c634b04404863857

MSF web service configuration complete
The web service has been configured as your default data service in msfconsole with the name "local-https-data-service"

If needed, manually reconnect to the data service in msfconsole using the command:
db_connect --token 551f065fee5e690113b004354f7ccea274491ab7598ef26ec0253c8f8706fde4c634b04404863857 --cert /home/richard/.msf4/msf-ws-cert.pem --skip-verify https://localhost:5443

The username and password are credentials for the API account:
https://localhost:5443/api/v1/auth/account

Now that database is initialized run the commands below to configure Metasploit.

msfconsole

After running that, you should get a screen similar to the one below:

                                                  
               .;lxO0KXXXK0Oxl:.
           ,o0WMMMMMMMMMMMMMMMMMMKd,
        'xNMMMMMMMMMMMMMMMMMMMMMMMMMWx,
      :KMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMK:
    .KMMMMMMMMMMMMMMMWNNNWMMMMMMMMMMMMMMMX,
   lWMMMMMMMMMMMXd:..     ..;dKMMMMMMMMMMMMo
  xMMMMMMMMMMWd.               .oNMMMMMMMMMMk
 oMMMMMMMMMMx.                    dMMMMMMMMMMx
.WMMMMMMMMM:                       :MMMMMMMMMM,
xMMMMMMMMMo                         lMMMMMMMMMO
NMMMMMMMMW                    ,cccccoMMMMMMMMMWlccccc;
MMMMMMMMMX                     ;KMMMMMMMMMMMMMMMMMMX:
NMMMMMMMMW.                      ;KMMMMMMMMMMMMMMX:
xMMMMMMMMMd                        ,0MMMMMMMMMMK;
.WMMMMMMMMMc                         'OMMMMMM0,
 lMMMMMMMMMMk.                         .kMMO'
  dMMMMMMMMMMWd'                         ..
   cWMMMMMMMMMMMNxc'.                ##########
    .0MMMMMMMMMMMMMMMMWc            #+#    #+#
      ;0MMMMMMMMMMMMMMMo.          +:+
        .dNMMMMMMMMMMMMo          +#++:++#+
           'oOWMMMMMMMMo                +:+
               .,cdkO0K;        :+:    :+:                                
                                :::::::+:
                      Metasploit

       =[ metasploit v5.0.82-dev-                         ]
+ -- --=[ 1988 exploits - 1089 auxiliary - 339 post       ]
+ -- --=[ 559 payloads - 45 encoders - 10 nops            ]
+ -- --=[ 7 evasion                                       ]

Metasploit tip: Use the edit command to open the currently active module in your editor

msf5 > 

To update your Metasploit run the commands below:

sudo msfupdate

To check the version installed, simply run the commands below:

msfconsole --version

The command should output similar line as shown below:

Framework Version: 5.0.82-dev-

That’s it!

Metasploit Ubuntu Install

Conclusion:

This post showed you how to install Metasploit Framework on Ubuntu 18.04 | 16.04. If you find any error above, please use the comment form below to report it.

Thanks,

You may also like the post below:

One thought on “How to Install Metasploit Framework on Ubuntu 18.04 | 16.04

  1. After installing msfconsole , i am nable to run msfvenum command. it shows “command unknown : msfvenum”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.