How to Install Metasploit on Windows and Linux | [Step by Step Guide]

profile kanav

This is a blog, that will show you the step by step installation of the Metasploit framework in both Windows and Linux operating system. I have also created and shared a video on the installation of Virtual Box in Window.

Apart from installations this blog also contains how you can set up a Metasploitable machine so that you can perform practicals of the pen-test. If you are interested to know how to start your career in ethical hacking you can check my blog on How to Become an Ethical Hacker | Techofide

If you don't know what is Metasploit framework and how to use it, Metasploit tutorial, then you can check my blog on What is Metasploit Framework in which I have discussed Metasploit framework, its usage, commands, penetration testing and a practical demonstration of hacking.

You can also check other Cyber Security blogs related to tools in crackcodes

So let's get started with our Installations.

How to Install Metasploit in Ubuntu

Metasploit is a framework that is used for penetration testing, it offers various module exploits, payloads, auxiliary, post and programs that make work easier to access systems and found vulnerabilities for security professionals, testers, analyst and hackers.

It is open-source and free software. It is very easy to install Metasploit in your Linux system. If you are using Kali then you already know there are lots of tools present and this tool is also pre-installed on it, but if you are using any other Linux like Ubuntu, Redhat, CentOS, Mint etc. then you may follow the below-mentioned installation steps.

Note: The commands which will I showed you below are also applicable to other versions of  Linux operating systems

Step 1: First we need to do basic things like update and upgrade our system with the below-given cmds (commands).

sudo apt update
sudo apt upgrade

How to Install Metasploit in Ubuntu

Metasploit in Ubuntu

Now our system is updated and ready to install Metasploit Framework, but before that, we need to install some dependencies, libraries and other packages that are the basic requirements to run Metasploit on your system.

Step 2: Let's install important libraries, repositories and exchange signatures with git-core that are required. So just copy the below-mentioned cmd as it is to your terminal and execute it.

sudo apt-get install -y curl gpgv2 autoconf bison build-essential git-core

Installing Libararies

Step 3: After libraries, we need to install some important dependencies and utilities for Metasploit Framework. Just copy the same below cmd as it is to your terminal and execute it.

sudo apt install libapr1 libaprutil1 libcurl4-openssl-dev libgmp3-dev libpcap-dev libpq-dev libreadline-dev libsqlite3-dev libssl-dev libsvn1 libtool libxml2 libxml2-dev libxslt-dev

Installing Dependencies

Step 4:Now again we have to install some other utilities like database, openssl, and download some libraries like zlib1g, xsel etc. So just run the below cmd 

sudo apt install locate ncurses-dev openssl postgresql postgresql-contrib wget xsel zlib1g zlib1g-dev

Installing Utilities

Now we have installed all the ruby package utilities and repositories. Let's download and install Metasploit Framework.

Step 5:We will use the curl command to download our Metasploit directly from the official rapid7 Github repository. Just follow the below cmd, (curl is used to transfer files from remote computers and supports a lot of protocols, we will use it to download Metasploit Framework.)

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

Using Curl Command

Step 6: Now we have successfully downloaded, but before running we need to change the permission of msfinstall file to executable. So use changemode cmd to change the permissions. Follow the below-mentioned cmd.

sudo chmod 755 msfinstall

Changing permissions of file

Step 7: Now let's start Metasploit but first run the Postgresql database by following the below command.

sudo service postgresql start

Starting postgresql

After starting your database you can also check the status of that by replacing status with start on the above command.

Step 8: Now run the msfconsole command and enter the Metasploit Framework interface.

sudo msfconsole

msfconsole

Installing Metasploit on Windows 10

Installing Metasploit on Window is similar to other software installation that we do on Window i.e, you just need to run a setup and install by clicking on the Next button serval times

 Note: Installation steps are the same for other versions of Window like 7 and 8.

Step 1: To install Metasploit on Window is simple like other Softwares. So first download it by clicking on Download Metasploit Framework for Window

Step 2: Now after downloading just go to your Downloads directory and double click on downloaded installer "metasploit-lates-windows-x64-installer" to start the installation process.

Installing Metasploit on Windows 10

 Step 3: Now just click on Next to proceed with the installation.

Installing Metasploit

Step 4: Now it will ask you to accept the license. So just accept it by clicking on "I accept the agreement" and proceed by clicking on Next

Accepting Metasploit Agreemnet

Step 5: In this step, you have to choose the path where you want to install Metasploit. In the below image I am going with the default location you can choose any other if you want and just proceed with the installation by clicking on the Next

