• openstack中修改centos7 镜像的root密码


    第一步:需要我们提前准备好镜像,具体的镜像可以自己在官网下载,国内的建议在 (中科大https://mirrors.ustc.edu.cn/

    由于我不知道root的密码,使用下面的方法修改centos7镜像的root密码

    第二步:安装软件libguestfs-tools

    [root@node152 ~]# yum install libguestfs-tools -y

    第三步,设定一个固定密码

    [root@node152 ~]# virt-customize -a CentOS-7-x86_64-GenericCloud-2009.qcow2 --root-password password:123456

    执行过程

    [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 环境变量

    [root@node152 ~]# export LIBGUESTFS_BACKEND=direct
    

    第五步,再次执行设定固定密码的命令,设置密码为123456

    [root@node152 ~]# virt-customize -a CentOS-7-x86_64-GenericCloud-2009.qcow2 --root-password password:123456

    执行过程

    [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上传镜像实践

  • 相关阅读:
    SQL数据去重复 Distinct 和 row_number() over()
    Excel闪退问题解决
    SQL Server 修改服务器登录名称以及密码
    从底层角度看ASP.NET-A low-level Look at the ASP.NET Architecture
    MD5加密
    MD5实例化异常 未能执行FIPS验证加密算法
    JDBC(上)
    自学MySQL第二天
    自学MySQL第一天
    自学JavaWeb第五天jQuery进阶
  • 原文地址:https://www.cnblogs.com/xzlive/p/15009855.html
Copyright © 2020-2023  润新知