Fixing errors while installing Metasploit Framework on Ubuntu

I followed the excellent instructions by darkoperator to install the Metasploit Framework on Ubuntu. However, I had a tiny hiccup when it came to doing the bundle install. (The bundle install step is in the section marked Installing Metasploit Framework in the instructions guide).

I got the following error:

Errno::EACCES: Permission denied @ rb_sysopen - metasploit-framework-4.11.0.pre.dev.gem
An error occurred while installing metasploit-framework (4.11.0.pre.dev), and
Bundler cannot continue.
Make sure that `gem install metasploit-framework -v '4.11.0.pre.dev'` succeeds
before bundling.

The solution is quite simple,

$ rvmsudo bundle install

Now, onto hiccup number 2. Although we created the symlinks, they don’t work.

$ msfconsole
Could not find rake-10.4.2 in any of the sources
Run `bundle install` to install missing gems.

Did we cause this by using rvmsudo ? Quite frankly, I dunno! I’m ruby-ignorant! But then, it was mentioned in the guide that symlinking could be problematic, so, fair enough.

We need to switch to the metasploit-framework directory in order to run each of the commands.

$ cd /opt/metasploit-framework/
$ msfconsole
[*] Starting the Metasploit Framework console... 

And YAY!!! We have MSF working on our Ubuntu machine!!!

How do we make this work for us? By aliasing the commands, of course! But first, we need to remove the goofy links,

$ sudo rm /usr/local/bin/msf*

$ cd /opt/metasploit-framework
$ bash -c 'for MSF in $(ls msf*); do echo alias $MSF="cd /opt/metasploit-framework && $MSF" >> ~/.bash_aliases;done'

And that’s it! Everything’s back to normal in Ubuntu-land once again!


Share on