Installing cygwin on windows xp. Installing Git on Windows from Cygwin packages. Launch Cygwin from any folder

This article will be helpful for novice Cygwin users. To begin with, we first need to answer a simple question. What is Cygwin? Cygwin is a UNIX-like environment and interface command line for Microsoft Windows... V Microsoft system Windows already there is a similar interface cmd. You can call the command line with the Win + R keyboard shortcut. But often most of the work Windows users you have to do it manually. On the other side Linux user wrote a bash script a long time ago and sits drinking beer on the sidelines of an automated workflow.

So what's stopping you from doing this in Windows too? That's right, absolutely nothing gets in the way. But this requires additional programs and libraries. Cygwin extends the standard Windows command line by automating some processes and developing programs for Linux and other systems.

Cygwin can be downloaded from the official website: Link to the 32-bit version of the program and Link to the 64-bit version of the program.

Select the required version, download and run the setup-x86.exe and setup-x86_64.exe executable files, respectively.

Installation window for the 64-bit version of the program


Select installation method window


Package selection window

The installation window for the 32-bit version of the program looks exactly the same as for the 64-bit version. The next step is the selection window. Where to install or download the program from. There are three options in total. The first option is Install from Internet (downloaded files will be kept for future re-use) installation from the Internet and the downloaded files will be kept until the next reuse... The second option is Download Without Installing, download without installation. The third option is Install from Local Directory - installation from a local directory. Because we do not have a local copy and we need to install, then we select the first option. The next window will select the installation path. Recommend to choose system disk, for example my Cygwin installation path is C: \ cygwin64. The next window is to select the path where temporary files will be stored, which will be downloaded during the installation process. I have it C: \ cygwin64 \ package. Then you need to choose how to download through a proxy or directly. The next step is to select the download repository, select any available or the default one and click Next. After clicking the button, the process of downloading the main configs will begin. Next, you can choose what to install. To select a package, you need to click Skip next to the package name. List of packages that will be useful to you:

  • gcc-core (under Devel section)
  • gcc-g ++ (in the Devel section)
  • make (under Devel section)
  • cmake (in Devel section)
  • automake (in the Devel section)
  • wget (in the Web section)
  • libiconv (in the Devel and Libs sections)
  • openssh (in the Net section)
  • nano (under Editors)
  • bash (from Base section)
  • base-cygwin (from Base section)
  • base-files (from the Base section)
  • cygwin (from Base section)
  • file (from the Base section)
  • gzip (from Base section)
  • login (from Base section)
  • mintty (from Base section)
  • openssl (from Base section)
  • run (from Base section)
  • tar (from the Base section)
  • vim-minimal (from Base section)
  • cron (from the Admin section)
  • shutdown (from the Admin section)
  • git (all packages from Devel section)

I didn’t like the background color, nor the built-in font and text color, so I customized it. With these words, I will end this article.

Tags: cygwin, for beginners

Simple and, in principle, good for everyone. Only here is the Git version, which is not the most recent, at least for now. But it is quite enough for day-to-day work with Git. If we look at the version, we see:

$ git --version
git version 1.9.5.msysgit.0

But if you suddenly need something more recent, then you can install Git from the Cygwin packages. To do this, of course, you need to install Cygwin itself. There is nothing complicated in this. Let's go here and download the installer. This is exactly installer, a not a distribution... Since it downloads all packets from the network. And besides, it must be used to update installed packages or install new ones.

And so we swing

And run the installer

Do one, two, three

In any case, if you need something later, you can download and install it. As you can see the Git version in this package 2.1.4, which is clearly fresher 1.9.5. Although 2.3.1 is already available for Linux and Mac OS X.

Just in case, I will give you a couple more fast servers to download

This one is generally just a fairy tale

Well, that's all, and it was established

We start and see that at the first start we are told where the configuration files are located:

The picture on the right shows where the user's home directory is. This is the installation folder (in my case C: \ cigwin64), then the folder home, then folder with username and there are already config files in it .bashrc, .bash_profile, .inputrc and .profile.

All terminal configuration is done in these files. I will not describe it here, since this is a large separate topic.

I will just note that the main bash settings are made in the file .bash_profile.

You can also note that the home directory will also contain the Git settings file - .gitconfig

Also, customize appearance terminal can be clicked on the terminal icon in the upper left corner and select Options.

If you need any additional packages for Cygwin, you can look for them.

After all the settings, my Cygwin terminal window looks like this. And right there, let's see the version of installed Git.

Well, here we have a full-fledged Git. Now let's (quickly) check it out on a real repository.

Everything works.

P.S. What is worth noting again is that the global and system (global, system) settings of msysGit and Git installed from Cygwin are stored in different places, and do not interfere with or overlap each other, in my opinion this is convenient, since all Windows tools try to write their settings to the global settings file.gitconfig and this can sometimes create confusion and convenience.

