Install Cygwin Go to and download setup-x86_64.exe Run it • Select ‘Install from Internet’ • Choose root directory (default) • Choose pacakage directory to store installation files • Use System Proxy Settings • Select any mirror site to download In ‘Select Packages’ • Select Category dropdown and search for lynx • Go to All -> Web -> lynx: A text-based Web Browser • Select latest version • Click next to complete installation 2. Install apt-cyg This is a package manager for cygwin To install: • lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg • install apt-cyg /bin 3. Switch between mac and windows boot camp. Cygwin Tutorial - Integrating Cygwin into Console2 for Windows Posted by bryan_lor on January 9, 2015 I use Cygwin quite often, since I do quite a lot development on Windows, but I like having multiple tabs opened when having to use any type of CLI. ![]() Install dependencies for ansible To install altogether • apt-cyg install binutils curl gcc-core gmp libffi-devel libgmp-devel make python python-crypto python-openssl python-setuptools python-devel git nano openssh openssl openssl-devel You can also install individually by using • apt-cyg install or by using the installation GUI 4. Install Ansible To install • easy_install-2.7 pip • pip install ansible -vvv • Here, the -vvv is used in case the install seems too slow. It will show you if everything is still working. Test ansible To test installation • ansible • Should receive list of options Some configuration Cygwin comes with some strange default settings, particularly if using vi or vim. Open a.virc file. • vi ~/.virc Type in set nocompatible set backspace=2 Run a playbook with Ansible Make a new directory to test ansible with a simple playbook. Mkdir ansible-lab cd ansible-lab Ansible needs some configuration to work on a Windows machine. Our Windows machine is called the ‘control’ machine. Ansible does not officially support this. Create an ansible configuration file. Vi ansible.cfg Copy and paste the following into the file. [ssh_connection] ssh_args = -o ControlMaster=no Now we will create our ansible playbook to test. Vi playbook.yml Copy the following into the file. - hosts: all sudo: yes tasks: - name: install apache2 apt: name=apache2 update_cache=yes state=latest Bring up a virtual machine We need a virtual machine to run this against. For this we will use a Vagrant box. Don’t worry if you have not used Vagrant before. It is an easy way of installing virtual boxes on your machine and managing them. We need a Vagrantfile to bring up our virtual machine. Vi Vagrantfile Copy and paste the following. Vagrant.configure('2') do| config| config.vm.box = 'bento/ubuntu-18.04' config.vm.network 'private_network', ip: '192.168.33.10' end This will bring up a ubuntu virtual machine to run our ansible script against. To bring up your virtual machine, make sure you are in the same directory as your Vagrantfile and type vagrant up Depending on your connection, this may take a little while to boot up. Once your machine is booted (you can check if it was successfully booted by typing vagrant status), you need to make sure your control / Windows machine can connect to it. Setup ssh connection On your Cygwin terminal, generate an ssh -key. Ssh-keygen Keep pressing enter until it is finished. Print out the.pub file where it saves the key. For example, mine looks like the following. Yours will be in the.ssh folder also. Cat /home/abcd/.ssh/id_rsa.pub Copy the value that is printed out. Now you need to go to your vagrant machine. Vagrant ssh vi.ssh/authorized_keys Go to the end of the file, go to the next line (by pressing enter) and paste in your key from the id_rsa.pub file Exit your vagrant machine. Exit Test your ssh connection with the following. ![]() Ssh [email protected] You should be able to login to the virual machine without any prompt or failure. Exit the machine once again. Exit Run your ansible playbook Make sure you are in the same directory as your ansible script. Ideally, you have your Vagrantfile, playbook.yml and ansible.cfg all in the same directory. Ensure ansible is ready to go. Ansible-playbook --version Now type the following. Ansible-playbook -i [email protected], playbook.yml Your tasks should appear in a list. Once finished, the PLAY RECAP should have ok=2 and changed=1. Congrats, you have just run your first ansible playbook! • Download this, save it in your 'Cygwin Home' (see ): C: Cygwin Home username Note that a file extension of.cpp means 'C Plus Plus'. Sometimes '.cc' is also used. • Run cygwin • Type ' ls' and enter, or ' ls -l' and enter. These should show the ' hello.cpp' file. • Type the following command, and press enter: g++ hello.cpp -o hello This should take a little while, but no error messages should appear. It tells the GNU C++ compiler (g++) to take the input file hello.cpp and make an output file called hello.exe (the -o is for output).
0 Comments
Leave a Reply. |