CentOS下openstack源码安装(Nova)
1. 安装git工具
yum install git
2. 下载nova源码
git clone https://github.com/openstack/nova.git
3. python工具安装
yum install python-setuptools
4. 安装nova
进入nova源码根目录.
python setup.py install
这里马上会有很多错误提示。
a. lxml错误
Traceback (most recent call last): File "setup.py", line 21, in <module> d2to1=True) File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup dist.run_commands() File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands self.run_command(cmd) File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command cmd_obj.run() File "build/bdist.linux-x86_64/egg/pbr/packaging.py", line 310, in run File "build/bdist.linux-x86_64/egg/pbr/packaging.py", line 95, in _pip_install File "build/bdist.linux-x86_64/egg/pbr/packaging.py", line 83, in _missing_requires File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 483, in find set's ``.entries`` (if it wasn't already present). pkg_resources.VersionConflict: (lxml 2.2.3 (/usr/lib64/python2.6/site-packages/lxml-2.2.3-py2.6-linux-x86_64.egg), Requirement.parse('lxml>=2.3'))
原因,CentOS自带的python环境中有lxml,已安装,但是不符合openstack的要求,版本太低,至少的要求要>=2.3,这里我们使用python自带的安装命令:
先找到安装在python的site-package下的lxml文件和文件夹.
easy_install lxml
执行完后,但是还是会出错误,提示可能是没有Python.h文件等错误.
使用命令:
yum install python-dev
如果还有其他和lxml安装错误的参考:http://blog.csdn.net/azhao_dn/article/details/7501432
b. sqlalchemy安装版本错误
错误类型同lxml提示的错误,但这里告诉我们的是版本太高,sqlalchemy是我之前采用easy_install安装的,肯定是最新版本,这里我们使用sqlalchemy源码下载安装。
wget http://ncu.dl.sourceforge.net/project/sqlalchemy/sqlalchemy/0.7.8/SQLAlchemy-0.7.8.tar.gz
tar -zxvf SQLAlchemy-0.7.8.tar.gz
cd SQLAlchemy-0.7.8
python setup.py install
插曲:
将/usr/bin/下的easy_install执行脚本删除,不能在命令行使用easy_install了,在使用yum install python-setuptools将提示已经安装了。
解决办法:
源码安装setuptools
浏览器下载:
https://pypi.python.org/packages/source/s/setuptools/setuptools-0.7.2.tar.gz
这里不支持wget,pypi.python.org进行了限制.
c. netaddr安装版本错误.同上面的错误一样.
pkg_resources.VersionConflict: (netaddr 0.7.5 (/usr/lib/python2.6/site-packages), Requirement.parse('netaddr>=0.7.6'))
至少需要0.7.6版本.
wget http://cloud.github.com/downloads/drkjam/netaddr/netaddr-0.7.10.tar.gz
tar -zxvf netaddr-0.7.10.tar.gz
cd setuptools-0.7.2
python setup.py install
这里就成功安装了netaddr
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import netaddr >>> netaddr.VERSION (0, 7, 10) >>>
d. pip错误
错误提示:
/usr/bin/python: No module named pip
安装pip
源码下载url:https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz
安装方法同上面的python包安装,不在累述。
安装好pip后,重新执行nova的安装,提示错误:
/usr/bin/python: pip is a package and cannot be directly executed
怎么回事,没安装让我安装,安装了后告诉我他是一个包,不能直接执行?