How To Install Cygwin On Windows Correctly

This article will tell you how to install Cygwin on windows correctly and successfully.

1. Install Cygwin On Windows Correctly Steps.

  1. Go to cgwin.com to download the Cygwin installer.
  2. Double click the installer to open the install window.
  3. Click the Next button to go to the Choose A Download Source wizard dialog.
  4. There are 3 radio buttons that you can choose in this dialog.
  5. The first choice is Install from Internet, in this mode, the installation will start directly from the Internet, which is suitable for fast network speed.
  6. The second choice is Download Without Installing, in this mode, it will download the Cygwin component from the internet only, but do not install it at once.
  7. The third choice is Install from Local Directory, this mode corresponds to the second mode and can be used to install the Cygwin components after it has been downloaded.
  8. After choosing one choice click the Next button to go to the Select Root Install Directory wizard page, you can use the default settings and click the Next button in the current and the following wizard pages.
  9. When the wizard goes to the Choose A Download Site page, you can choose one download mirror site in the Available Download Site list.
  10. If there is no site on the list, you can go to the Cygwin Mirror List page to get one mirror URL ( for example https://mirrors.163.com/cygwin/ ) that is near to you.
  11. And then copy & paste the mirror site URL to the User URL input box, and click the Add button to add it to the Available Download Site list.
  12. Select the download site that you just added to the list, then click the Next button.
  13. Now you can see the Cygwin packages download progress on the next wizard page.
  14. When the Cygwin packages download progress is completed, it will open the Select Packages window, and you can select the packages that you want to install.
  15. There are 6 dropdown items ( Full, Pending, Up To Date, Not Installed, Picked, Category ) in the View dropdown list.
  16. When you select a different drop-down item, it will display the different packages in the list below it.
  17. When you select Full, it will list all the Cygwin packages in the list.
  18. When you select Pending, it will list all the packages that will be installed.
  19. When you select Up To Date, it will list all the packages that have been installed and can be updated.
  20. When you select Not Installed, it will list all the packages that are not installed.
  21. When you select Picked, it will list all the packages that are picked to install from the list.
  22. When you select Category, it will list all the Cygwin packages by category.
  23. Now you do not need to do any more choices, it will install the default packages, you can see those default packages by selecting the Pending item from the dropdown list.
  24. Click the Next button in the following wizard windows, it will install the selected packages, and click the Finish button on the last wizard window to complete the Cygwin installation.
  25. Now you can click the Cygwin64 Terminal icon to start a UNIX style shell window to run Unix/Linux command on Windows.

2. How To Run Linux Command In Windows DOS Console.

  1. After you successfully install Cygwin on Windows, you can configure it to run Linux command on Windows DOS console.
  2. Add the Cygwin bin folder path (for example C:\cygwin64\bin) to the system environment variable Path‘s value.
  3. Now open a Windows dos window, and you can run the Linux command such as ls, pwd in it.

3. How To Install Additional Cygwin Packages After Install Cygwin.

  1. If you want to install additional Cygwin packages ( for example OpenSSH ) after installing Cygwin, you can follow the below steps.
  2. Double-click the Cygwin installer program to run it again.
  3. In the Choose A Download Source wizard dialog, select the Install from Local Directory radio button. If you can not find the package in your local directory, you should select the Install from Internet radio button to download the packages from the internet.
  4. If you need to install multiple packages, you need to install them one by one.
  5. Click the Next button in the following 2 wizard dialog windows.
  6. In the Select Local Package Directory wizard dialog window, browse to select the downloaded Cygwin packages folder.
  7. If you do not change the download directory when you install Cygwin for the first time, then you do not need to do anything, click the Next button will go to the Select Packages dialog window.
  8. Select the Not Installed item in the View drop-down list.
  9. Input the keyword openssh in the Search input text box, then you can find the openssh package in the list below the search box.
  10. Click the down arrow icon in the New column of the openssh row, and select an OpenSSH version ( for example 8.8p1-1) from the dropdown list.
  11. Click the Next button in the current and following wizard window.
  12. Now when you open the Cygwin64 Terminal & run the command ssh in it, you will get the below message, this means OpenSSH has been installed successfully.
    $ ssh
    usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
               [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
               [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
               [-i identity_file] [-J [user@]host[:port]] [-L address]
               [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
               [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
               [-w local_tun[:remote_tun]] destination [command]
    

4. How To Uninstall & Update A Cygwin Package.

  1. It is similar to installing Cygwin packages, you need to use the Cygwin installer to do this.
  2. Double click the Cygwin installer to run it, and click the Next button on each of the wizard windows until you go to the Select Packages dialog window.
  3. If you want to uninstall a Cygwin package such as openssh, you can select the Up To Date item in the View drop-down list, if you want to update a Cygwin package, you can select the Pending item.
  4. And input the search keyword openssh in the Search text box, then you can find the installed OpenSSH in the list below it.
  5. In the openssh row’s Current column, it displayed the currently installed openssh version.
  6. Click the down arrow icon in the openssh row’s New column, and select the Uninstall item from the dropdown list.
  7. Click the Next button in the current and following windows.
  8. Click the Finish button in the last dialog window.
  9. Now when you run the command ssh in the Cygwin64 Terminal, you will get the bellow result.

5. How To Fix The Crash Problem When Opening Cygwin In Win10.

  1. After using Cygwin in win10 for a period of time, the compilation speed becomes very slow and often gets stuck. You need to hit enter to continue compiling the next file.
  2. In addition, there will be an error report after opening Cygwin. It is useless to reopen it many times. The reason is not very clear. Finally, I found the following solutions on the Internet.
  3. Right-click the Windows bottom toolbar, then click the Task Manager menu item to open the Windows Task Manager window.
  4. Then select the Cygwin process and then click the End task button to terminate the Cygwin process.
  5. Open a dos window, and go to the Cygwin installed directory’s bin folder and run the command ash.
    C:\Users\jerry-zhao>cd C:\cygwin64\bin
    
    C:\cygwin64\bin>
    C:\cygwin64\bin>
    C:\cygwin64\bin>ash
    $
  6. Run the command /bin/rebaseall in the ash prompt. Be careful to enter the complete command path. If you only enter rebaseall, you will be prompted that the command cannot be found, and the command can only be executed under ash, not Cygwin.
    C:\cygwin64\bin>ash
    $
    $ rebaseall
    ash: 2: rebaseall: not found
    $
    $ /bin/rebaseall
    $
  7. Now the Cygwin crash error will be fixed.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.