在板瓦工買(mǎi)了個(gè) 512M 內(nèi)存的 VPS ,平時(shí)用來(lái)
想著不是太浪費(fèi)了嗎,就搭建各種環(huán)境做測(cè)試.
網(wǎng)上已經(jīng)有很多教程了,這里就不贅述了.
官方:https://github.com/rapid7/metasploit-framework/wiki/Nightly-Installers
在 Gayhub 上發(fā)現(xiàn)一份自動(dòng)化腳本
下載該腳本然后賦予執(zhí)行權(quán)限 chmod +x [文件名]
腳本放在文末,
運(yùn)行這個(gè)腳本運(yùn)行的后發(fā)現(xiàn)出了問(wèn)題,
丟到群里問(wèn)一遍沒(méi)人回,于是上谷歌查了一下,說(shuō)是ruby版本太低的問(wèn)題.
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
再一次執(zhí)行腳本,一路回車(chē)和按y.
完成后進(jìn)入 msf 目錄
cd ~/metasploit-framework/
./msfconsole
出現(xiàn)這個(gè)問(wèn)題
這是內(nèi)存不足引起的,內(nèi)存充足的應(yīng)該不會(huì)出現(xiàn)這個(gè)問(wèn)題.
解決方法是增加虛擬內(nèi)存
dd if=/dev/zero of=/swap bs=1024 count=1M
mkswap /swap
?swapon /swap
echo "/swap swap swap sw 0 0" >> /etc/fstab
完成.
想要全局啟動(dòng)自己添加環(huán)境變量,數(shù)據(jù)庫(kù)也需要弄一下,請(qǐng)參考百度丶谷歌
完整源碼
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