As described on the Cygwin wiki page, Cygwin is free. It's a Unix-like environment and command-line interface for Microsoft Windows. For our class, we use Cygwin as an alternative to X-Win32. The problem with X-Win32 is that it's not free. USC has a licence for you to run X-Win32. When you are on campus, it's no problem to run X-Win32. But when you are at home, in order to run X-Win32, you have to run a Virtual Private Network (VPN) so your laptop/desktop would appear on the USC campus network. Also, once you have graduated from USC, if you want to continue to use X-Win32, you have to buy a license for yourself.
Below are the steps to install and setup Cygwin on Windows 10.
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 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).
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 takes 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 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. 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.
To start the X11 server, just click on the "XWin Server" icon on your desktop. (If you are running Windows 10 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.
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 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".