Developing cross-platform apps is not easy. Especially it is not easy thanks to Windows, in which everything is not like people. Here you have neither a normal terminal, nor normal console utilities, nothing at all! Having faced this problem again, I decided to try Cygwin again. And you know, it turns out that it really makes Windows something that you can almost use!

You can download the Cygwin installer from here. In fact, this is not so much an installer as a package manager, which, when launched, just asks which packages you would like to install. Guys! Batch manager! For Windows! The installer creates a cache in the directory from which it will be launched. Therefore, before starting, it is better to create some special daddy on the desktop and put the installer in it.

What packages, in my opinion, should be delivered:

  • openssh- mastkhev;
  • inetutils, bind-utils, ping, nc and nc6- mastkhev;
  • wget, curl- mastkhev;
  • python and / or python3- I think it's a must;
  • vim, gvim- for editing small files will not be superfluous;
  • diffutils, pwgen, unzip, rzync- let them be just in case;
  • gcc and / or clang, cmake, gdb- if needed;
  • screen, tmux, mc- for lovers;
  • git- under very big question, see below;

Note! To install pip in Cygwin, check the box next to the python-setuptools and / or python3-setuptools package. After installing in the terminal say:

easy_install-2.7 pip

easy_install-3.4 pip

... whichever version or versions of Python you have installed.

So, after installing Cygwin, you can open a terminal:

Guys! A normal terminal that resizes allows you to copy and paste text, and that's it! For Windows! With all the familiar and familiar commands id, ls, pwd, cat, ssh, scp, and others. With a human environment - .bashrc, ~ / .ssh / config, and so on. Plus, unlike the infamous PowerShell hack, Cygwin doesn't drag the .NET Framework with it. We can even open multiple terminals and switch between them using the Ctrl + Tab combination. It's almost like tabs! It's clear that the good old Alt + Tab also works.

Above, I did not recommend installing Git, and here's why. The fact is that it slows down noticeably in Cygwin. recommend to run the commands:

git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256

But this, unfortunately, does not completely solve the problem. So, on a large project, the git status command can run for 20 seconds. On Linux, the command is executed instantly on the exact same repository.

Have you ever had to use the command line after linux Windows string? Yes, for me. Very unusual. Many teams have different names. For example, the analogue of ls on Windows is dir. The local interpreter has a different style of passing arguments. And many of the possibilities that Linux utilities provide are simply not there. How to get a similar linux environment in windows? This can be done by installing Cygwin.

Getting to know the deployed system

First, cygwin has its own terminal emulator installed by default, which is more convenient to work with than with the Windows command line.

Here we have our first problems. As you can see windows utilities, including cmd.exe print text in oem-866, and cygwin emulator reads text in utf-8. If you switch the encoding to the 866 code page, the consequences of this action are even worse.


cygwin interpreted the Russian-language name in unicode encoding as a string in 866 encoding and eventually decided to create a new directory / home / ╨Ф╨╝╨╕╤В╤А╨╕╨╣. So it's better to leave everything as it was and, if possible, get by with the cygwin utilities. In case you need to start a command shell without a terminal emulator, run the Cygwin.bat batch file.
V this case, cygwin is installed in the C: \ cygwin64 \ folder. The cygpath utility will help us find out the paths from unix-path to windows are converted.
$ cygpath -w `pwd`
C: \ cygwin64 \ home \ Dmitry

$ cygpath -w /
C: \ cygwin64

$ cygpath "C: \ cygwin64"
/

$ cygpath "C: \ cygwin64 \ home \ Dmitry"
/ home / Dmitry
And how to access the C: drive if all paths are translated to C: \ cygwin64 \.
It's simple. The / cygdrive directory contains mount points that correspond by name to windows volumes.
$ cygpath "C: \"
/ cygdrive / c

$ cygpath -w / cygdrive / c / somedir
C: \ somedir
Cygpath also successfully translates calls to this mount point to Windows paths.
By the way, the existence of a utility like cygpath shows why with cygwin you should only use its utilities whenever possible. If, you need to start java VM, and it only understands Windows paths, you will have to convert the cygwin path at startup:
$ java -jar `cygpath -w" /opt/some.jar "`
It follows from this that many linux scripts cannot be simply taken and run in windows. Sometimes you need to try to move the script. Moreover, not all command line utilities will work.

More possibilities

SSH

You can put an OpenSSH client and server - this will allow you to get remote access to a bash shell, from another computer, or even from a phone, for example using JuiceSSH. You will also get remote access to your files using the SFTP protocol (although on Windows it is easier to share a directory accessible via SMB).

Programming

The kit includes well-known compilers such as Clang or GCC, interpreters for Python, Perl, PHP, Ruby, etc. You can build POSIX-compatible programs for Windows.

Text editors

Interactive editors - vim, nano, emacs.
Non-interactive editors suitable for use in scripts are sed, awk.

Outcome

If you miss the power of linux in Windows, you might want to install this thing yourself.