# kali 安装 podman

* 修改更新源
    

修改 sources.list 文件的更新源

```plaintext
# cat sources.list
deb https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main non-free contrib
deb-src https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling main non-free contrib
```

* 安装 podman
    

```plaintext
# apt-get install podman
```

* 自定义 podman 镜像源
    

```plaintext
# cd /etc/containers 
                                                                                                                             
# ls -lhirt
2359590 -rw-r--r-- 1 root root 3.8K  9月 3日 02:25 registries.conf
2359591 -rw-r--r-- 1 root root   92  9月21日 03:39 policy.json
2359594 drwxr-xr-x 3 root root 4.0K 11月27日 07:13 systemd
2359592 drwxr-xr-x 2 root root 4.0K 11月27日 07:13 registries.conf.d
                                                                                                                             
# cat registries.conf

# nano registries.conf
```

podman 使用 registries.conf 文件来管理镜像源。在文件后面添加下面内容

```plaintext
# 认情况下，podman pull 和 podman search 命令以指定顺序在 unqualified-search-registries 列表中列出的注册表中搜索容器镜像
unqualified-search-registries = ["docker.m.daocloud.io", "registry.access.redhat.com", "registry.redhat.io", "docker.io"]
# short-name-mode = "disabled"

# 设置 docker.io 前缀的 docker 地址使用其他镜像地址
[[registry]]
prefix = "docker.io"
location = "docker.1ms.run"
# location = docker.m.daocloud.io
# 当 registry.location 无法访问时，会以 mirror 顺序访问镜像源
[[registry.mirror]]
location = "hub.mirrorify.net"
insecure = true
[[registry.mirror]]
location = "dislabaiot.xyz"
insecure = true
[[registry.mirror]]
location = "doublezonline.cloud"
insecure = true

# 设置 quay.io 镜像地址 -- Redhat 镜像中心
[[registry]]
prefix = "quay.io"
location = "quay.mirrorify.net"
# location = "quay.m.daocloud.io"

# 设置 ghcr.io 镜像地址 -- github 镜像中心
[[registry]]
prefix = "ghcr.io"
location = "ghcr.mirrorify.net"
# location = "ghcr.m.daocloud.io"

# 设置 gcr.io 镜像地址 -- google 镜像中心
[[registry]]
prefix = "gcr.io"
location = "gcr.mirrorify.net"
# location = "gcr.m.daocloud.io"

# 设置 k8s.gcr.io 镜像地址
[[registry]]
prefix = "k8s.gcr.io"
location = "k8s.mirrorify.net"
# location = "k8s.m.daocloud.io"
```

查看镜像源配置是否生效

```plaintext
# podman --version
podman version 5.6.2

# podman info
```

安装并配置成功

podman 命令基本和 docker 一致

* 主要参考文章
    

```plaintext
https://lzw.me/a/podman-abc.html
```
