GitHub就提供了各種快速的漏洞環境。想利用它們就得裝上docker環境。
附加:快速搭建各種漏洞環境(Various vulnerability environment) https://github.com/Medicean/VulApps
本人的虛擬機環境:Linux version 4.17.0-kali1-amd64 ([email protected]) (gcc version 7.3.0 (Debian 7.3.0-25)) #1 SMP Debian 4.17.8-1kali1 (2018-07-24)---看這日期就知道安裝kali沒多久,百度折騰很久才測試有效
1.刪除原先的docker(默認沒有)
apt-get purge docker.io
2.添加docker-ce的apt 源
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.daocloud.io/docker/linux/ubuntu/gpg | sudo apt-key add -
3.修改/etc/lsb_release,使得更新源時將kali替換爲ubuntu,可先用#將原先的註釋掉或備份
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"
4. sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.daocloud.io/docker/linux/ubuntu $(lsb_release -cs) stable"(記得這是一句話)
5.更新apt數據庫
apt-get update
apt-cache policy docker-ce*
apt-get install docker-ce
6.apt-get install docker-ce可能會出現的問題,無問題直接跳過
可能會發生下面的提示:
無法獲得鎖 /var/lib/dpkg/lock - open (11: 資源暫時不可用)
無法鎖定管理目錄(/var/lib/dpkg/),是否有其他進程正佔用它?
解決辦法如下:
(1)終端輸入 ps aux ,列出進程。找到含有apt-get的進程,直接sudo kill PID。(應該會kill把)
(2)強制解鎖,命令
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
完成後重新apt-get install docker-ce
7.配置docker鏡像加速
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://d1c9c786.m.daocloud.io
systemctl restart docke
附加:
用Hello World校驗Docker的安裝
docker run hello-world
如果出現Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
不要慌,服務器從Docker Hub獲取到最新的Hello World鏡像,下載到本地。
再次輸入docker run hello-world,回車:
Hello from Docker.
This message shows that your installation appears to be working
correctly.