Windows, XAMPP, and CYGWIN

I’ve really been geeking-out lately setting up a couple virtual servers for recreation development. I’ve had my Linux VPS up and running for quite some time, with all the bells and whistles I could ever want. Until recently I have never really felt the necessity for a Windows server. Of course when I finally did, I gave myself a pat on the back for deciding to go virtual a long time ago. I simply created a new virtual machine, installed Windows, and went to town…

The first thing to mention is that I am a novice when it comes to system administration on Windows. So as any Linux enthusiast would, I went looking for some open-source help. Of course a friend of mine showed me that XAMPP for Windows works pretty pain-free and runs native, which is perfect for a testing environment. So I downloaded and installed, and everything went smooth. Then that same friend gave me a great article regarding XAMPP security. I went through the pointers, and locked things down, and still my hopes were even higher. I even set up the module mod_userdir to point to a public folder within my Windows user’s account directory to keep all my files clean and separate… still good.

Now… the complicated part. I really missed remote management with this server. It is the only Windows machine I plan to maintain, and I simply hate installing anything on my other machines in order to communicate with it. I would rather install software on the Windows machine to communicate with everything else. Here is where CYGWIN comes in. You can go to that link to learn more, but in summary, it is a Linux environment built to run within Windows. This all sounds great in terms of possibilities, but it is another unnecessary software layer since I have already installed and configured everything for XAMPP.

So I decided only to pick and choose. I only wanted secure remote management that I was comfortable with, without learning anything about yet another protocol. Basically I wanted SSH, which comes as a package with CYGWIN. To install it with only the necessities, I followed this walkthrough. Be careful though. That link is old, and there were some differences in the version of CYGWIN I set up versus the one described there. Don’t worry too much though, the steps are pretty similar, and still relevant in my opinion.

Once I had CYGWIN setup, with the SSH Windows server running. I tried to login via SSH from my Linux machine and SUCCESS. Then from my Mac OSX machine… SUCCESS. Just one problem was realized at this point, that could have meant a “do-over”. In order to gain a Linux environment on your Windows machine, CYGWIN is a closed environment. This means that itself, and all of its dependencies have no real communication with the overall Windows file system it is running on. One big plus though is that it uses real Windows user accounts.

For the file system problem, I was stuck trying to fool XAMPP into using the home directory of my CYGWIN user instead of my actual Windows home directory. This just wasn’t working out, and I could not find anything documenting somebody having a similar problem. I was stuck there for a little while, and about to abandon either XAMPP or CYCWIN for just one almost perfect platform. Then… it dawned on me. Why not try a symbolic link? Windows actually has something in this regard that POSIX systems do not. They are called Directory Junctions, which are basically like hard links for directories.

So this is my simple solution to have CYGWIN and XAMPP communicate with each other via the file system. I created a directory junction of my Windows user home folder within the CYGWIN home folder, and viola! Everything worked as I had hoped. I have XAMPP for apache and the mod_userdir functionality, as well as all of its other great and simple to configure add-ons, and I have a full-blown SSH server with real SFTP support for that same file structure. Also with CYGWIN, I have the option for just about any other common Linux package I may want in the future.

The end.

I hope this article was of some use to you. I also just wanted to send a thank you to all the authors of the links I have posted here, as well as my friend landykos for the XAMPP pointers.


Posted

in

by

Tags:

Comments

4 responses to “Windows, XAMPP, and CYGWIN”

  1. Landy Avatar

    Hey man, sounds like you got it all figured out. Now it looks like I need to follow your pointers and get all this working on my box..

    🙂

    Looks fun though and not too much trouble.

    1. Landy Avatar

      Did you look at this while you were setting this up?
      http://www.itefix.no/i2/copssh

      1. jimisaacs Avatar

        I saw that name "copSSH", but no I didn't see the link. I wander what it is? It sounds like it installs exactly what I did, but they call it copSSH. I have openSSH sunning for CYGWIN, what would this do for me?

  2. Conrad Avatar
    Conrad

    perfect solution! exactly what I was looking for. I used to work with Ubuntu and Fedora for a long time and need to write symfony2 based websites on windows 7 now – but got really annoyed from the windows command line.. so cygwin was my solution for the terminal.. but I had a access denied error when pointing the virtual host directory to my cygwin/home path.. this is exactly what I was looking for. many thanks!

Leave a Reply

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