2015-09-15 2 views
2

Как получить/установить с помощью Cygwin?Cygwin - Как установить доступный?

Я пробовал следующие шаги, но он не работал во время пули 5 (при запуске «python setup.py install»). Меры, принятые от: Взято из https://servercheck.in/blog/running-ansible-within-windows

1) Скачать и установить Cygwin, по крайней мере, следующие пакеты, выбранные (вы можете выбрать пакеты в процессе установки):

libyaml 
libyaml-devel 
curl 
python (2.7.x) 
python-crypto 
python-openssl 
python-paramiko 
python-setuptools 
git (2.1.x) 
vim 
openssh 
openssl 
openssl-devel 

2) Скачать и установить PyYAML и Jinja2, так как они не доступны через инсталлятор Cygwin в:

1. Open Cygwin 
2. Download PyYAML: 
    curl -O https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz 
3. Download Jinja2: 
    curl -O https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.6.tar.gz 
4. Untar both downloads: 
    tar -xvf PyYAML-3.10.tar.gz && tar -xvf Jinja2-2.6.tar.gz 
5. Change directory into each of the expanded folders and run python "python setup.py install" to install each package. 
6. Clone ansible from its repository on GitHub: 
    git clone https://github.com/ansible/ansible /opt/ansible 
    This was tested with Ansible version v1.6.6, change directory into /opt/ansible and checkout the correct tag: git checkout v1.6.6. 
7. Add the following lines into your Cygwin .bash_profile: 
    # Ansible settings 
    ANSIBLE=/opt/ansible 
    export PATH=$PATH:$ANSIBLE/bin 
    export PYTHONPATH=$ANSIBLE/lib 
    export ANSIBLE_LIBRARY=$ANSIBLE/library 

8. At this point, you should be able to run ansible commands via Cygwin (once you restart, or enter source ~/.bash_profile to pick up the settings you just added). 
    Try ansible --version to display Ansible's version. 

9. Passwordless ssh will need to be set up between your Windows machine and the deployment host(s) 
    To enable passwordless ssh on Centos - ssh-copy-id [email protected] 
    To enable passwordless ssh on SuSE I followed the steps in this blog: 
    http://www.firedaemon.com/blog/passwordless-root-ssh-public-key-authentication-on-centos-6 
    install sshpass v1.05 on your Windows machine<br> 

ошибка, что я получил во время во время пули 5 является:

$ python setup.py install 
running install 
running build 
running build_py 
creating build 
creating build/lib.cygwin-2.2.1-x86_64-2.7 
creating build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/composer.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/constructor.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/cyaml.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/dumper.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/emitter.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/error.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/events.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/loader.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/nodes.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/parser.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/reader.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/representer.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/resolver.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/scanner.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/serializer.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/tokens.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
copying lib/yaml/__init__.py -> build/lib.cygwin-2.2.1-x86_64-2.7/yaml 
running build_ext 
creating build/temp.cygwin-2.2.1-x86_64-2.7 
checking if libyaml is compilable 
gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/Python-2.7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/cygdrive/c/cygwin/include/python2.7 -c build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.c -o build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.o 
checking if libyaml is linkable 
gcc build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.o -L/cygdrive/c/cygwin/lib/python2.7/config -L/usr/lib -lyaml -o build/temp.cygwin-2.2.1-x86_64-2.7/check_libyaml.exe 
skipping 'ext/_yaml.c' Cython extension (up-to-date) 
building '_yaml' extension 
creating build/temp.cygwin-2.2.1-x86_64-2.7/ext 
gcc -fno-strict-aliasing -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/build=/usr/src/debug/python-2.7.10-1 -fdebug-prefix-map=/usr/src/ports/python/python-2.7.10-1.x86_64/src/Python-2.7.10=/usr/src/debug/python-2.7.10-1 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/cygdrive/c/cygwin/include/python2.7 -c ext/_yaml.c -o build/temp.cygwin-2.2.1-x86_64-2.7/ext/_yaml.o 
ext/_yaml.c:4:20: fatal error: Python.h: No such file or directory 
#include "Python.h" 
        ^
compilation terminated. 
error: command 'gcc' failed with exit status 1 

.

