Vulhub安装教程_Docker


以下操作均在root权限下操作 如果不是root权限自行在命令前加sudo

Docker安装

更新pip

curl -s https://bootstrap.pypa.io/get-pip.py | python3

你可能遇到我这样的问题(如果没有问题直接跳过)

image-20211120171444432

根据提示执行红框内命令即可

apt install curl

image-20211120171743839

又报错。。。安装红框中的依赖即可

apt-get install libcurl3-gnutls=7.47.0-1ubuntu2.19

这一切都解决了 开开心心的去更新pip 这时你有发现pip就是死活下不下来

可以先用物理机下好然后拖到虚拟机安装

# pip下载地址
https://bootstrap.pypa.io/ 

image-20211120172709701

使用迅雷添加链接下载

image-20211120172921527

python3 get-pip.py 

Docker

curl -s https://get.docker.com/ | sh

image-20211120224126562

安装docker-compose

pip install docker-compose

image-20211120223946738

下载Vulhub

先安装git

apt install git

克隆Vulhub

git clone https://github.com/vulhub/vulhub.git

如果无法克隆也可以直接下载然后拉到虚拟机

https://github.com/vulhub/vulhub/archive/master.zip

测试环境(这里我选择CVE-2017-7504)

cd /vulhub/jboss/CVE-2017-7504

启动环境

docker-compose builddocker-compose up -d

image-20211120232418265

等到构建完成

查看IP地址

ifconfig

image-20211120235317594

通过docker ps -a查看开启的环境

image-20211120235501515

访问地址http://192.168.44.135:8080/

image-20211120235704886

Vulhub官方漏洞复现文档

Vulhub - Docker-Compose file for vulnerability environment

解决Docker拉取缓慢问题

1.添加docker-ce的apt源

apt-get updateapt-get install -y apt-transport-https ca-certificates curl software-properties-commoncurl -fsSL https://download.daocloud.io/docker/linux/ubuntu/gpg | sudo apt-key add -

2.执行以下命令

add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.daocloud.io/docker/linux/ubuntu $(lsb_release -cs) stable"

3.配置docker加速

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://d1c9c786.m.daocloud.iosystemctl restart docker

4.启动docker

service docker start