Bootstrap

Ubuntu24.04安装vulhub

1.先更新源

apt update

2.安装vim

apt install vim

3.备份以免出错,换源,再更新

cp /etc/apt/sources.list /etc/apt/sources.list.bar

vim /etc/apt/sources.list

阿里源

deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse



deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse



deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse



deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse



deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse



deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse



deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse



deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse



deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse



deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse

按ESC

:wq

apt update

4.安装一些库

apt install python3-pip

apt install git

apt install docker.io

sudo apt install curl

5.使用curl命令下载并安装docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose    

授权

sudo chmod +x /usr/local/bin/docker-compose  

6.验证安装

docker-compose --version

7.当您尝试运行 docker-compose --version 时,系统却提示 /usr/bin/docker-compose 不存在

 添加到环境变量

export PATH=$PATH:/usr/local/bin         

 重启,意思就是激活

source ~/.bashrc

8.安装靶场

sudo apt-get install net-tools

git clone https://gitee.com/Anth0ny1130/vulhub.git

9.docker拉取镜像的时候超时

        1.创建docker目录

sudo mkdir -p /etc/docker

        2.创建daemon文件

sudo tee /etc/docker/daemon.json <<-'EOF'

{
  "registry-mirrors": [
    "https://mirror.gcr.io",
    "https://docker.registry.cyou",
    "https://docker-cf.registry.cyou",
    "https://dockercf.jsdelivr.fyi",
    "https://docker.jsdelivr.fyi",
    "https://dockertest.jsdelivr.fyi",
    "https://mirror.aliyuncs.com",
    "https://dockerproxy.com",
    "https://mirror.baidubce.com",
    "https://docker.m.daocloud.io",
    "https://docker.nju.edu.cn",
    "https://docker.mirrors.sjtug.sjtu.edu.cn",
    "https://ox288s4f.mirror.aliyuncs.com",
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://mirror.ccs.tencentyun.com"
  ]
}

EOF

        3.重启docker

sudo systemctl daemon-reload

sudo systemctl restart docker

10.以后会用到的命令

停止所有容器

docker-compose down

选项来强制pip安装  --break-system-packages ,例 pip install torch  --break-system-packages

如果一开始安装错误docker-compose,卸载的办法

1.卸载旧版本的Docker Compose

sudo apt-get remove docker-compose  

2.如果还需要移除配置文件,可以使用以下命令  

sudo apt-get purge docker-compose  

3.清理残留文件(可选)  

sudo apt-get autoremove

;