I see lots of people finding me with the search terms 'metasploit ubuntu', so I'll post here about getting Metasploit 3.0 working under Ubuntu - my machine is a 7.04 box, freshly installed and with few extra packages yet. First of all, no ruby yet, so
sudo apt-get install ruby
That was insufficient, however:
mpatters@pkdick:~/src/framework-3.0$ ./msfconsole ./lib/rex/socket/ssl_tcp_server.rb:4:in \`require': no such file to load -- openssl (LoadError) from ./lib/rex/socket/ssl_tcp\_server.rb:4 from ./lib/rex/socket/comm/local.rb:5:in `require' from ./lib/rex/socket/comm/local.rb:5 from ./lib/rex/socket.rb:22:in `require' from ./lib/rex/socket.rb:22 from ./lib/rex.rb:71:in `require' from ./lib/rex.rb:71 from ./msfconsole:10:in `require' from ./msfconsole:10 mpatters@pkdick:~/src/framework-3.0$
So, it's missing some libraries. A quick perusal of 'apt-cache search ruby' tells me that maybe what I want is the libopenssl-ruby package. I'd also seen something in the README about libreadline, and I see a ruby package for that too, so:
sudo apt-get install libreadline-ruby libopenssl-ruby
(looks like those are in the universe repository).
mpatters@pkdick:~/src/framework-3.0$ ./msfconsole [poorly-wrapped logo elided] =[ msf v3.0 + -- --=[ 176 exploits - 104 payloads + -- --=[ 17 encoders - 5 nops =[ 30 aux msf \>
And that looks to be about that. If you want msfweb though:
mpatters@pkdick:~/src/framework-3.0$ ./msfweb [\*] Starting msfweb v3.0 on http://127.0.0.1:55555/ ./script/../config/boot.rb:18:in `require': no such file to load -- rubygems (LoadError) from ./script/../config/boot.rb:18 from ./script/server:2:in `require' from ./script/server:2 from ./msfweb:82:in `load' from ./msfweb:82 mpatters@pkdick:~/src/framework-3.0\$
That looks to require an apt-get install of rubygems (also in universe). You will then need to issue
sudo gem install -v=1.2.2 rails
(as msfweb suggested when I tried it again). It will ask about rake, activesupport, activerecord, actionpack, actionmailer, and actionwebservice, so let it install all those. After that, msfweb works as expected - I fired up a web browser on localhost and pointed it at http://localhost:55555, as the output from msfweb suggested, and away I went.
No guarantees that this installs every single library you might possibly need, but it at least gets you up and running.
Note that all of this will likely depend on enabling the universe repository in Ubuntu. If you don't know how to do that and can't figure it out, I can't help you - you're unlikely to be able to work metasploit anyway, sorry.
Update: for msfgui, one also needs libglade2-ruby and libgtk2-ruby.