Problems Installing Metasploit Framework on Ubuntu

Praveen Kumar picture Praveen Kumar · May 15, 2015 · Viewed 8.4k times · Source

I have encountered 3 problems while following this guide to installing Metasploit Framework on Ubuntu and Debian:

1) After installing proper version of ruby, there is a command given for installing Ruby libraries: sudo gem install bundler. When I typed that in and hit enter, it says "command not found". After some researching on the internet, I decided to remove sudo and try again. So I've entered gem install bundler and it worked fine. Will this cause any problems?

2) After installing Metasploit Framework, there is a command given to install the required gems and versions:

cd metasploit-framework
bundle install

But when I tried that, I got this error:

rbenv: version '2.1.6' is not installed

I really don't know what to do next (But I moved on).

3) Probably due to the previous problems, in the end when I executed msfconsole command, it said

could not find rake-10.4.2 in any of the sources.

run bundle install to install the missing gems

But the bundle install doesn't help either, because when I run that it says

Could not locate Gemfile or .bundle/directory

Any help would be appreciated.

EDIT: When I asked the person himself who had written the guide, regarding this, he told me to select the version of ruby I had just installed with either rebind or RVM before installing bundler, and then to run the bundle install. Could you please list the commands to do so? I am really new to Linux!

Answer

Mr.Geek picture Mr.Geek · Jun 9, 2015

step 1 :

sudo apt-get update
sudo apt-get upgrade

step 2 :

Install dependent packages

sudo apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev openjdk-7-jre git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev curl zlib1g-dev

step 3 :

Install Ruby

curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
source ~/.bashrc
rvm install 2.1.6
rvm use 2.1.6 --default
ruby -v

step 4 :

Install and configure postgresql

sudo apt-get install postgresql

sudo -s
su postgres

createuser msf -P -S -R -D
createdb -O msf msf
exit

Step 5 :

Install Metasploit Framework

cd /opt
sudo git clone https://github.com/rapid7/metasploit-framework.git
sudo chown -R `whoami` /opt/metasploit-framework
cd metasploit-framework
cd metasploit-framework
sudo bash -c 'for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done'

Still if you are facing any issue, you can download the iso or vm image from kali wesbite