Setting path for Metasploit Framework

Step 6: Now it's showing a warning that you need to disable the firewall and Anti-Virus before proceeding next step. So just disable both and then proceed with Next (Don't worry after installation you can again enable that again)

Disabling Antiv-Virus

Step 7: Now you need to choose a port where your application will work. I suggest you for now just go with the default port that is 3790 and click on Next to proceed.

Setting port for Metasploit

Step 8: Now you need to give your server address if you have otherwise you can proceed with the local so just type localhost to create a trusted hosts SSL certificate.

Enabling SSL Certificate

Step 9: Now we are done with our configuration and ready to install so just proceed with it by clicking on Next

Ready to install Metasploit Framework

Step 10: Here you need to wait for a time until the process completes.

Installing Metasploit

Step 11: We have successfully installed Metasploit Framework in our Window System. So just click on Finish to close the window

Metasploit Installed

Step 12: Now go to your Search Menu and search for Metasploit Console, then click on Open to launch the Metasploit Console.

Opening Metasploit Framework

Step 13: It will launch and take time for the first time to run but after a while, it will take you to the msfconsole. You can See the below image same on your screen where it showing banner, exploit, encoders, nops, msf etc.

Metasploit Framework

How to Install Virtual Box on Windows 10

Installing Virtual Box is easy, you can watch the below video to know how to install a Virtual Box on Window 10 and don't worry you can follow the same steps if you want to install it in your Window 7 or 8.

You can download the Virtual Box latest version by clicking on Download Virtual Box

How to Install Metasploitable 2

Metasploitable is a very helpful and useful machine when your goal is penetration testing. If you don't know what is Metasploitable machine and how to use it, then you can click on What is Metasploitable to know more about Metasploitable Machine and its usage.

So you can easily set up this machine by following the few steps that are below:

Step 1: First you need to download the Metasploitable machine file. So to download just click on Download Metasploitable. In this guide, I have installed my machine on Virtual Box.

Step 2: Launch your Virtual Box and click on the New button, check the image for reference.

How to Install Metasploitable 2

Step 3: You need to fill the below fields to start creating your Metasploitable machine.

  • Name: Enter any name you want to give to your machine
  • Machine Folder: Select the folder where you want to install your machine.
  • Type:  Here you have to choose Linux
  • Version: In this, you have to choose Other Linux (64bit) or (32bit)

Now just click on Next to proceed with your creation.

Metasploitable

Step 4: Here is the step where you will assign RAM for your Metasploitable machine. So just go with at least 1 GB of RAM i.e, 1024 MB

Metasploitable 2

Step 5: Let's select our downloaded Metasploit file to install that and create a Hard Disk space. See the below image for reference. Click on the directory icon to select your Metasploitable file.

Installing Metasploitable 2

Step 6: Now click on Add and browse your downloaded file

Attaching Metasploitable

Step 7: Here I am choosing the Metasploitable file. Make sure to choose the same file.

Step 8: Now just select Metasploitable.vmdk file and then click on Choose. After that, you will be back to Step 4 where you have to click on Create to continue (Check the image of Step 4 for more reference)

Chossing Metasploitable

Step 9: Now we are done with the set-up, but before starting our Metasploitable machine we just need to change one setting. So just click on the Settings icon (See picture for more reference)

Setting Metasploitable

Step 10: From "Settings" Just click on Network and then choose Bridged Adapter instead of NAT under "Attached to:" drop down menu, then click on OK to save the settings.

Network Setting for Metasploitable 2

Step 11: Now just click on "Start" to run your Metasploitable machine.

Starting Metasploitable 2

Step 12: Now as you can see our Metasploitable machine is booting up. So wait for few minutes it will take you to the console soon.

Booting Metasploitable 2

Step 13: Now we are in the Loing prompt where you have to enter your credentials before going inside your machine. So check the highlighted area of the below picture where you can see the default id and password.

ID: msfadmin

Password: msfadmin

Booting Metasploitable

Step 14: After entering credentials you can see the below picture we are in our Metasploitable machine.

Installed Metasploitable 2

I hope you like this blog, I have tried to cover all important installations for Metasploit and also tried to show you how you can install Metasploit on different platforms.

Eager to explore more about the Metasploit framework? Are you ready to know how to hack the system and other practical stuff? Just click on How to use Metasploit

Apart from this if you want to know which is the best Linux OS for you, then you can click on "How To Install Arch Linux 2021"

Related Blogs

Other Recommended Blogs

 

Subscribe Us

* indicates required