Installation on Ubuntu Linux¶
The Metasploit Framework is well-supported on the Ubuntu platform. The following instructions should also apply to Kubuntu, Xubuntu, and Debian.
If these instructions do not work for your version of Ubuntu, please try the Generic Linux instructions instead.
Dependencies¶
Install the Ruby dependencies:
$ sudo apt-get install ruby libopenssl-ruby libyaml-ruby libdl-ruby libiconv-ruby libreadline-ruby irb ri rubygems
Install the Subversion client:
$ sudo apt-get install subversion
In order to build the native extensions (pcaprub, lorcon2, etc), the following packages need to be installed:
$ sudo apt-get build-dep ruby $ sudo apt-get install ruby-dev libpcap-dev
Database support¶
In order to use the database functionality, RubyGems along with the appropriate drivers must be installed:
Postgres is the recommended database:
$ sudo apt-get install postgresql-8.4 $ sudo apt-get install rubygems libpq-dev $ sudo gem install pg
Or for MySQL:
$ sudo apt-get install mysql-server $ sudo apt-get install rubygems libmysqlclient-dev $ sudo gem install mysql
Sqlite will work for basic tasks, but is no longer supported!
$ sudo apt-get install sqlite3 $ sudo apt-get install rubygems libsqlite3-dev $ sudo gem install sqlite3-ruby
See database configuration instructions (below) when you've completed installation.
Framework¶
Once the dependencies have been installed, download the Unix tarball from the download page and run the following commands:
$ tar xf framework-3.X.tar.gz $ sudo mkdir -p /opt/metasploit3 $ sudo cp -a msf3/ /opt/metasploit3/msf3 $ sudo chown root:root -R /opt/metasploit3/msf3 $ sudo ln -sf /opt/metasploit3/msf3/msf* /usr/local/bin/
Extensions¶
The framework includes a few native Ruby extensions that must be compiled in order to use certain types of modules.
To enable raw socket modules:
$ sudo apt-get install libpcap-dev $ sudo bash # cd /opt/metasploit3/msf3/external/pcaprub/ # ruby extconf.rb # make && make install
To enable WiFi modules:
$ sudo bash # cd /opt/metasploit3/msf3/external/ruby-lorcon2/ # svn co https://802.11ninja.net/svn/lorcon/trunk lorcon2 # cd lorcon2 # ./configure --prefix=/usr && make && make install # cd .. # ruby extconf.rb # make && make install
Updates¶
The Metasploit Framework is updated daily with the latest exploits, payloads, features, and bug fixes. To update your installation of the framework:
$ sudo svn update /opt/metasploit3/msf3/
This can also be installed into the root user's crontab:
$ sudo crontab -e -u root # enter the line below 1 * * * * /usr/bin/svn update /opt/metasploit3/msf3/ >> /var/log/msfupdate.log 2>&1
Database Configuration¶
Now that the framework is installed, you'll want to configure a database connection, and enable the framework to connect to it:- For postgres, see postgres_setup (recommended)
- For mysql, see mysql_setup
- For sqlite, see sqlite_setup (not supported!!).