Web Server @ Home – Installing cygwin

Web Server @ Home is where all this discussion started. This is follow up to that discussion. Please read it if you want to know motivation behind this discussion.

Cygwin is a Linux-like environment for Windows. According to Cygwin Official Site (http://www.cygwin.com), GNU + Cygnus + Windows = cygwin. Following information is taken from cygwin official site, as it is,

Cygwin is a Linux-like environment for Windows. It consists of two parts:

  • DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.
  • A collection of tools, which provide Linux look and feel.

What Isn't Cygwin?

  • Cygwin is not a way to run native linux apps on Windows. You have to rebuild your application from source if you want it to run on Windows.
  • Cygwin is not a way to magically make native Windows apps aware of UNIX ® functionality, like signals, ptys, etc. Again, you need to build your apps from source if you want to take advantage of Cygwin functionality.

Cygwin Installation is presented here with emphasis on web server requirements.

Please note that do not install Apache using cygwin setup, because we want to build Apache for Windows Native Machine because of performance reasons. Also I am going to install SSH server to facilitate remote server management. FTP server is not included here since there is no need of FTP (Local Machine) but can be installed by following similar steps, presented here.

cygwin Installation on Windows XP

  • Locate following icon cygwinicon.gif on cygwin.com and click on it to download.
  • Choose Installation Type
  • Select Install from Internet.
  • Choose Installation Directory – As per your requirement
  • Select Install For All Users and select Unix as Default Text File Type.
  • Select Local Package Directory. The folder you specify here is the location where the downloaded installation files will be saved. Enter the path of your choice highly recommended.
  • Select Connection Type – Same setting as your browser. If your antivirus/firewall program will pop up after you click Next, to check if you want to allow cygwin_setup.exe to access the Internet. Yes, that's exactly what we want!
  • Choose Download Site/Mirror, nearest to your location
  • Select Packages – Click to select full view. You only need to select following additions to the by-default selected packages
  • cygrunsrv (category Admin)
  • ImageMagick, GD – required by Gallery 2
  • Misc
  • apr, aprutil, rebase, minires, bison, cvs, flex, gcc, grep,libtool1.5, libxml, autoconf, autossh, binutils, libdb4.2-devel
  • libxml2, libxml2-devel
  • make, openssh, perl, readline, rsync, tar, gzip, vim, whois, patch
  • Select Apache2 Src – First Select Apache2, then select src and unselect binary. (You'll see few boxes along with version number. Select appropriate box)
  • Click Next
  • Now you can take a break and drink some coffee while the files are downloaded and installed.
  • Install icons as per your wish
  • Now back to work… Check if installation is okay – perform quick sanity check
  • Open Bash Shell by going to
  • Start->All Programs->cygwin
  • Click on Desktop Icon
  • By clicking on Icon in  install directory
  • A Blank window with prompt will pop up
  • Run following & check these exists
  • `which ls` , `which vi`, `cygrunserver`, `which gunzip`, `which tar`
  • Any package missing can be installed any time, even later. But it may cause more pain in detecting if something is broken
  • Now lets setup SSH server
  • typessh-host-config
  • When the script asks you about "privilege separation", answer yes
  • When the script asks about "create local user sshd", answer yes
  • When the script asks you about "install sshd as a service", answer yes
  • When the script asks you for "CYGWIN="     your answer is ntsec
  • Start sshd service by 1. net start sshd 2. cygrunsrv  –start  sshd or from Windows XP service Panel
  • Test your SSH server by trying SSH from different screen/computer and login to this machine. Please note that firewall/router needs to be configured. Please allow port 22 for SSH connection to work
  • Username, Machine/Host Name & Passwords are windows' ones.
  • Setting up cygserver – It is very much required else your apache server will not work.
  • Please run following command to install it as service
  • cygrunsrv -I cygserver -d "CYGWIN cygserver" -p /usr/sbin/cygserver
  • You can start it same as any other service (Outlined in SSHD service)

Now we are done with cygwin basic installations. I want to acknowledge contribution of following sites

  • http://www.cygwin.com/ml/cygwin/2005-12/msg00093.html
  • http://www.sitepoint.com/article/use-postgresql-php-windows
  • http://httpd.apache.org/docs/1.3/cygwin.html#down

And lets not forget, usage of any information presented here is at user's own risk. This site and author are not responsible for any damage caused.

Next: Installing Apache.. Stay tuned…

Leave a Reply

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