如何从命令行安装 cygwin 组件?
Cygwin 软件包中是否有类似于 Debian 上的 apt-get 或 Redhat 上的 yum 的工具,允许我从命令行安装组件?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
Cygwin 软件包中是否有类似于 Debian 上的 apt-get 或 Redhat 上的 yum 的工具,允许我从命令行安装组件?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(10)
Cygwin 的安装程序接受命令行参数从命令行安装软件包。
例如
setup-x86.exe -q -P packagename1,packagename2
无需任何 GUI 交互即可安装软件包(“无人值守安装模式”)。(请注意,您需要根据需要使用
setup-x86.exe
或setup-x86_64.exe
。)请参阅 https://cygwin.com/packages/ 查看软件包列表。
Cygwin's setup accepts command-line arguments to install packages from the command-line.
e.g.
setup-x86.exe -q -P packagename1,packagename2
to install packages without any GUI interaction ('unattended setup mode').(Note that you need to use
setup-x86.exe
orsetup-x86_64.exe
as appropriate.)See https://cygwin.com/packages/ for the package list.
为了更方便的安装程序,您可能需要使用
apt-cyg
作为您的包管理器。其语法类似于apt-get
,这是一个优点。为此,请遵循上述步骤,然后使用 Cygwin Bash 执行以下步骤
现在 apt-cyg 已安装。以下是一些例子
安装一些包
For a more convenient installer, you may want to use
apt-cyg
as your package manager. Its syntax similar toapt-get
, which is a plus. For this, follow the abovesteps and then use Cygwin Bash for the following steps
Now that
apt-cyg
is installed. Here are few examples ofinstalling some packages
“setup.exe”安装程序中没有专门提供以下功能的工具
apt-get 的功能。但是,有一个命令行包安装程序
Cygwin 可以单独下载,但它并不完全稳定,
依赖于解决方法。
apt-cyg: http://github.com/transcode-open/apt-cyg
查看项目的问题选项卡以查看已知问题。
There is no tool specifically in the 'setup.exe' installer that offers the
functionality of apt-get. There is, however, a command-line package installer
for Cygwin that can be downloaded separately, but it is not entirely stable and
relies on workarounds.
apt-cyg: http://github.com/transcode-open/apt-cyg
Check out the issues tab for the project to see the known problems.
有一些脚本可以用作 Cygwin 的简单包管理器。但重要的是要知道,它们总是有限,因为......嗯......Windows。
安装或删除软件包很好,Cygwin 的每个软件包管理器都可以做到这一点。但更新很痛苦,因为 Windows 不允许您覆盖当前正在运行的可执行文件。因此,您无法更新 Cygwin DLL 或任何包含 Cygwin 本身当前运行的可执行文件的包。 Cygwin Installation 页面上还有此注释:
Cygwin 的安装程序使用 Windows 注册表来覆盖正在使用的可执行文件
并且此方法需要重新启动Windows。因此,最好关闭
更新软件包之前的所有 Cygwin 进程,因此您不必重新启动
您的计算机实际应用更改。安装新包
应该完全没有任何麻烦。我认为没有任何包管理器
除了 Cygwin 的 setup.exe 实现任何覆盖正在使用的文件的方法之外,
所以如果它不能覆盖它们,它就会失败。
Cygwin 的一些包管理器:
apt-cyg
更新:由于版权问题,存储库最近被禁用( DMCA 删除)。它看起来像所有者存储库的 DMCA 对自己的存储库进行了删除,并创建了一个名为Sage的新项目(见下文)。
对我来说最好的一个。只是因为它是最新的之一。它不使用 Cygwin 的
setup.exe
,而是重新实现setup.exe
的功能。它适用于两个平台 - x86 以及 x86_64。有很多叉子都或多或少具有附加功能。例如,kou1okada fork就是改进版本之一,这真的很棒。apt-cyg只是一个shell脚本,没有安装。只需下载它(或克隆存储库),使其可执行并将其复制到 PATH 的某个位置:
还有 一堆具有不同功能的分叉。
sage
另一个作为 shell 脚本实现的包管理器。我没有尝试过,但实际上看起来不错。
它可以搜索存储库中的包、列出类别中的包、检查依赖关系、列出包文件等等。它具有其他包管理器所没有的功能。
cyg-apt
废弃原始版本的分叉
cyg-apt进行了改进和错误修复。它有相当多的功能,并且是用Python实现的。使用make
进行安装。Chocolatey 的 cyg-get
如果您使用 Chocolatey 安装 Cygwin,则可以安装该软件包 cyg-get,它实际上是用 PowerShell 编写的 Cygwin
setup.exe
的简单包装。Cygwin 的 setup.exe
它还有一个命令行模式。此外,它允许您一次升级所有已安装的软件包(就像
apt-get upload
在基于Debian的Linux上所做的那样)。使用示例:
您可以创建一个别名以方便使用,例如:
alias cyg-get="/cygdrive/d/path/to/cygwin/setup-x86_64.exe -q -P"
然后例如,您可以使用以下命令安装 Vim 软件包:
cyg-get vim
There exist some scripts, which can be used as simple package managers for Cygwin. But it’s important to know, that they always will be quite limited, because of...ehm...Windows.
Installing or removing packages is fine, each package manager for Cygwin can do that. But updating is a pain since Windows doesn’t allow you to overwrite an executable, which is currently running. So you can’t update e.g. Cygwin DLL or any package which contains the currently running executable from the Cygwin itself. There is also this note on the Cygwin Installation page:
Cygwin’s setup uses Windows registry to overwrite executables which are in use
and this method requires a reboot of Windows. Therefore, it’s better to close
all Cygwin processes before updating packages, so you don’t have to reboot
your computer to actually apply the changes. Installation of a new package
should be completely without any hassles. I don’t think any of package managers
except of Cygwin’s
setup.exe
implements any method to overwrite files in use,so it would simply fail if it cannot overwrite them.
Some package managers for Cygwin:
apt-cyg
Update: the repository was disabled recently due to copyright issues (DMCA takedown). It looks like the owner of the repository issued the DMCA takedown on his own repository and created a new project called Sage (see bellow).
The best one for me. Simply because it’s one of the most recent. It doesn’t use Cygwin’s
setup.exe
, it rather re-implements, whatsetup.exe
does. It works correctly for both platforms - x86 as well as x86_64. There are a lot of forks with more or less additional features. For example, the kou1okada fork is one of the improved versions, which is really great.apt-cyg is just a shell script, there is no installation. Just download it (or clone the repository), make it executable and copy it somewhere to the PATH:
There is also bunch of forks with different features.
sage
Another package manager implemented as a shell script. I didn't try it but it actually looks good.
It can search for packages in a repository, list packages in a category, check dependencies, list package files, and more. It has features which other package managers don't have.
cyg-apt
Fork of abandoned original
cyg-aptwith improvements and bugfixes. It has quite a lot of features and it's implemented in Python. Installation is made usingmake
.Chocolatey’s cyg-get
If you used Chocolatey to install Cygwin, you can install the package cyg-get, which is actually a simple wrapper around Cygwin’s
setup.exe
written in PowerShell.Cygwin’s setup.exe
It also has a command line mode. Moreover, it allows you to upgrade all installed packages at once (as
apt-get upgrade
does on Debian based Linux).Example use:
You can create an alias for easier use, for example:
alias cyg-get="/cygdrive/d/path/to/cygwin/setup-x86_64.exe -q -P"
Then you can, for example, install Vim package with:
cyg-get vim
首先,下载安装程序:https://cygwin.com/setup-x86_64.exe(Windows 64位),那么:
例如
First, download installer at: https://cygwin.com/setup-x86_64.exe (Windows 64bit), then:
e.g.
我想要一个类似于 apt-get --print-uris 的解决方案,但不幸的是 apt-cyg 不这样做。以下是一个解决方案,允许我仅下载我需要的包及其依赖项,并将它们复制到目标进行安装。下面是一个 bash 脚本,它将 apt-cyg 的输出解析为 URI 列表:
上面将打印出需要下载的包的路径,相对于 cygwin 镜像根目录,省略任何包已经安装的。为了下载它们,我将输出写入文件 cygwin-packages-list ,然后使用 wget:
然后可以使用安装程序从本地缓存目录进行安装。请注意,为此,我需要将
setup.ini
从以前的 cygwin 包缓存复制到包含下载文件的目录(否则安装程序不知道是什么)。I wanted a solution for this similar to
apt-get --print-uris
, but unfortunately apt-cyg doesn't do this. The following is a solution that allowed me to download only the packages I needed, with their dependencies, and copy them to the target for installation. Here is a bash script that parses the output ofapt-cyg
into a list of URIs:The above will print out the paths of the packages that need downloading, relative to the cygwin mirror root, omitting any packages that are already installed. To download them, I wrote the output to a file
cygwin-packages-list
and then used wget:The installer can then be used to install from a local cache directory. Note that for this to work I needed to copy
setup.ini
from a previous cygwin package cache to the directory with the downloaded files (otherwise the installer doesn't know what's what).老问题,但仍然相关。这是今天对我有用的方法(2016 年 6 月 26 日)。
从 bash shell 中:
Old question, but still relevant. Here is what worked for me today (6/26/16).
From the bash shell:
Dawid Ferenczy 的答案相当完整,但在我尝试了他几乎所有的选项后,我发现 Chocolatey 的 cyg- get 是最好的(至少是我能开始工作的唯一一个)。
我想安装
wget
,步骤是这样的:然后:
Dawid Ferenczy's answer is pretty complete but after I tried almost all of his options I've found that the Chocolatey’s cyg-get was the best (at least the only one that I could get to work).
I was wanting to install
wget
, the steps was this:Then:
通常在安装软件包之前必须知道它的确切名称:
Usually before installing a package one has to know its exact name:
如果您通过 Chocolatey 安装了 cygwin,则可以使用特殊的 替代源:
If you have cygwin installed via chocolatey, you could use special alternative sources: