openstack中修改centos7 镜像的root密码
第一步:需要我们提前准备好镜像,具体的镜像可以自己在官网下载,国内的建议在 (中科大)https://mirrors.ustc.edu.cn/
由于我不知道root的密码,使用下面的方法修改centos7镜像的root密码
第二步:安装软件libguestfs-tools
1 | [root@node152 ~]# yum install libguestfs-tools -y |
第三步,设定一个固定密码
1 | [root@node152 ~]# virt-customize -a CentOS-7-x86_64-GenericCloud-2009.qcow2 --root-password password:123456 |
执行过程
1 2 3 4 5 6 7 8 9 10 11 12 | [root@node152 ~]# virt-customize -a CentOS-7-x86_64-GenericCloud-2009.qcow2 --root-password password:123456 [ 0.0] Examining the guest ... virt-customize: error: libguestfs error: could not create appliance through libvirt. Try running qemu directly without libvirt using this environment variable: export LIBGUESTFS_BACKEND=direct Original error from libvirt: Cannot access storage file '/root/CentOS-7-x86_64-GenericCloud-2009.qcow2' ( as uid:107, gid:107): Permission denied [code=38 int1=13] If reporting bugs, run virt-customize with debugging enabled and include the complete output: virt-customize -v -x [...] |
上面提示错误。 没有LIBGUESTFS_BACKEND 环境变量
第四步,临时增加LIBGUESTFS_BACKEND 环境变量
1 | [root@node152 ~]# export LIBGUESTFS_BACKEND=direct |
第五步,再次执行设定固定密码的命令,设置密码为123456
1 | [root@node152 ~]# virt-customize -a CentOS-7-x86_64-GenericCloud-2009.qcow2 --root-password password:123456 |
执行过程
1 2 3 4 5 6 | [root@node152 ~]# virt-customize -a CentOS-7-x86_64-GenericCloud-2009.qcow2 --root-password password:123456 [ 0.0] Examining the guest ... [ 5.6] Setting a random seed [ 5.7] Setting passwords [ 7.3] Finishing off |
设置成功
上传镜像并通过该镜像创建实例,使用刚才设置的root密码登录成功。
openstack上传镜像查看上期博文openstack-glance上传镜像实践
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端
2018-07-14 PHP composer-setup安装遇到的openssl extension is missing