Install Cygwin with make, gcc, g++ and tcl.
(If you use apt-cyg you can install them with apt-cyg install make, apt-cyg install gcc-core and apt-cyg install tcl
Download Redis tar.gz package, unpack it.
Edit deps/hiredis/net.c and add following line before include directives:
#define _POSIX_C_SOURCE 200112L
and add the following lines just after the include directives:
/* Cygwin Fix */
#ifdef __CYGWIN__
#define TCP_KEEPCNT 8
#define TCP_KEEPINTVL 150
#define TCP_KEEPIDLE 14400
#endif
Run the following script:
cd deps/
make lua hiredis linenoise
cd ..
make
# Some tests fail, but mainly working which is suitable for development environments
make test
make install
# Check redis version
redis-cli --version
# Run redis server as deamon
redis-server &
# Test redis
redis-cli PING
# or
redis-cli -h localhost PING
Thanks to winse, see this blog entry and pcan https://gist.github.com/pcan/44cb2177647f029d457facb31da0883f).
I found another problem if you are using sentinels. You need to change a line in src/sentinel.c:
Change that to O_RDWR because the following fsync will fail on a read-only file descriptor. cygwin ultimately calls the Windows FlushFileBuffers API call that requires GENERIC_WRITE access or it fails with a Permission Denied error.