安装OpenStack命令行客户端

安装OpenStack命令行客户端

为每个OpenStack客户端安装前提软件和Python包。

安装前提软件

Most Linux distributions include packaged versions of the command-line clients. You can directly install the clients from the packages with prerequisites. For more information, see Installing_from_packages.

如果你需要从命令行包安装源码包,下面的表格列出了运行命令行客户端需要的软件,并提供了必要的安装指导。

OpenStack命令行客户端前置要求
先决条件 描述
Python 2.7 或者更新的版本 Supports Python 2.7, 3.4, and 3.5.
安装工具包

Mac OS X 默认安装

Many Linux distributions provide packages to make setuptools easy to install. Search your package manager for setuptools to find an installation package. If you cannot find one, download the setuptools package directly from Python Setuptools.

The recommended way to install setuptools on Microsoft Windows is to follow the documentation provided on the Python Setuptools website.

Another option is to use the unofficial binary installer maintained by Christoph Gohlke.

pip 安装包

To install the clients on a Linux, Mac OS X, or Microsoft Windows system, use pip. It is easy to use, ensures that you get the latest version of the clients from the Python Package Index, and lets you update or remove the packages later on.

由于安装过程需要编译源文件,所以需要安装与你操作系统对应的 Python 开发包 。

Option 1: Install pip using get-pip.py

To install pip, securely download get-pip.py. Then run the following:

# python get-pip.py

For more details visit install pip.

Option 2: Install pip through the package manager for your system

Ubuntu 或者 Debian

# apt install python-dev python-pip

注意到每一个操作系统可能需要额外的依赖,这取决于你正在安装的包,例如 Tempest 的情况。

Red Hat Enterprise Linux or CentOS

一个打包的版本可以使你能够使用 yum 来安装包:

# yum install python-devel python-pip

On Red Hat Enterprise Linux, this command assumes that you have enabled the OpenStack repository. For more information, see the Installation Tutorial for Red Hat Enterprise Linux and CentOS.

There are also packaged versions of the clients available that enable yum to install the clients as described in Installing_from_packages.

Fedora

A packaged version enables you to use dnf to install the package:

# dnf install python-devel python-pip

SUSE Linux 企业版服务器

A packaged version available in the Open Build Service enables you to use YaST or zypper to install the package.

First, add the Open Build Service repository as described in the Installation Tutorial.

然后安装 pip 并使用它管理客户端的安装:

# zypper install python-devel python-pip

还有其他可用的客户端打包版本,这些版本能够使 zypper 像 Installing_from_packages 章节描述的那样安装客户端。

openSUSE

你可以安装 pip 并通过它管理客户端的安装:

# zypper install python-devel python-pip

还有其他可用的客户端打包版本,这些版本能够使 zypper 像 Installing_from_packages 章节描述的那样安装客户端。

Another option for Microsoft Windows is to use the unofficial binary installer provided by Christoph Gohlke.

安装 OpenStack 客户端

以下例子显示了通过 pip 安装 OpenStack 客户端的命令,这些命令支持多种服务。

# pip install python-openstackclient

The following individual clients are deprecated in favor of a common client. Instead of installing and learning all these clients, we recommend installing and using the OpenStack client. You may need to install an individual project’s client because coverage is not yet sufficient in the OpenStack client. If you need to install an individual client’s project, replace the PROJECT name in this pip install command using the list below.

# pip install python-PROJECTclient
  • barbican - 秘钥管理器服务API
  • ceilometer - Telemetry API
  • cinder - 块存储 API 及其扩展
  • cloudkitty - Rating service API
  • “designate” - DNS 服务API
  • ”glance“ - 镜像服务 API
  • gnocchi - Telemetry API v3
  • “heat” - 编排 API
  • magnum - Container Infrastructure Management service API
  • manila - Shared file systems API
  • mistral - Workflow service API
  • monasca - Monitoring API
  • “murano” - 应用目录 API
  • neutron - 网络服务API
  • nova - 计算服务API和扩展
  • senlin - 集群服务API
  • swift - 对象存储API
  • trove - 数据库服务API

使用pip来安装

使用pip在Linux、Mac OS X或者Windows系统上安装OpenStack客户端,它方便使用,并确保从`Python Package Index <https://pypi.python.org/pypi>`__获取最新版本的客户端。你可以使用“pip”去更新或者移除一个包。

使用以下命令分开安装各个客户端:

  • 对于 Mac OS X 或 Linux:

    # pip install python-PROJECTclient
    
  • 对于 Microsoft Windows:

    C:\>pip install python-PROJECTclient
    

从包管理器安装

RDO, openSUSE, SUSE Linux Enterprise, Debian, and Ubuntu have client packages that can be installed without pip.

注解

The packaged version might install older clients. If you want to make sure the latest clients are installed, you might need to install the clients with pip.

  • On Red Hat Enterprise Linux or CentOS, use yum to install the clients from the packaged versions:

    # yum install python-PROJECTclient
    

    This command assumes that you have enabled the OpenStack repository for your distribution. For more information, see the Installation Tutorial for Red Hat Enterprise Linux and CentOS.

  • For Ubuntu or Debian, use apt-get to install the clients from the packaged versions:

    # apt-get install python-PROJECTclient
    
  • For openSUSE, use zypper to install the clients from the distribution packages service:

    # zypper install python-PROJECTclient
    
  • For SUSE Linux Enterprise Server, use zypper to install the clients from the packaged versions:

    # zypper install python-PROJECTclient
    

    This command assumes that you have enabled the OpenStack repository for your distribution. For more information, see the Installation Tutorial for openSUSE and SUSE Linux Enterprise.

更新或删除客户端

To upgrade a client with pip, add the --upgrade option to the pip install command:

# pip install --upgrade python-PROJECTclient

To remove the client with pip, run the pip uninstall command:

# pip uninstall python-PROJECTclient

接下来做什么

Before you can run client commands, you must create and source the PROJECT-openrc.sh file to set environment variables. See Set environment variables using the OpenStack RC file.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.