海外aws-ubuntu-16.04系统使用ansible安装tidb

本以为按照官方文档会比较顺利,没想到还是遇到了几个坑,毕竟pingcap不能考虑到所有问题

环境:

1.ubuntu:16.04LTS

2.python:2.7

小坑:因为第一次使用ubuntu,没想到useradd与adduser区别; adduser才会正常添加用户;useradd则需要自定义好些东西

大坑一、万万没想到在git clone代码时候就出错,报错为无法连接到github服务器,代码504.google之后有的说开了代理解决方法:

    

Linux
不使用代理
unset HTTP_PROXY
unset HTTPS_PROXY
git config --global --unset http.proxy
git config --global --unset https.proxy
git clone http://yourUser@stashAddress:stashPort/apptest.git 使用代理
export HTTP_PROXY=proxyaddress:port
export HTTPS_PROXY=proxyaddress:port
git config --global http.proxy http://proxyaddress:port
git config --global https.proxy http://proxyaddress:port

  然而我这是新机器,肯定不是代理问题,防火墙也没做特殊配置,后来尝试将https更改为http,成功下载,并且再次删除之后也可使用https来下载,即:

git clone http://github.com/lpf190/weworkapi_python.git
下载成功
rm -f weworkapi_python
git clone https://github.com/lpf190/weworkapi_python.git

大坑二:cryptography:1.2.3升级之后导致pyOpenSSL 不可用

  按照官方文档使用pip安装的anbile,提示cryptography版本低,ok,(pip install -U cryptography)升级之后,anbile --version可以使用,但是无法执行,ansible host -m ping 这类命令,设置无法执行 pip list命令,报错

ERROR! Unexpected Exception, this is probably a bug: 'module' object has no attribute 'SSL_ST_INIT'
the full traceback was: Traceback (most recent call last):
File "/usr/local/bin/ansible", line , in <module>
exit_code = cli.run()
File "/usr/local/lib/python2.7/dist-packages/ansible/cli/adhoc.py", line , in run
result = self._tqm.run(play)
File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_queue_manager.py", line , in run
self.load_callbacks()
File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_queue_manager.py", line , in load_callbacks
for callback_plugin in callback_loader.all(class_only=True):
File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/loader.py", line , in all
module = self._load_module_source(name, path)
File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/loader.py", line , in _load_module_source
module = imp.load_source(full_name, path, module_file)
File "/usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/foreman.py", line , in <module>
import requests
File "/usr/lib/python2.7/dist-packages/requests/__init__.py", line , in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/lib/python2.7/dist-packages/urllib3/contrib/pyopenssl.py", line , in <module>
import OpenSSL.SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line , in <module>
from OpenSSL import rand, crypto, SSL
File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line , in <module>
SSL_ST_INIT = _lib.SSL_ST_INIT

感谢google给出的方法:

mv /usr/lib/python2./dist-packages/OpenSSL /tmp/
mv /usr/lib/python2./dist-packages/pyOpenSSL-0.15..egg-info /tmp/
sudo pip install pyopenssl pip list #可用了
anbile host -m ping #可用了

提示:缺少yaml模块使用pip安装  pip install PyYAML

上一篇:linux – 使用SSHFS挂载远程文件系统


下一篇:vmware-workstation 中安装Ubuntu18.04后 完美安装vmtools工具