前言

记得大学的时候就曾经使用过Cygwin,可惜当时没有发现她的美,我相信现在大多数朋友可能会更加倾向于使用Git或者干脆直接使用虚拟机以及原生Unix。不过对于刚进入Linux的世界新人来说,使用Cygwin可以让你在Windows下面练习Linux的Bash,以及常用工具,而不需要安装Linux,也不用担心Windows被破坏,给每个人多一种选择也蛮好的,最后再一次感谢163为开源做出的努力。

Get that Linux feeling - on Windows


更新历史

2015年07月24日 - 增加在Cygwin里安装使用dig实践
2015年07月21日 - 初稿

阅读原文 - https://wsgzao.github.io/post/cygwin/

扩展阅读

Cygwin - http://www.cygwin.com/
163源 - http://mirrors.163.com/cygwin/


按照个人习惯一步步勾选即可,软件源我选择163,如果网络不给力可以下载我提供的完整离线包

在线安装

  1. 点击下一步
  2. 选择Install from Internet
  3. 自定义安装路径
  4. 自定义Local Package Directory
  5. 自定义网络连接下载方式(可以使用代理加速)
  6. 选择http://mirrors.163.com作为下载源
  7. 选择自己所需的Packages

离线安装

  1. 点击下一步
  2. 选择Install from Local Directory
  3. 自定义安装路径
  4. 定义Local Package Directory为mirrors.163.com
  5. 选择自己所需的Packages

软件库

你同样可以在Cygwin上编译安装和执行Unix下的程序

Select Packages界面搜索并勾选所需的包或者直接全部install Devel,举个GoAccess栗子

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
Administrator@PC-20150629NSFI ~/goaccess-0.9.2
$ ./configure --enable-utf8
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking for pthread_create in -lpthread... yes
checking build system type... x86_64-unknown-cygwin
checking host system type... x86_64-unknown-cygwin
checking whether to build with rdynamic for GNU ld... no
checking for mvaddwstr in -lncursesw... yes
checking for ncursesw/ncurses.h... yes
checking for ncurses.h... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for pkg-config... /usr/bin/pkg-config
checking for GLIB2... yes
checking for g_list_append in -lglib-2.0... yes
checking for socket in -lsocket... no
checking for gethostbyname in -lnsl... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for an ANSI C-conforming const... yes
checking for off_t... yes
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for ptrdiff_t... yes
checking for working strtod... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking for working memcmp... yes
checking whether lstat correctly handles trailing slash... yes
checking whether stat accepts an empty string... no
checking for strftime... yes
checking for regcomp... yes
checking for strtoull... yes
checking for memmove... yes
checking for floor... yes
checking for gethostbyaddr... yes
checking for gethostbyname... yes
checking for memset... yes
checking for setlocale... yes
checking for strchr... yes
checking for strdup... yes
checking for strerror... yes
checking for strrchr... yes
checking for strstr... yes
checking for strtol... yes
checking for realpath... yes
checking for malloc... yes
checking for realloc... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/config.h
config.status: executing depfiles commands

Your build configuration:

CFLAGS = -pthread
storage: On-memory Hash Database (GLib)
prefix: /usr/local
package: goaccess
version: 0.9.2
bugs: goaccess@prosoftcorp.com


make && make install

$ goaccess -V
GoAccess - 0.9.2.
For more details visit: http://goaccess.io
Copyright (C) 2009-2015 GNU GPL'd, by Gerardo Orellana

在Cygwin里安装使用dig

1.启动Cygwin选择下载源

推荐国内源 - http://mirrors.163.com/cygwin/

2.Install the Bind package

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ dig wsgzao.github.io

; <<>> DiG 9.10.2-P2 <<>> wsgzao.github.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21080
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;wsgzao.github.io. IN A

;; ANSWER SECTION:
wsgzao.github.io. 30 IN CNAME github.map.fastly.net.
github.map.fastly.net. 30 IN A 103.245.222.133

;; Query time: 10 msec
;; SERVER: 202.96.209.133#53(202.96.209.133)
;; WHEN: 周五 七月 24 15:28:05 CST 2015
;; MSG SIZE rcvd: 96

文章目录
  1. 1. 前言
  2. 2. 更新历史
  3. 3. 在线安装
  4. 4. 离线安装
  5. 5. 软件库
    1. 5.1. 在Cygwin里安装使用dig