centos 7 Metasploit安装及配置数据库 postgresql 10(For Metasploit)
centos 7 Metasploit安装及配置数据库 postgresql 10(For Metasploit)
安装 Metasploit
执行下面命令
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
chmod 755 msfinstall && \
./msfinstall
完成之后自动打开msf窗口
输入
msf > db_status
显示数据库未连接。
###############################################################################
安装配置数据库
创建用户
[root@localhost ~]#useradd postgres
配置你的yum存储库
[root@localhost ~]# vim /etc/yum.repos.d/CentOS-Base.repo
[base] 和[updates] 区段之间添加:
exclude=postgresql*
安装pg的rpm文件
[root@localhost ~]# yum localinstall https://download.postgresql.org/pub/repos/yum/testing/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
安装pg数据库
[root@localhost ~]# yum list postgresql*
[root@localhost ~]# yum install postgresql10-server.x86_64
[root@localhost ~]# mkdir postgres /var/lib/pgsql/10/data
初始化数据库
[root@localhost ~]# /usr/pgsql-10/bin/postgresql10-setup initdb
Initializing database ... OK
[root@localhost ~]# su - postgres
[postgres@localhost ~]$ /usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data start
[postgres@localhost ~]$ /usr/pgsql-10/bin/psql -p 5432
psql (10devel)
输入 "help" 来获取帮助信息.
postgres=#
创建msf用户和msf数据库
postgres=# CREATE USER msf WITH PASSWORD 'msf';
postgres=# CREATE DATABASE msf OWNER msf;
postgres=# ALTER ROLE msf LOGIN ;
postgres=#\du 查看用户
postgres=#\l 查看数据库
postgres=#\c msf 切换数据库
postgres=#\d 列出当前数据库表
postgres=#\q 退出
安装完成!
修改配置文件 ,否则无法登录数据库
find / -name pg_hba.conf 找到文件
vi /var/lib/pgsql/10/data/pg_hba.conf
修改如下:
然后 /usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data restart
回到root登录
psql -U msf -d msf -h 127.0.0.1 -p 5432
配置msf自动登录数据库
find / -name database.yml.example
找到目录/opt/metasploit-framework/embedded/framework/config/database.yml.example
copy /opt/metasploit-framework/embedded/framework/config/database.yml.example /opt/metasploit-framework/embedded/framework/config/database.yml
编辑vi /opt/metasploit-framework/embedded/framework/config/database.yml
修改为自己的信息
重新退出运行
安装 Metasploit
执行下面命令
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \
chmod 755 msfinstall && \
./msfinstall
完成之后自动打开msf窗口
输入
msf > db_status
显示数据库未连接。
###############################################################################
安装配置数据库
创建用户
[root@localhost ~]#useradd postgres
配置你的yum存储库
[root@localhost ~]# vim /etc/yum.repos.d/CentOS-Base.repo
[base] 和[updates] 区段之间添加:
exclude=postgresql*
安装pg的rpm文件
[root@localhost ~]# yum localinstall https://download.postgresql.org/pub/repos/yum/testing/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
安装pg数据库
[root@localhost ~]# yum list postgresql*
[root@localhost ~]# yum install postgresql10-server.x86_64
[root@localhost ~]# mkdir postgres /var/lib/pgsql/10/data
初始化数据库
[root@localhost ~]# /usr/pgsql-10/bin/postgresql10-setup initdb
Initializing database ... OK
[root@localhost ~]# su - postgres
[postgres@localhost ~]$ /usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data start
[postgres@localhost ~]$ /usr/pgsql-10/bin/psql -p 5432
psql (10devel)
输入 "help" 来获取帮助信息.
postgres=#
创建msf用户和msf数据库
postgres=# CREATE USER msf WITH PASSWORD 'msf';
postgres=# CREATE DATABASE msf OWNER msf;
postgres=# ALTER ROLE msf LOGIN ;
postgres=#\du 查看用户
postgres=#\l 查看数据库
postgres=#\c msf 切换数据库
postgres=#\d 列出当前数据库表
postgres=#\q 退出
安装完成!
修改配置文件 ,否则无法登录数据库
find / -name pg_hba.conf 找到文件
vi /var/lib/pgsql/10/data/pg_hba.conf
修改如下:
然后 /usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data restart
回到root登录
psql -U msf -d msf -h 127.0.0.1 -p 5432
配置msf自动登录数据库
find / -name database.yml.example
找到目录/opt/metasploit-framework/embedded/framework/config/database.yml.example
copy /opt/metasploit-framework/embedded/framework/config/database.yml.example /opt/metasploit-framework/embedded/framework/config/database.yml
编辑vi /opt/metasploit-framework/embedded/framework/config/database.yml
修改为自己的信息
重新退出运行
评论
发表评论