lost and found ( for me ? )

install metasploit on Ubuntu 14.04

Here are trial and error logs when installing metasploit on Ubuntu 14.04.

Reference
http://www.darkoperator.com/installing-metasploit-in-ubunt/

install required packages to run metasploit.
# 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

install ruby 2.1.6
# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3


# curl -L https://get.rvm.io | bash -s stable

 * First you need to add all users that will be using rvm to 'rvm' group,
   and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.

 * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
   in all your open shell windows, in rare cases you need to reopen all shell windows.


# source /etc/profile.d/rvm.sh

install ruby 2.1.6. nn error..
# rvm install 2.1.6
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/14.04/x86_64/ruby-2.1.6.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..............
Error running 'requirements_debian_update_system ruby-2.1.6',
showing last 15 lines of /usr/local/rvm/log/1432608365_ruby-2.1.6/update_system.log
++ case "${TERM:-dumb}" in
++ case "$1" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'There has been error while updating '\''apt-get'\'', please give it some time and try again later.
404 errors should be fixed for rvm to proceed. Check your sources configured in:
   /etc/apt/sources.list
   /etc/apt/sources.list.d/*.list
\n'
There has been error while updating 'apt-get', please give it some time and try again later.
404 errors should be fixed for rvm to proceed. Check your sources configured in:
   /etc/apt/sources.list
   /etc/apt/sources.list.d/*.list

++ return 100
Requirements installation failed with status: 100.

Googling this error, this seems to be caused if there are failed links in apt repositories.

check failed links
# apt-get update  | grep –i failed
W: Failed to fetch http://ppa.launchpad.net/cjwatson/devirt/ubuntu/dists/vivid/main/source/Sources  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/cjwatson/devirt/ubuntu/dists/vivid/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/cjwatson/devirt/ubuntu/dists/vivid/main/binary-i386/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

disable those repositories.
I disabled those by editing /etc/apt/sources.list

install ruby again.
# rvm install 2.1.6

# rvm use 2.1.6 --default
Using /usr/local/rvm/gems/ruby-2.1.6

# ruby -v
ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux]

install nmap
# apt-get install -y nmap

configure postgreSQL

configure credentials for user ‘postgres’
# passwd postgresql

create a user and a table which are used for metasploit.
# sudo -s
# su postgres
$ createuser msf -P -S -R –D
$ createdb -O msf msf

install metasploit
# cd /opt/
# git clone https://github.com/rapid7/metasploit-framework.git

# cd metasploit-framework/
ruby-2.1.6 - #gemset created /usr/local/rvm/gems/ruby-2.1.6@metasploit-framework
ruby-2.1.6 - #generating metasploit-framework wrappers..........

# rvm --default use ruby-2.1.6@metasploit-framework
Using /usr/local/rvm/gems/ruby-2.1.6 with gemset metasploit-framework


# gem install bundler

# bundle install

configure metasploit so that any users can use metasploit.
# pwd
/opt/metasploit-framework

# bash -c 'for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF  /usr/local/bin/$MSF;done'

DB settings so that metasploit can connect to PostgreSQL.
# vi /opt/metasploit-framework/config/database.yml

# cat /opt/metasploit-framework/config/database.yml
production:
adapter: postgresql
database: msf
username: msf
password:passowrd
host: 127.0.0.1
port: 5432
pool: 75
timeout: 5

# sh -c "echo export MSF_DATABASE_CONFIG=/opt/metasploit-framework/config/database.yml >> /etc/profile"

# source /etc/profile

run msfconsole
# ./msfconsole
[*] Starting the Metasploit Framework console...\
# cowsay++
____________
< metasploit >
------------
      \   ,__,
       \  (oo)____
          (__)    )\
             ||--|| *


      =[ metasploit v4.11.0-dev [core:4.11.0.pre.dev api:1.0.0]]
+ -- --=[ 1456 exploits - 833 auxiliary - 229 post        ]
+ -- --=[ 382 payloads - 37 encoders - 8 nops             ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

msf >

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.