1

I’ve literally been trying to install metasploit for 2 days now and I think that's a ridiculous amount of time just to install some software. I have Arch linux and I am trying to install metasploit-git from AUR. I’ve followed the Arch linux metasploit guide, as well as this.

I’ve followed the guide all the way up to the point where I need to run bundle install. It successfully installs a handful of gems, but fails with this error:

Gem::InstallError: metasploit-concern requires Ruby version >= 2.1.
An error occurred while installing metasploit-concern (0.4.0), and Bundler cannot continue.
Make sure that `gem install metasploit-concern -v '0.4.0'` succeeds before bundling.

Here are some of the environment variables:

MY_RUBY_HOME=/home/me/.rvm/rubies/ruby-1.9.3-p551

RUBY_VERSION=ruby-2.2.1

PATH=/home/me/.rvm/gems/ruby-1.9.3-p551/bin:/home/me/.rvm/gems/ruby-1.9.3-p551@global/bin:/home/me/.rvm/rubies/ruby-1.9.3-p551/bin:/home/me/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/me/.gem/ruby/2.2.0/bin:/home/me/.rvm/bin:/home/me/.rvm/bin
GEM_HOME=/home/me/.rvm/gems/ruby-2.2.1

I see that some of the variables say ruby-1.9, but I’m not sure what to do about it. The output of ruby --version is:

ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]

I have ruby 2.2.1 installed so I don’t know why this is still showing as the the version.

It turns out that the problem was having multiple instances of

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Removing all but one in /etc/profile, and then running rvm use --default 2.2.1 fixed this.

  • If you are using RVM then Ruby should be 2.2.1. But is it set as the correct version? What is the output of ruby -version? Also for RVM maybe you should lock in 2.2.1 as your default Ruby version by running this command, rvm --default use 2.2.1. Also, I would suggest attempting to just comment out MY_RUBY_HOME and PATH. Honestly have no idea why any of that would be set there but it seems like a mess. – JakeGould Apr 17 '15 at 19:32
  • I hate to ask but what to you mean by comment them out? I don't know why PATH is set to that in printenv because my /etc/profile doesn't contain the same PATH that printenv shows. Also I added ruby --version output in my post. – user3408678 Apr 17 '15 at 19:47
  • Look in the files ~/.bash_profile or ~/.profile in your home directory and see where that PATH and MY_RUBY_HOME is being set. Then comment those lines out by placing a # in front of those lines. Then logout and log back in and see what ruby --version is. As it stands, this all seems like a major mess idiosyncratic to your setup which means few people will be able to help you clean this up here. You need to unravel things to get to a sane/stable point. – JakeGould Apr 17 '15 at 20:03
  • There is no MY_RUBY_HOME variable being set in any files. In any case, I added 'unset MY_RUBY_HOME' in /etc/profile. However, my PATH variable is only being set inside /etc/profile and it only doesn't have all of the rvm paths. Those seem to be set somewhere else. – user3408678 Apr 17 '15 at 20:09
  • “In any case, I added 'unset MY_RUBY_HOME' in /etc/profile.” By doing what you are doing you are compounding a bad setup. You really seem like you are in over your head and are simply adding tweaks and adjustments with little to no thought. Which is why you are in this mess in the first place and why—if you are still doing that—you are only making problems worse. You really should cleanup your setup to square one and then move forward again more cautiously and more deliberately. I doubt anyone else can help you unravel this mess at this point. I know I cannot. – JakeGould Apr 17 '15 at 20:12
2

After 2 days of trial and error, I found a solution, follow the steps below but try it on a vm first. This worked for me on Kali linux hope it works for you. Before going ahead update your machine.

  1. git clone https://github.com/rapid7/metasploit-framework "folder_name"
  2. follow these steps to update ruby https://amionrails.wordpress.com/2014/02/10/install-rvm-ruby-on-rails-and-ruby-on-kali-linux/ follow all the steps upto installing rails
  3. ./msfupdate - check for error if it continues
  4. install these: 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 ruby-dev
  5. gem install bundle
  6. bundle install
  7. ./msfupdate

Next you will need to connect the database.

  1. start postgresql service if not running
  2. su - postgres
  3. createuser "user" -P -S -R -D
  4. createdb -O "user" msf
  5. exit
  6. return to home folder if currently accessing git clone folder
  7. cd .msf4/
  8. nano -w database.yml

add these lines to the file. production:
adapter: postgresql
database: msf
username: "user"
password: "password"
host: 127.0.0.1
port: 5432
pool: 75
timeout: 5


Then return to the msf folder (git clone folder) and run ./msfconsole

Apologies for this format, its my first solution and thanks to hak5 for the tutorial on installing metasploit from github and amionrails for tutorial on updating ruby. let me know if this works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.