一、下载Centos7的qcow2镜像
CentOS Cloud Images
qemu-img.exe convert -f qcow2 -O vmdk CentOS-7-x86_64-GenericCloud-2211.qcow2 centos7.vmdk
二、更改root密码
注意由于有cloud init的原因,按网上进入救援模式的办法无法修改密码,会卡住不动。可参照linux centos 等待cloud-init页面_waiting for cloud-init-CSDN博客
启动时按e,找到linux16 这一行,把ro修改为rw init=/sysroot/bin/sh 并删除该行后面的内容,注意该行后面的要删除,不要保留,并且还要注意最后一行不要删除
chroot /sysroot
password 修改密码
参照
centos7.9系统忘记root用户密码怎么办,一招解决,超详细_centos7.9重置root密码-CSDN博客
三、更换Centos阿里源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
http://mirrors.tuna.tsinghua.edu.cn/git/git-repo/contrib/redhat/CentOS-Base.repo
四、安装docker
# 设置docker镜像源
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
yum makecache fast
yum install docker-ce docker-ce-cli containerd.io
systemctl start docker
systemctl enable docker
五、更换docker源
https://www.wxy97.com/archives/b5b225b6-7741-4560-be2f-2e6a4f671d9b
vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.1panel.live",
"https://hub.rat.dev",
"https://docker.actima.top",
"https://atomhub.openatom.cn",
"https://docker.m.daocloud.io",
"https://docker.nastool.de",
"https://dockerpull.org",
"https://registry.dockermirror.com",
"https://docker.m.daocloud.io",
"https://docker.1ms.run",
"https://docker.aityp.com",
"https://dockerhub.xisoul.cn",
"https://docker.imgdb.de",
"https://hub.littlediary.cn",
"https://docker.unsee.tech",
"https://hub.crdz.gq",
"https://hub.firefly.store",
"https://docker.kejilion.pro",
"https://dhub.kubesre.xyz",
"https://hub.xdark.top",
"https://docker.udayun.com"
]
}
systemctl daemon-reload
systemctl restart docker
六、扩容硬盘
growpart /dev/sda 1
xfs_growfs /
df -h