Cygwin包中是否有类似于Debian上的apt-get或redhat上的yum的工具,允许我从命令行安装组件?


当前回答

老问题了,但仍然相关。以下是今天对我有效的方法(6/26/16)。

来自bash shell:

lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin

其他回答

“setup.exe”安装程序中没有专门的工具提供 apt-get的功能。但是,有一个命令行包安装程序 可以单独下载,但它不是完全稳定的和 依赖于变通办法。

apt-cyg: http://github.com/transcode-open/apt-cyg

检查项目的issues选项卡,查看已知的问题。

Cygwin的安装程序接受命令行参数来从命令行安装包。

例如setup-x86.exe -q -P packagename1,packagename2在没有任何GUI交互的情况下安装包('无人参与的安装模式')。

(请注意,您需要酌情使用setup-x86.exe或setup-x86_64.exe。)

软件包列表请参见https://cygwin.com/packages/。

通常在安装一个包之前,你必须知道它的确切名称:

# define a string to search
export to_srch=perl

# get html output of search and pick only the cygwin package names
wget -qO- "https://cygwin.com/cgi-bin2/package-grep.cgi?grep=$to_srch&arch=x86_64" | \
perl -l -ne 'm!(.*?)<\/a>\s+\-(.*?)\:(.*?)<\/li>!;print $2'

# and install 
# install multiple packages at once, note the
setup-x86_64.exe -q -s http://cygwin.mirror.constant.com -P "<<chosen_package_name>>"

Dawid Ferenczy的答案非常完整,但在我尝试了他几乎所有的选择后,我发现Chocolatey的cyg-get是最好的(至少是我唯一能找到的)。

我想安装wget,步骤如下:

choco install cyg-get

然后:

cyg-get wget

首先,在https://cygwin.com/setup-x86_64.exe (Windows 64bit)下载安装程序,然后:

# move installer to cygwin folder
mv C:/Users/<you>/Downloads/setup-x86_64.exe C:/cygwin64/

# add alias to bash_aliases
echo "alias cygwin='C:/cygwin64/setup-x86_64.exe -q -P'" >> ~/.bash_aliases
source ~/.bash_aliases

# add bash_aliases to bashrc if missing
echo "source ~/.bash_aliases" >> ~/.profile

如。

# install vim
cygwin vim

# see other options
cygwin --help