Cygwin+cmder+nmap+rsync工具集合
How do I install a Package Manager within Cygwin ?
- UPDATE CYGWIN
First of all you will need to ensure that Cygwin has the necessary binaries required for apt-cyg. This is achieved via the use of the Cygwin setup executable via the Windows command prompt.
C:\Windows\System32>C:\Users\admin\Downloads\setup.exe -q -P wget,tar,qawk,bzip2,subversion,vim
- INSTALL APT-CYG
Next download and install apt-cyg from within Cygwin.
$ svn --force export http://apt-cyg.googlecode.com/svn/trunk/ /bin/
$ chmod +x /bin/apt-cyg
- SYNTAX
"apt-cyg install <package names>" to install packages
"apt-cyg remove <package names>" to remove packages
"apt-cyg update" to update setup.ini
"apt-cyg show" to show installed packages
"apt-cyg find <pattern(s)>" to find packages matching patterns
"apt-cyg describe <pattern(s)>" to describe packages matching patterns
"apt-cyg packageof <commands or files>" to locate parent packages
- EXAMPLE
$ apt-cyg install rsync
Working directory is /setup
Mirror is ftp://mirror.mcs.anl.gov/pub/cygwin
--2011-05-09 06:44:24-- ftp://mirror.mcs.anl.gov/pub/cygwin/setup.bz2
=> `.listing'
Resolving mirror.mcs.anl.gov (mirror.mcs.anl.gov)... 2620:0:dc0:1800:214:4fff:fe7d:1b9, 146.137.96.15, 146.137.96.7
Connecting to mirror.mcs.anl.gov (mirror.mcs.anl.gov)|2620:0:dc0:1800:214:4fff:fe7d:1b9|:21... failed: Connection timed out.
Connecting to mirror.mcs.anl.gov (mirror.mcs.anl.gov)|146.137.96.15|:21... connected.
!! Output Omitted !!
2011-05-09 06:45:16 (131 KB/s) - `rsync-3.0.8-1.tar.bz2' saved [272248]
Unpacking...
Package rsync requires the following packages, installing:
libgcc1 libiconv2 libpopt0 cygwin
Package libgcc1 is already installed, skipping
Package libiconv2 is already installed, skipping
Package libpopt0 is already installed, skipping
Package cygwin is already installed, skipping
Package rsync installed
- REFERENCES
http://code.google.com/p/apt-cyg/
http://software.jessies.org/salma-hayek/cygwin-setup.html
- the following list of options to setup.exe:
Command Line Options:
-A --disable-buggy-antivirus Disable known or suspected buggy antivirus software packages during execution.
-C --categories Specify entire categories to install
-D --download Download from internet
-d --no-desktop Disable creation of desktop shortcut
-h --help print help
-K --pubkey Path to extra public key file (gpg format)
-L --local-install Install from local directory
-l --local-package-dir Local package directory
-n --no-shortcuts Disable creation of desktop and start menu shortcuts
-N --no-startmenu Disable creation of start menu shortcut
-O --only-site Ignore all sites except for -s
-P --packages Specify packages to install
-p --proxy HTTP/FTP proxy (host:port)
-q --quiet-mode Unattended setup mode
-r --no-replaceonreboot Disable replacing in-use files on next reboot.
-R --root Root installation directory
-S --sexpr-pubkey Extra public key in s-expr format
-s --site Download site
-U --keep-untrusted-keys Use untrusted keys and retain all
-u --untrusted-keys Use untrusted keys from last-extrakeys
-X --no-verify Don't verify setup.ini signatures
So setup.exe -P
To search for a package, per:
http://cygwin.com/cygwin-ug-net/using-utils.html#cygcheck
you can use cygcheck -p
:
cygcheck -p REGEXP
...
-p, --package-query search for REGEXP in the entire cygwin.com package repository (requires internet connectivity)
which produces output like (example from above site):
$ cygcheck -p 'libexpat.*\.a'
Found 2 matches for 'libexpat.*\.a'.
expat-1.95.7-1 XML parser library written in C
expat-1.95.8-1 XML parser library written in C
- apt-cyg是Cygwin上必备的包管理器,在googlecode关闭后我们如何安装呢???
其实很简单,apt-cyg本质上是一个脚本文件,下载云盘资源并将apt-cyg文件放到任意你想放的位置,然后运行命令如下
Administrator@mypc ~
$ install apt-cyg /bin
成功后便可以像ubuntu的apt-get那样安装文件,下面以vim为例进行简单的展示
Administrator@mypc ~
$ apt-cyg install vim
当然,也有可能你遇到以下问题
Administrator@mypc ~
$ apt-cyg install vim
/usr/bin/apt-cyg: line 25: $ '\r': command not found
/usr/bin/apt-cyg: line 100: syntax error near unexpected token '$'{\r''
/usr/bin/apt-cyg: line 100: function wget {
这是因为windows下文件换行存在两个字符“\r\n”,而cygwin脚本只支持“\n”。解决方法很简单使用dos2unix转换下格式即可,你可用cygwin的setup软件来安装dos2unix,然后执行如下命令
Administrator@mypc ~
$ dos2unix apt-cyg
dos2unix: converting file apt-cyg to Unix format...
转换成功后按前述步骤重新安装一边即可,因为我们是脚本安装,所以无法获取在线帮助,下面附上apt-cyg常用命令
install - 安装包
remove - 移除包
update - 更新包
download - 检索包但并不下载
show - 展示指定包的信息
depends - 展示指定包的依赖关系
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。