0%

CentOS 7安装 Metasploit

Steps

  1. Get source code, Enter into code directory
1
2
git clone git://github.com/rapid7/metasploit-framework.git
cd metasploit-framework
  1. Install preparation, install Ruby and set it default
1
2
3
4
yum install yum-utils -y
yum-builddep -y ruby
rvm install ruby-2.5.1
rvm use 2.5.1 --default
  1. Install rvm
1
2
curl -L get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
  1. Check output if you have gpg key check error, execute this command
1
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
  1. Bundler install
1
2
gem install rails
bundle install
  1. Init and start postgresql
1
2
postgresql-setup initdb
systemctl start postgresql
  1. Create postgresql user and database for metasploit
1
2
sudo -u postgres -i createuser msfuser -P
sudo -u postgres -i createdb -O msfuser msfdb
  1. Config metasploit db
1
cp config/database.yml.example config/database.yml
  1. Edit database.yml
1
2
3
4
5
6
7
8
9
production: &pgsql
adapter: postgresql
database: msfdb
username: msfuser
password: msfpass
host: localhost
port: 5432
pool: 5
timeout: 5
  1. Add config to /var/lib/pgsql/data/pg_hba.conf
1
host   msfdb            msfuser      127.0.0.1/32          md5
  1. Restart postgresql
1
systemctl restart postgresql.service
  1. Start
1
./msfconsole

Reference