如何在Linux上安装Kali Docker映像?

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
Check Docker Service Status
检查Docker服务状态

搜索卡利图像(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
Search Kali Image
搜索卡利图像

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容器图像。 我们将使用官方提供的最受欢迎的一种。 有趣的是,它不是官方检查的。

LEARN MORE  Ubuntu, Debian, Kali Ssh Installation
了解更多Ubuntu,Debian,Kali Ssh安装

拉并安装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
Pull and Install Kali Container Image
拉并安装Kali容器映像

启动容器(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
Start A Container
启动容器

更新包装信息(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
Update Package Information
更新包装信息

安装工具(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
Install Tools
安装工具

永久安装工具(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
Find Container
查找容器

用名称保存容器(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
Save Container With A Name
用名称保存容器

翻译自: https://www.poftut.com/install-kali-docker-image-linux/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值