This article will tell you how to install Cygwin on windows correctly and successfully.
1. Install Cygwin On Windows Correctly Steps.
- Go to cgwin.com to download the Cygwin installer.
- Double click the installer to open the install window.
- Click the Next button to go to the Choose A Download Source wizard dialog.
- There are 3 radio buttons that you can choose in this dialog.
- 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.
- 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.
- 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.
- 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.
- When the wizard goes to the Choose A Download Site page, you can choose one download mirror site in the Available Download Site list.
- 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.
- 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.
- Select the download site that you just added to the list, then click the Next button.
- Now you can see the Cygwin packages download progress on the next wizard page.
- 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.
- There are 6 dropdown items ( Full, Pending, Up To Date, Not Installed, Picked, Category ) in the View dropdown list.
- When you select a different drop-down item, it will display the different packages in the list below it.
- When you select Full, it will list all the Cygwin packages in the list.
- When you select Pending, it will list all the packages that will be installed.
- When you select Up To Date, it will list all the packages that have been installed and can be updated.
- When you select Not Installed, it will list all the packages that are not installed.
- When you select Picked, it will list all the packages that are picked to install from the list.
- When you select Category, it will list all the Cygwin packages by category.
- 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.
- 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.
- 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.
- After you successfully install Cygwin on Windows, you can configure it to run Linux command on Windows DOS console.
- Add the Cygwin bin folder path (for example C:\cygwin64\bin) to the system environment variable Path‘s value.
- 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.
- If you want to install additional Cygwin packages ( for example OpenSSH ) after installing Cygwin, you can follow the below steps.
- Double-click the Cygwin installer program to run it again.
- 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.
- If you need to install multiple packages, you need to install them one by one.
- Click the Next button in the following 2 wizard dialog windows.
- In the Select Local Package Directory wizard dialog window, browse to select the downloaded Cygwin packages folder.
- 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.
- Select the Not Installed item in the View drop-down list.
- Input the keyword openssh in the Search input text box, then you can find the openssh package in the list below the search box.
- 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.
- Click the Next button in the current and following wizard window.
- 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 [[email protected]]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.
- It is similar to installing Cygwin packages, you need to use the Cygwin installer to do this.
- 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.
- 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.
- And input the search keyword openssh in the Search text box, then you can find the installed OpenSSH in the list below it.
- In the openssh row’s Current column, it displayed the currently installed openssh version.
- Click the down arrow icon in the openssh row’s New column, and select the Uninstall item from the dropdown list.
- Click the Next button in the current and following windows.
- Click the Finish button in the last dialog window.
- 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.
- 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.
- 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.
- Right-click the Windows bottom toolbar, then click the Task Manager menu item to open the Windows Task Manager window.
- Then select the Cygwin process and then click the End task button to terminate the Cygwin process.
- 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 $
- 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 $
- Now the Cygwin crash error will be fixed.