Skip to content

Instantly share code, notes, and snippets.

@dafthack
Created April 11, 2017 14:50
Show Gist options
  • Save dafthack/8aa4ff60cd9352448a372ce1a7b2e27e to your computer and use it in GitHub Desktop.
Save dafthack/8aa4ff60cd9352448a372ce1a7b2e27e to your computer and use it in GitHub Desktop.
Easy Metasploit Install on Windows Subsystem for Linux
Steps to install Metasploit on Windows 10 using the Windows Subsystem for Linux
1.) Enable Developer Mode
C:\> reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
2.) Enable Windows Subsystem for Linux
C:\> DISM /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux
3.) Reboot
4.) Type "bash" at cmd line to get into Windows Subsystem for Linux and create a new password for your user.
5.) Install Metasploit
test@Desktop:/mnt/c$ curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && chmod 755 msfinstall && ./msfinstall
@JonnyBanana
Copy link

to me on one of the many machines it gave me problems with the classic sudo apt-get install metasploit-framework (I don't know why, since on other machines it worked very well, as always), anyway with this script the installation was successful, thanks

@ctkqiang
Copy link

I got this :---

[-] * WARNING: No database support: No database YAML file
[-] ***
Traceback (most recent call last):ork console...-
        25: from /opt/metasploit-framework/bin/../embedded/framework/msfconsole:17:in `<main>'
        24: from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/base.rb:82:in `start'
        23: from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:48:in `start'
        22: from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:62:in `driver'
        21: from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:62:in `new'
        20: from /opt/metasploit-framework/embedded/framework/lib/msf/ui/console/driver.rb:161:in `initialize'
        19: from /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/framework/module_paths.rb:49:in `init_module_paths'
        18: from /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/framework/module_paths.rb:49:in `each'
        17: from /opt/metasploit-framework/embedded/framework/lib/msf/base/simple/framework/module_paths.rb:50:in `block in init_module_paths'
        16: from /opt/metasploit-framework/embedded/framework/lib/msf/core/module_manager/module_paths.rb:40:in `add_module_path'
        15: from /opt/metasploit-framework/embedded/framework/lib/msf/core/module_manager/module_paths.rb:40:in `each'
        14: from /opt/metasploit-framework/embedded/framework/lib/msf/core/module_manager/module_paths.rb:41:in `block in add_module_path'
        13: from /opt/metasploit-framework/embedded/framework/lib/msf/core/module_manager/loading.rb:133:in `load_modules'
        12: from /opt/metasploit-framework/embedded/framework/lib/msf/core/module_manager/loading.rb:133:in `each'
        11: from /opt/metasploit-framework/embedded/framework/lib/msf/core/module_manager/loading.rb:135:in `block in load_modules'
        10: from /opt/metasploit-framework/embedded/framework/lib/msf/core/modules/loader/base.rb:256:in `load_modules'
         9: from /opt/metasploit-framework/embedded/framework/lib/msf/core/modules/loader/base.rb:256:in `each'
         8: from /opt/metasploit-framework/embedded/framework/lib/msf/core/modules/loader/base.rb:259:in `block in load_modules'
         7: from /opt/metasploit-framework/embedded/framework/lib/msf/core/payload_set.rb:109:in `recalculate'
         6: from /opt/metasploit-framework/embedded/framework/lib/msf/core/payload_set.rb:109:in `each_pair'
         5: from /opt/metasploit-framework/embedded/framework/lib/msf/core/payload_set.rb:122:in `block in recalculate'
         4: from /opt/metasploit-framework/embedded/framework/lib/msf/core/payload_set.rb:122:in `each_pair'
         3: from /opt/metasploit-framework/embedded/framework/lib/msf/core/payload_set.rb:186:in `block (2 levels) in recalculate'
         2: from /opt/metasploit-framework/embedded/framework/lib/msf/core/payload.rb:212:in `size'
         1: from /opt/metasploit-framework/embedded/framework/lib/msf/core/payload/android.rb:38:in `generate'
/opt/metasploit-framework/embedded/framework/lib/msf/core/payload/android.rb:117:in `generate_jar': android/apk/classes.dex not found (RuntimeError)

@DasReyxr
Copy link

I got this error
`orlas0ne@0rlasOne:/mnt/c/Users/Orlando$ sudo apt-get install metasploit-framework
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
metasploit-framework : Depends: oracle-instantclient-basic (>= 19.6.0.0.0) but it is not installable
E: Unable to correct problems, you have held broken packages.`

@risteFront
Copy link

Try first sudo apt-get update , it works for me :)

@risteFront
Copy link

