cs安装:https://blog.csdn.net/qq_40624810/article/details/107572575
具体注意java环境的配置,不同的系统配置命令不同。
msf安装,我是参考这篇博客的:https://www.aqniu.com/vendor/50662.html
因为的vps也是CentOS的,各位安装还是要看好自己的操作系统版本。
1. 使用安装脚本安装MSF
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb> msfinstall
权限:chmod 755 msfinstall
安装:./msfinstall
2. 测试安装完成的MSF
安装完成的MSF目录为/opt/metasploit-framework/
执行msfconsole查看MSF是否正常
> msfconsole
出现没有数据库支持警告,首先创建数据库连接配置文件
3. 初始化数据库
首先初始化数据库> cd /opt/metasploit-framework/bin/
> ./msfdb
# 不能使用root来初始化数据库
Please run msfdb as a non-root user
# 创建账号用于初始化数据库
> useradd msf
> su msf
> ./msfdb
......
Commands:
init initialize the component
reinit delete and reinitialize the component
delete delete and stop the component
status check component status
start start the component
stop stop the component
restart restart the component
# 初始化数据库
> ./msfdb init
Creating database at /home/msf/.msf4/db
Starting database at /home/msf/.msf4/db...success
Creating database users
Writing client authentication configuration file /home/msf/.msf4/db/pg_hba.conf
Stopping database at /home/msf/.msf4/db
Starting database at /home/msf/.msf4/db...success
Creating initial database schema
......
# 创建完成后在msf用户目录会生成一个.msf目录里面会有一个database.yml文件
# 退出msf 账号 回到 root 账号下
> cp /home/msf/.msf4/database.yml /opt/metasploit-framework/embedded/framework/config/
cp:是否覆盖"/opt/metasploit-framework/embedded/framework/config/database.yml"? y
以上过程完成后,msf再次启动测试正常,数据库连接正常