As described on the Cygwin wiki page, Cygwin is free. It's a Unix-like environment and command-line interface for Microsoft Windows. What's most important about Cygwin is that it comes with an X11 server which will allow you to run an X11-based application via ssh on a remote machine with a graphical user interface that can be displayed on your laptop.
To install and set up Cygwin, there are basically 3 steps:
There are two ways to do this. The quick way is to download a ZIP file that contains all the downloaded Cygwin setup file from the web. The problem with this approach is that this version was created on 3/10/2023 and this may be out-dated. If you would prefer to start from scratch, please follow the Download Cygwin From Scratch instructions below. Please note that this can take over an hour to download all the files!
If you are okay with running a pre-downloaded 3/10/2023 version of Cygwin (which should work just fine), then please download "Cygwin-Setup-2023-03-10.zip" from either of the following two places:
To make things easier to manage, let's create a folder on your Desktop and name it "Cygwin Setup". Then point your browser to cygwin's home page, click on the setup-x86_64.exe link to download setup-x86_64.exe. Save setup-x86_64.exe into the Cygwin Setup folder on your desktop. (I'm assuming that your Windows 10 machine is a 64-bit machine. If you have a 32-bit machine, please download and run setup-x86.exe instead.)
Cygwin will need at least 2GB of disk space to download and an additional 4GB of disk space to install. If you don't have more than 2GB of free disk space on your C: drive, you need to create the "Cygwin Setup" folder somewhere else.
Go to your Desktop, click open the Cygwin Setup folder and click on setup-x86_64.exe. If you get a screen asking you about permissions, please give permission to run the setup program. Click on the Next button in the Cygwin Setup window. You should see the following screen:
Since you will be download a lot of files and you may lose connection to the Internet, it's best to do this in 2 steps. First time you run setup-x86_64.exe, you should simply download all the files you need. When that's done, re-run setup-x86_64.exe and install Cygwin from the files you have downloaded. I think this is the more reliable way to go. So, click on the "Download Without Installing" radio-button and click on Next.
You will be asked to select a local package directory. For now, just keep the default and click on the Next button.
You will be asked to select your Internet connection. Unless you have some unusual setup, just keep the default and click on the Next button.
You will be asked to choose a download site. Select a download site from the list and click on Next. My favorite is http://cygwin.osuosl.org, but you can choose any other site. It can take a few seconds to download some initial files. Then you will see the following screen (or a full-screen version of it):
The items inside the "Net" category are sorted alphabetically. Scroll the window down further (for quite a bit) and look for "openssh" in the "Net" category. When you find it, you will get the following screen:
Click on the icon in the "New" column to the left of "Skip" once and the screen will change to the following: (In newer versions of Cygwin, this icon is replaced with a drop down menu.)
In the "New" column, it tells you which version of "openssh" will be included in your download (you may see a different version than what's shown above). By default, the checkbox in the "Bin" column is checked and the checkbox in the "Src" column is unchecked so that you will download just the binaries and not the source.
Also look for the "Editors" category and find a package called "nano" and select it for installation (screen shots not provided).
In the "GNOME" category, find the "alacarte", "gnome-ssh-askpass", and "gnome-terminal" packages and select them for installation (screen shots not provided).
Now scroll all the way down so that you can see the "X11" category. You will get a screen that looks like the following:
Now you are ready to download Cygwin. Click on the Next button. The next screen you will see asks you to confirm changes. Just click on the Next button. At this point, Cygwin Setup will download the Cygwin package to a subfolder inside the Cygwin Setup folder on your desktop. How long this would take depends on the speed of your machine and the speed of your Internet connection. If you get a popup window saying that there is an error and you can retry, just click on the Retry button (don't skip it or you have to reinstall everything). When download is completed, your screen should look like the following:
Click on the Finish button to close Cygwin Setup.
Now that you have Cygwin downloaded. The next step is to install it. Go to your Desktop, click open the Cygwin Setup folder and click on setup-x86_64.exe. (If you are running Windows 10/11 Professional, you should right-click on setup-x86_64.exe and select "Run As Administrator", if you know the admin password.) Click on the Next button in the Cygwin Setup window. Click on the "Install from Local Directory" radio-button and your screen should look like the following:
Click on the Next button to proceed with installation. You will see a screen that looks like the following:
You can change the installation directory if you'd like. We will keep the default and install Cygwin into your C: drive. Click on the Next button to proceed.
You will be asked to select a local package directory. The default value is the Cygwin Setup folder you started with and that should be the correct place. Just click on the Next button to proceed.
You will see the Select Packages screen that you have seen before, except that it's displaying the Categories already. At this point, you need to, again, select openssh and X11 to be installed. So, you should do exactly what you did before. Scroll down to find the "Net" category. Click the "+" icon to open the "Net" category. Scrool further down to find openssh inside the "Net" category and make sure that it's selected for installation (i.e., it doesn't show "Skip" in the "New" column). Click the "+" icon to open the "Editors" category. Scrool further down to find nano inside the "Editors" category and make sure that it's selected for installation (i.e., it doesn't show "Skip" in the "New" column). Then scroll all the way down to look for the X11 category. It's probably showing "Default" just like before. Click on the icon to the left of "Default" once and "Default" should change to "Install" like before. Also, make sure that you will be installing "nano", "alacarte", "gnome-ssh-askpass", and "gnome-terminal". Now you are ready to install. Click on the Next button to install Cygwin. This can take a long time since it's copying and setting up a lot of stuff.
When installation is about to finish, you may get a popup window saying that you have "Postinstall script errors". Please read what's in the window. If it says that these do not necessarily mean that it will cause packages to fail, then it's okay to proceed. If there are more serious errors, you may have to reinstall everything since some important packages may be broken.
When installation is done, you will see the following screen:
You should check both checkboxes and then click on the Finish button to close Cygwin Setup.
After installation has completed, you should have a new icon, labeled "Cygwin64 Terminal", on your desktop. If you double-click on it, the Cygwin Terminal program will run and you will see something like the following (your user namd and directory name will most likely be different):
You also need to start the X11 server if you need to ssh to another machine and be able to run programs that have a graphical user interface. All you need to do is to click on your Windows' Start Menu, scroll down to the C section and look for Cygwin-X folder, click on it, and look for the "XWin Server" icon. It may look something like the following:
Drag the "XWin Server" icon onto your desktop and you are all set! If you cannot find the "XWin Server" icon in the Start Menu, look for it in The "ProgramData\Microsoft\Windows\Start Menu\Programs\Cygwin-X" folder in your C: drive and copy "XWin Server" to your desktop.
Another way is to click on Windows' Search and enter "XWin". When you see the "XWin Server App', right-click on it and select Pin To Taskbar. This way, you can easily find the XWin Server icon in the taakbar.
To start the X11 server, just click on the "XWin Server" icon on your desktop or in your taskbar. (If you are running Windows 10/11 Professional, you should right-click on the "XWin Server" icon and select "Run As Administrator", if you know the admin password. You should do it this way every time you want to start the X11 server.) In a few seconds, you should get a couple of icons in your system tray that looks like the following:
The left icon (with a green X) is the "X Applications Menu" and the right icon (with a black X) is the "Cygwin/X Server". If you click on the "X Applications Menu" and click on the "System Tools" submenu, you can see that there are a bunch of terminals available to you. Selecting the "Cygwin Terminal" there is the same as running the "Cygwin64 Terminal" on your desktop.
One down side of the "Cygwin64 Terminal" is that it's not a tabbed terminal program. If you would prefer to use a tabbed terminal, you can run the "gnome-terminal" program. You can run "gnome-terminal.exe" from the "Cygwin64 Terminal", but that's kind of inconvenient. Here's what you can to to be able to launch "gnome-terminal" from the "X Applications Menu". Click on the "X Applications Menu" and click on the "Preferences" submenu and select "Main Menu". This allows you to edit the "X Applications Menu". Click on System Tools in the left panel and let's change the last menu item to run "gnome-terminal". The last menu item is "xterm". Click on it and then click on the Properties button. Change Name to "Gnome Terminal", change Command to "gnome-terminal", and change Comment to "Gnome Terminal". Click on the OK button to save changes. With the "Gnome Terminal" selected, you can click on the Move Down button to move it all the way down to the bottom of the System Tools menu. Click on the Close button to save everything. From now on, if you need to run a "terminal" program, you just need to click on the "X Applications Menu" in the system tray, then click on the "System Tools" menu, and then click on "Gnome Terminal" to run the "gnome-terminal" program.
You will also get a little icon at the top of your screen. That program is called "trayer" and it's showing what kind of keyboard layout you have. If you want to get rid of it, you can open a terminal program and open a text editor (such as "nano") to edit the "/etc/X11/xinit/startxwinrc" file and replace "trayer" with a non-existant file name (such as "_x_trayer_x_").
If you cannot save the updated "/etc/X11/xinit/startxwinrc" file due to permissions problem, you should do:
cp /etc/X11/xinit/startxwinrc ~/.startxwinrcand edit "~/.startxwinrc" and make the same change.
Finally, to shutdown your X server, you can click on the "X Applications Menu" and click on "XDG Menu" and select "Exit".