I got this error
`orlas0ne@0rlasOne:/mnt/c/Users/Orlando$ sudo apt-get install metasploit-framework
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
metasploit-framework : Depends: oracle-instantclient-basic (>= 19.6.0.0.0) but it is not installable
E: Unable to correct problems, you have held broken packages.`

Try first sudo apt-get update , it works for me :)

@DasReyxr
Copy link

DasReyxr commented Jun 26, 2020

i try it but throw me this error

orlas0ne@0rlasOne:/mnt/c/Users/Orlando$ sudo apt-get update
Get:2 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease [3,956 B]
Hit:1 http://kali.download/kali kali-rolling InRelease
Err:2 http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY CDFB5FA52007B954
Reading package lists... Done
W: GPG error: http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY CDFB5FA52007B954
E: The repository 'http://downloads.metasploit.com/data/releases/metasploit-framework/apt lucid InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

@DasReyxr
Copy link

forget about it, i solved

@Yunagiri
Copy link

forget about it, i solved

Please tell how did you fix it so others having the same problem can fix it too ...............

@risteFront
Copy link

forget about it, i solved

Please tell how did you fix it so others having the same problem can fix it too ...............

You can install manually this frameworks if you are on Windows from official page metasploit-framework in .exe fromat, and add to your dependency

@josh-boat365
Copy link

upon all the information above, i am still getting errors nothing is working

@siddhartha7055
Copy link

I'm also getting same error?

@galatgovardhan
Copy link

error

@galatgovardhan
Copy link

error
need help

@harezzerah
Copy link

try to install wsl ubuntu first, it will runnning msfconsole smooth

@risteFront
Copy link

error
need help
First need to enable Linux sub system in control panel in windows visit YouTube video for that.

@ijuststarteddontjudge
Copy link

sudo apt-get install metasploit-framework Did the job
it worked but said dkpg file or something wasnt working and now it just cant find the metasploit-frameworks at all

@imessenger98
Copy link

what about this command
sudo apt-get install metasploit-framework

thanks

@killshot13
Copy link

If you go root, you can circumvent the sudo glitches.

WARNING: ROOT IS DANGEROUS IF YOU DON'T KNOW HOW POWERFUL IT IS.
(All disclaimers flapping in the breeze, including Your Mileage Might Vary.)

First set a root password with sudo passwd root,
You will be asked to enter sudo's password and then create and confirm a new password for root.

From now on to login as root, you can just su -.

And finally, to address the metasploit install issues, you will realize you no longer need sudo.

Just run this command and watch the magic unfold!

apt-get install metasploit-framework postgresql

😎

Copy link

ghost commented May 7, 2021

Try first sudo apt-get update , it works for me :)

All of you please consider this before using apt-get install metasploit-framework
This will definitely work?

Copy link

ghost commented May 7, 2021

Oh yep. It will

@NANDUANIL00
Copy link

I phase the same issue

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install metasploit-framework

these 3 commands help me to solve this problem

Copy link

ghost commented Nov 13, 2021

Yah

I phase the same issue

sudo apt-get update sudo apt-get upgrade sudo apt-get install metasploit-framework

these 3 commands help me to solve this problem

Yah! It solves installation

@Jkudjo
Copy link

Jkudjo commented Nov 13, 2021

how does one run the ".run" in the WSL2.

@Jkudjo
Copy link

Jkudjo commented Nov 13, 2021

how does one run the ".run" in the WSL2.

OOh i just did it

#chmod +x metasploit-latest-linux-x64-installer.run

./metasploit-latest-linux-x64-installer.run

The above did the magic.

@rmdhfz
Copy link

rmdhfz commented Nov 26, 2021

I phase the same issue

sudo apt-get update sudo apt-get upgrade sudo apt-get install metasploit-framework

these 3 commands help me to solve this problem

Nice, thank you

@Deltwin
Copy link

Deltwin commented Dec 17, 2021

Doesn't work for me

  1. Sudo apt update && apt upgrade
  2. sudo apt install metasploit-framework

Error:
Unable to locate package metasploit-framework

@Jkudjo
Copy link

Jkudjo commented Dec 18, 2021

@Deltwin

try this
sudo apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev libyaml-dev curl zlib1g-dev gawk bison libffi-dev libgdbm-dev libncurses5-dev libtool sqlite3 libgmp-dev gnupg2 dirmngr

@reidsneo
Copy link

on ubuntu also you need to run
sudo gem install bundler

@Tribhuwan-Joshi
Copy link

Tribhuwan-Joshi commented Dec 24, 2021

Above all of these commands nothing is working for me

@dolphin-cat
Copy link

use ubuntu instead, kali has some weird issues with apt on wsl2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment