Kali is security distribution popular in the Cyber security community. Especially penetration testers really love it. Kali provides a lot of security exploitation tool to test various systems like server, network, application server, database, VoIP etc. Kali is provided in different formats like virtual machine, ISO file, USB image and container. In this tutorial we will look how to install Kali docker container in a Ubuntu box. Our host system is Ubuntu but it is the same for other distributions like Debian, Fedora, CentOS etc.
Kali是在网络安全社区中流行的安全分发。 特别是渗透测试人员真的很喜欢它。 Kali提供了许多安全开发工具来测试各种系统,例如服务器,网络,应用程序服务器,数据库,VoIP等。Kali提供了不同的格式,例如虚拟机,ISO文件,USB映像和容器。 在本教程中,我们将研究如何在Ubuntu盒子中安装Kali docker容器。 我们的主机系统是Ubuntu,但其他发行版(例如Debian,Fedora,CentOS等)都相同。
安装Docker (Install Docker)
Docker have different names for different distributions because of some package name conflict. Docker name can be used for Fedora, RedHat, CentOS and other related distributions and installation can be done like below.
由于某些软件包名称冲突,Docker对于不同的发行版具有不同的名称。 Docker名称可用于Fedora,RedHat,CentOS和其他相关发行版,安装过程可如下所示。
Fedora,RedHAT,CentOS: (Fedora, RedHAT, CentOS:)
$ yum install docker
Debian,Ubuntu和Mint: (Debian, Ubuntu, Mint:)
$ apt install docker.io
启动Docker (Start Docker)
Docker works as a daemon service. In order to use docker we need to start this service. There are different service and daemon management tools but sytemctl
is supported by all of them.
Docker作为守护程序服务。 为了使用docker,我们需要启动此服务。 有不同的服务和守护程序管理工具,但是sytemctl
它们支持。
$ sudo systemctl start docker
检查Docker服务状态 (Check Docker Service Status)
We can check docker service status with the status
option.
我们可以使用status
选项检查docker服务状态。
$ systemctl status docker
![Check Docker Service Status](https://i-blog.csdnimg.cn/blog_migrate/0bae4a0f1e3a99515decf6c6f87ef14c.png)
搜索卡利图像(Search Kali Image)
Now we can use docker
command to find Kali docker image. We will use search
sub command with kali
term to find available Kali container images in Docker Hub.
现在我们可以使用docker
命令找到Kali docker镜像。 我们将使用带有kali
术语的search
子命令在Docker Hub中查找可用的Kali容器映像。
$ sudo docker search kali
![Search Kali Image](https://i-blog.csdnimg.cn/blog_migrate/57760d2dc16ad6058c6ef3eada021d66.png)
As we can see there are a lot of Kali container image. We will use most popular one which is provided by officially. Interestingly it is not check as official.
我们可以看到,有很多Kali容器图像。 我们将使用官方提供的最受欢迎的一种。 有趣的是,它不是官方检查的。
拉并安装Kali容器映像(Pull and Install Kali Container Image)
We will pull Kali container image from the Docker Repository with the `pull sub-command like below. Container images uses layered file system and downloaded as multi part. This is an advantage for creating multiple containers from single image because only changed part will copied and unchanged part of the image will be used by multiple containers without problem.
我们将使用如下所示的`pull子命令,从Docker Repository中提取Kali容器映像。 容器映像使用分层文件系统,并作为多部分下载。 这是从单个图像创建多个容器的一个优势,因为只有更改的部分将被复制,而图像的未更改部分将被多个容器使用而不会出现问题。
$ sudo docker pull kalilinux/kali-linux-docker
![Pull and Install Kali Container Image](https://i-blog.csdnimg.cn/blog_migrate/8a6dc11494fd024c6c4f6a7dd9338bf6.png)
启动容器(Start A Container)
We will start the container with the run
sub-command. But there are some options we should provide. After container is started how can we connect to the Kali ? For this we will provide -t
and -i
options to specify we want to connect to the terminal interactively.
我们将使用run
子命令启动容器。 但是我们应该提供一些选择。 容器启动后,我们如何连接到Kali? 为此,我们将提供-t
和-i
选项,以指定我们要以交互方式连接到终端。
$ docker run -t -i kalilinux/kali-linux-docker
![Start A Container](https://i-blog.csdnimg.cn/blog_migrate/6084cdcc06231929b786b8f648186917.png)
更新包装信息(Update Package Information)
We should update package information of the Kali container because the container have old versions of tools. Other cause is apt do not have recent and all package information. We will update package information with the following command.
我们应该更新Kali容器的软件包信息,因为该容器具有旧版本的工具。 其他原因容易没有最新的和所有的包装信息。 我们将使用以下命令更新软件包信息。
$ apt update
![Update Package Information](https://i-blog.csdnimg.cn/blog_migrate/0f39681a7dcf817ed904e4ca7b3fdf8a.png)
安装工具(Install Tools)
By default Kali container comes very thin. We should install required tools by using apt package management. We will install nmap
in the following example.
默认情况下,Kali容器非常薄。 我们应该使用apt软件包管理来安装必需的工具。 在以下示例中,我们将安装nmap
。
$ apt install nmap -y
![Install Tools](https://i-blog.csdnimg.cn/blog_migrate/3088966a254cc62a5c985d8137def863.png)
永久安装工具(Install Tools Persistently)
One of the fundamental rule of the containers is after the container stops all changes are lost. This is unwanted situation for us. We will save our Kali container current state and we can reuse this image again.
容器的基本规则之一是在容器停止运行后,所有更改都将丢失。 这对我们来说是不受欢迎的情况。 我们将保存我们的Kali容器当前状态,并且我们可以再次重用此映像。
查找容器 (Find Container)
We will list currently running containers to find Kali container and get the Container ID which identifies the container uniquely. We will use ps
sub-command.
我们将列出当前正在运行的容器以查找Kali容器,并获取唯一标识该容器的Container ID。 我们将使用ps
子命令。
$ docker ps
![Find Container](https://i-blog.csdnimg.cn/blog_migrate/f6f18ac0f4e40f3d4458cddc5c28c5a1.png)
用名称保存容器(Save Container With A Name)
We have found that our container id is a64bcb9cdc9a . So we will save this container with a new name like mykali
by using commit
sub-command.
我们发现我们的容器ID为a64bcb9cdc9a。 因此,我们将使用commit
子命令以新名称(例如mykali
保存此容器。
$ docker commit a64bcb9cdc9a mykali
![Save Container With A Name](https://i-blog.csdnimg.cn/blog_migrate/98127e03d32ed607e78f813aa35d60a1.png)
翻译自: https://www.poftut.com/install-kali-docker-image-linux/