2402_90065483 2025-08-11 21:45 采纳率: 0%
浏览 11

iaas-install-keystone.sh失败

/usr/local/bin/iaas-install-keystone.sh:行4: mysql: 未找到命令
/usr/local/bin/iaas-install-keystone.sh:行5: mysql: 未找到命令
/usr/local/bin/iaas-install-keystone.sh:行6: mysql: 未找到命令
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"

One of the configured repositories failed (未知),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Run the command with the repository temporarily disabled
        yum --disablerepo=<repoid> ...

 4. Disable the repository permanently, so yum won't use it by default. Yum
    will then just ignore the repository until you permanently enable it
    again or use --enablerepo for temporary usage:

        yum-config-manager --disable <repoid>
    or
        subscription-manager repos --disable=<repoid>

 5. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: base/7/x86_64
/usr/local/bin/iaas-install-keystone.sh:行12: crudini: 未找到命令
/usr/local/bin/iaas-install-keystone.sh:行13: crudini: 未找到命令
/usr/local/bin/iaas-install-keystone.sh:行15: crudini: 未找到命令
su: user keystone does not exist
/usr/local/bin/iaas-install-keystone.sh:行17: keystone-manage: 未找到命令
/usr/local/bin/iaas-install-keystone.sh:行18: keystone-manage: 未找到命令
sed:无法读取 /etc/httpd/conf/httpd.conf:没有那个文件或目录
ln: 目标"/etc/httpd/conf.d/" 不是目录: 没有那个文件或目录
Failed to execute operation: No such file or directory
Failed to restart httpd.service: Unit not found.
/usr/local/bin/iaas-install-keystone.sh:行28: openstack: 未找到命令
/usr/local/bin/iaas-install-keystone.sh:行29: openstack: 未找到命令
/usr/local/bin/iaas-install-keystone.sh:行30: openstack: 未找到命令
/usr/local/bin/iaas-install-keystone.sh:行31: openstack: 未找到命令

  • 写回答

6条回答 默认 最新

  • 檀越@新空间 2025-08-11 21:46
    关注

    晚上好🌙🌙🌙
    本答案参考通义千问

    根据你提供的错误信息,iaas-install-keystone.sh 脚本在执行过程中出现了多个问题,主要集中在以下几点:


    一、关键问题分析

    1. 缺少依赖命令

      • mysqlcrudiniopenstack 等命令未找到。
      • 这些工具是安装 Keystone(OpenStack 身份服务)所必需的。
    2. yum 源配置异常

      • 无法访问 mirrorlist.centos.org,导致 yum 无法正常工作。
      • 可能是网络问题或镜像源配置错误。
    3. 系统用户和文件缺失

      • 用户 keystone 不存在。
      • 文件 /etc/httpd/conf/httpd.conf/etc/httpd/conf.d/ 不存在。
      • Apache HTTP 服务未正确安装或配置。
    4. OpenStack 命令未安装

      • openstack 命令未找到,说明 OpenStack 客户端未安装。

    二、解决方案步骤

    1. 安装必要的依赖包

    你需要先安装 mysqlcrudiniopenstack 相关的工具。执行以下命令:

    # 更新系统包列表
    sudo yum update -y
    
    # 安装 MySQL 服务器
    sudo yum install -y mysql-server
    
    # 安装 crudini 工具(用于编辑 ini 文件)
    sudo yum install -y crudini
    
    # 安装 OpenStack 客户端
    sudo yum install -y openstack-utils
    

    注意: 如果你使用的是 CentOS 7,可能需要先启用 EPEL 仓库:

    sudo yum install -y epel-release
    

    2. 配置 yum 源(解决 mirrorlist 错误)

    你遇到的错误是因为 mirrorlist.centos.org 无法解析,可能是 DNS 或网络问题。可以尝试手动设置 yum 源为国内镜像,例如阿里云或清华源。

    方法一:使用阿里云镜像源

    # 备份原有 repo 文件
    sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
    
    # 下载阿里云的 CentOS 7 repo 文件
    sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    
    # 清理缓存并重新生成
    sudo yum clean all
    sudo yum makecache
    

    方法二:使用清华源

    sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.tuna.tsinghua.edu.cn/help/centos-7/
    sudo yum clean all
    sudo yum makecache
    

    3. 创建 keystone 用户及目录

    脚本中调用了 keystone 用户,但该用户未创建。你可以通过以下命令创建:

    # 创建 keystone 用户
    sudo useradd -r -s /sbin/nologin keystone
    
    # 创建相关目录
    sudo mkdir -p /etc/keystone
    sudo chown keystone:keystone /etc/keystone
    

    4. 安装 Apache HTTP 服务

    脚本中引用了 /etc/httpd/ 目录,说明需要安装 Apache:

    sudo yum install -y httpd
    sudo systemctl start httpd
    sudo systemctl enable httpd
    

    注意: 如果 /etc/httpd/conf/httpd.conf 不存在,可以手动创建或从模板复制:

    sudo cp /usr/share/doc/httpd-2.4.6/httpd.conf /etc/httpd/conf/
    

    5. 安装 OpenStack 服务(包括 Keystone)

    确保你已经安装了 OpenStack 的核心组件,特别是 Keystone。如果你使用的是 DevStack 或者手动部署,可以参考以下方式:

    使用 OpenStack 官方仓库安装 Keystone

    # 添加 OpenStack 官方仓库(以 Newton 版本为例)
    sudo yum install -y centos-release-openstack-newton
    sudo yum install -y openstack-keystone
    

    注意: 根据你的 OpenStack 版本选择对应的仓库,如 Mitaka、Train、Ussuri 等。


    6. 修改脚本中的路径或命令(可选)

    如果上述步骤仍不能解决问题,可能需要对 iaas-install-keystone.sh 脚本进行修改,例如:

    • 替换 mysql/usr/bin/mysql
    • 确保 crudini 的路径正确
    • 确认 openstack 命令已安装并加入 PATH

    例如,修改后的部分脚本示例:

    # 原始行
    mysql -u root -p -e "CREATE DATABASE keystone;"
    
    # 修改后
    /usr/bin/mysql -u root -p -e "CREATE DATABASE keystone;"
    

    三、总结

    | 问题 | 解决方案 | |------|----------| | mysql 未找到 | 安装 mysql-server | | crudini 未找到 | 安装 crudini | | openstack 未找到 | 安装 openstack-utils | | yum 源失败 | 更换为阿里云或清华源 | | keystone 用户不存在 | 手动创建用户 | | Apache 服务缺失 | 安装 httpd 并配置 |


    四、建议

    • 在运行脚本前,确保所有依赖项已安装。
    • 检查 /etc/yum.repos.d/ 中的 repo 文件是否有效。
    • 如果你是第一次部署 OpenStack,建议使用 DevStack 自动化部署。

    如有更多错误日志,欢迎继续提供,我可以进一步帮助你定位问题。

    评论

报告相同问题?

问题事件

  • 创建了问题 8月11日