---
title: "ubuntu 安装 beef"
author: "pako"
date: "2014-07-23T22:29:00Z"
tags: []
categories: ["互联网"]
slug: "ubuntu-beef"
draft: false
lastmod: "2014-07-23T22:29:00Z"
id: 2095746
url: "https://pako.iteye.com/blog/2095746"
---

正常的安装流程

**安装环境**

 

```bsh
vim /etc/apt/sources.list
    添加 deb http://ubuntu.mirror.cambrium.nl/ubuntu/ precise main universe     添加软件源
apt-get install ruby1.9.3
apt-get install libssl-dev libsqlite3-dev sqlite
sudo apt-get install g++
apt-get install git
```

**安装BeEF**

```bsh
git clone https://github.com/beefproject/beef
sudo gem install bundler
bundle install
cat config.yaml | grep driver:./beef
```

 

我遇到的麻烦是ubuntu 里默认的ruby是1.8的 所以在最后一步的时候说需要安装 ruby1.9 。可是在上面我们可以看到其实我们安装的就是1.9.所以只是默认的ruby版本不对。可以通过 update-alternatives --config ruby 来选择默认的ruby环境。

```
$ sudo update-alternatives --config ruby
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/ruby1.8     50        auto mode
  1            /usr/bin/ruby1.8     50        manual mode
  2            /usr/bin/ruby1.9.1   10        manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
```

 

当然gem如果安装了多个版本也需要重新配置最新的为默认选项。

```
$ sudo update-alternatives --config gem
There are 2 choices for the alternative gem (providing /usr/bin/gem).

  Selection    Path               Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gem1.8     180       auto mode
  1            /usr/bin/gem1.8     180       manual mode
  2            /usr/bin/gem1.9.1   10        manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/gem1.9.1 to provide /usr/bin/gem (gem) in manual mode.
```

好了 如果3000 端口已经打开了的话 。./beff 启动把