在板瓦工买了个 512M 内存的 VPS ,平时用来
想着不是太浪费了吗,就搭建各种环境做测试.
网上已经有很多教程了,这里就不赘述了.
官方:https://github.com/rapid7/metasploit-framework/wiki/Nightly-Installers
在 Gayhub 上发现一份自动化脚本
下载该脚本然后赋予执行权限 chmod +x [文件名]
脚本放在文末,
运行这个脚本运行的后发现出了问题,
丢到群里问一遍没人回,于是上谷歌查了一下,说是ruby版本太低的问题.
ruby -v
看了一下,刚1.8
下载安装ruby2.2的源码
wget https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.7.tar.gz
tar -zxvf ruby-2.2.7.tar.gz
cd ruby-2.2.7
./configure
make
make install
再一次执行脚本,一路回车和按y.
完成后进入 msf 目录
cd ~/metasploit-framework/
./msfconsole
出现这个问题
这是内存不足引起的,内存充足的应该不会出现这个问题.
解决方法是增加虚拟内存
dd if=/dev/zero of=/swap bs=1024 count=1M
mkswap /swap
swapon /swap
echo "/swap swap swap sw 0 0" >> /etc/fstab
完成.
想要全局启动自己添加环境变量,数据库也需要弄一下,请参考百度丶谷歌
完整源码
yum install git wget
# install build deps
sudo yum install gcc gcc-c++ make expat-devel gettext-devel libcurl-devel \
libffi-devel libxml2-devel libxslt-devel libyaml-devel postgresql-server \
postgresql-devel readline-devel sqlite-devel openssl-devel ruby-devel \
rubygems autoconf automake bison libtool libpcap-devel
cd ~
#install ruby-2.2.7
wget https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.7.tar.gz
tar -zxvf ruby-2.2.7.tar.gz
cd ruby-2.2.7
./configure
make
make install
cd ~
# install rbenv
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
# install ruby 2.1.5
rbenv install 2.1.5
# configure gem to not bother with installing docs
echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc
# install bundler
gem install bundler
# download latest development version of metasploit,
# tell rbenv to always use 2.1.5 for it,
# then install dependencies
git clone https://github.com/rapid7/metasploit-framework.git
cd metasploit-framework
rbenv local 2.1.5
bundle install
# initialize, configure, activate, and start postgresql
sudo service postgresql initdb
sudo service postgresql start
# create postgresql user and database for metasploit
sudo -u postgres -i createuser -DERPSl metasploit
sudo -u postgres -i createdb -O metasploit metasploit
# TODO: configure metasploit to use database
网友评论