首先说Openstack官网的安装文档做的太棒了,文档链接:http://docs.openstack.org/mitaka/install-guide-rdo/。

但是在执行

yum install python-openstackclient

遇到如下错误,有若干依赖包无法下载。

python2-babel-2.3.4-1.el7.noar FAILED                                          ====-                 ] 700 kB/s | 4.8 MB  00:00:04 ETA
http://mirror.centos.org/centos/7/cloud/x86_64/openstack-mitaka/common/python2-babel-2.3.4-1.el7.noarch.rpm: [Errno -1] Package does not match intended download. Suggestion: run yum --enablerepo=centos-openstack-mitaka clean metadata
Trying other mirror.



解决办法如下:

检查CentOS-OpenStack-mitaka.repo

more /etc/yum.repos.d/CentOS-OpenStack-mitaka.repo
[centos-openstack-mitaka]
name=CentOS-7 - OpenStack mitaka
baseurl=http://mirror.centos.org/centos/7/cloud/$basearch/openstack-mitaka/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud

将其中的baseurl修改为aliyun或其它的国内源

vi /etc/yum.repos.d/CentOS-OpenStack-mitaka.repo
[centos-openstack-mitaka]
name=CentOS-7 - OpenStack mitaka
baseurl=http://mirrors.aliyun.com/centos/7/cloud/$basearch/openstack-mitaka/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud


上述过程可使用sed直接修改文件完成

sed -i 's/mirror.centos.org/mirrors.aliyun.com/g' /etc/yum.repos.d/CentOS-OpenStack-mitaka.repo

然后执行

yum --enablerepo=centos-openstack-mitaka clean metadata

或者

yum clean all

之后运行

yum install python-openstackclient

安装过程就不会报错了。