$ ansible --version 
Traceback (most recent call last): 
    File "/opt/ansible/bin/ansible", line 40, in <module> 
    from ansible.utils.display import Display 
    File "/opt/ansible/lib/ansible/utils/display.py", line 35, in <module> 
    from ansible import constants as C 
    File "/opt/ansible/lib/ansible/constants.py", line 30, in <module> 
    from ansible.parsing.splitter import unquote 
    File "/opt/ansible/lib/ansible/parsing/__init__.py", line 32, in <module> 
    from ansible.parsing.vault import VaultLib 
    File "/opt/ansible/lib/ansible/parsing/vault/__init__.py", line 82, in <module> 
    from cryptography.hazmat.primitives.hashes import SHA256 as c_SHA256 
    File "/cygdrive/c/cygwin/lib/python2.7/site-packages/cryptography/hazmat/primitives/hashes.py", line 15, in <module> 
    from cryptography.hazmat.backends.interfaces import HashBackend 
    File "/cygdrive/c/cygwin/lib/python2.7/site-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module> 
    import pkg_resources 
    File "/cygdrive/c/cygwin/lib/python2.7/site-packages/pkg_resources/__init__.py", line 84, in <module> 
    packaging = pkg_resources._vendor.packaging 
AttributeError: 'module' object has no attribute '_vendor' 

ответ

11

Намного проще:

#!/bin/sh 
type apt-cyg || exit 
apt-cyg install git python-{jinja2,six,yaml} 
git clone --depth 1 git://github.com/ansible/ansible 
cd ansible 
PATH+=:~+/bin 
export PYTHONPATH=~+/lib 
ansible --version 

Результат

ansible 2.0.0 (devel 2a50957ad8) last updated 2015/09/15 21:22:17 (GMT -500) 
+1

Найдено: wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg && install apt-cyg/bin. После этого, когда я запускаю ваш скрипт, он ошибается с этим: клонирование в «ansible» ... фатальный: невозможно подключиться к github.com: github.com [0: 192.30.252.129]: errno = Отклонено соединение ./install_ansible_cygwin.sh: строка 5: CD: анзибль: Нет такого файла или каталога Traceback (самый последний вызов последнего): файл "/ Opt/анзибль/бен/анзибль", строка 39, в от анзибль. error import AnsibleError, AnsibleOptionsError, AnsibleParserError ImportError: Нет модуля с именем ansible.errors –

+0

У меня установлен apt-cyg. git clone не удалось. Мне пришлось настроить ваш скрипт, чтобы он работал над тем, чтобы получить доступную папку. Теперь я получаю другие ошибки. –

+0

Спасибо Стив. У меня все еще есть ошибки в решении выше. Обновил ваш ответ, но неважно. –

2

Хотя анзибль может работать в Cygwin, обратите внимание, что это официально не поддерживается, и это не звучит, как это будет ближайшее будущее.

Note running Ansible from a Windows control machine is NOT a goal of the project. Refrain from asking for this feature, as it limits what technologies, features, and code we can use in the main project in the future. A Linux control machine will be required to manage Windows hosts.

Cygwin is not supported, so please do not ask questions about Ansible running from Cygwin.

Взятые из Ansible Documentation

Одна альтернативы рассматривать как запуск виртуальной машины Linux на хосте Windows, и использовать его в качестве анзибля контроллера.

1

Попробуйте это apt-get удалить python-криптографию, также вам может потребоваться установить paramiko-1.10.0.tar.gz вручную.

➤ анзибль --version анзибль 2.1.0

1


    1. загрузить Cygwin
    2. на странице "Выбор пакетов", выберите "Категория" С точки зрения (сверху слева)
    3. отметьте «Devel» на «Install» (вы измените «Default» на «Install»
    4. отметьте «Python» на «Install»
    5. из «Web» выберите «wget»,
    6. из «Net» выберите «Openssh»
    7. прогресс для установки пакетов с «Next»
    8. перейдите в папку назначения, в которой вы установили cygwin
    9. щелкните правой кнопкой мыши «Cygwin.bat» и запустите в качестве администратора
    10. напишите «easy_install-2.7 pip»
    11.написать «PIP2 установить анзибль»


Вы должны также перебазировать все пакеты, чтобы решить проблему порождения, ибо это то написать:

  1. перебазироваться-триггер полного
  2. тесных Cygwin оболочки (или даже перезагрузите свои окна)
  3. снова запустите программу Cygwin и просто нажмите «Далее», пока не дойдете до конца установки, а затем Cygwin переустановит все пакеты.

После этого вы можете использовать анзибль без каких-либо проблем (я надеюсь, что так вы будете иметь такую ​​же ситуацию, как и я, как это работает для меня)

У меня ушло много дней поиска и пытается решить установка возможна на Windows 10 Home Edtion