如何为 Cygwin 安装 apt-cyg?
how to install apt-cyg for Cygwin?
采取形式 here - 解释如何安装 apt-cyg
Install apt-cyg
You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg.
Installing apt-cyg is simple. First, save this file: https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg . Then, use File Explorer to find the file in your Downloads folder and move it into C:\cygwin\bin. Then, open Cygwin and enter "chmod +x /bin/apt-cyg". This tells Cygwin that you want to be able to execute the apt-cyg command. Lastly, enter "apt-cyg mirror ftp://sourceware.org/pub/cygwin". This sets up apt-cyg to use the official repository when downloading programs.
听起来很简单。但是我有一个错误。
本教程未指定使用什么名称和扩展名保存该文件。
我保存为apt-cyg.txt
,然后移动到C:\cygwin64\bin
这不起作用。当 运行 apt-cyg
时,我得到错误:bad interpreter: No such file or directory
我的猜测是扩展名或文件名有问题。我应该使用什么名称和扩展名?
这个过程还有其他步骤吗?
注意: 我刚刚在 windows 10 上安装了 cygwin。请不要假设我已经安装了其他工具。
记住从https://www.cygwin.com/下载的setup-x86.exe
或setup-x86_64.exe
是安装cygwin的官方方法。如果您使用其他方法安装并遇到问题,您可能会得到很少或得不到官方支持。只需使用官方的 gui 安装程序来安装和更新包。
你这样安装:
1 - 确保 lynx
已安装
2 - 运行 lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
3 - 运行 install apt-cyg /bin
就是这样!
似乎扩展名没有问题,但脚本中的行结尾有问题(请参阅 ^M 部分)。当您在多个平台上使用 git 并将 unix 结尾 lf 更改为 windows 结尾 clrf 等时,会发生类似的事情。
考虑通过以下命令将 clrf 更改为 lf(删除 cr):
sed -i 's/\r//g' apt-cyg
命令中不应有扩展名,因此在将 apt-cyg 下载到 /bin
后不要添加任何扩展名。
github repo of apt-cyg要求安装apt-cyg
如下:
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin
(这需要 lynx
已经安装在您的 cygwin 中。如果您在安装 cygwin 期间没有 selected lynx
包,您可以在 installation-path-to-cygwin\cygwin\setup\setup-x86_64.exe
然后在其安装向导中 select lynx
。)
但是,在 lynx
命令上方 运行 时出现错误。似乎落后于公司代理是一个问题。而且我无法弄清楚如何为 lynx
.
配置代理
所以我只是去 github 访问 apt-cyg
脚本 here. I downloaded the script from browser, by navigating to above link, right clicking and then save as. Note that you have to save it without extension (that is, select "All Files" in "Save as type" drop down of "Save As" window, instead of "Text Document"), because browser may by default save it as text file (txt
). If you have downloaded it as txt, you may change extension。将此文件剪切粘贴到 path-tocygwin\cygwin\setup\bin
。
就是这样!!!现在 apt-cyg
必须可以从 cygwin 终端访问。
注:
如果您 运行 apt-cyg install
在公司代理之后,请不要忘记设置代理路径:
export http_proxy=http://username:password@proxy-server-name:proxy-server-port
export https_proxy=http://username:password@proxy-server-name:proxy-server-port
例如:
export http_proxy=http://mahesh:password%40123@proxy.mycompany.com:8080
export https_proxy=http://mahesh:password%40123@proxy.mycompany.com:8080
注意密码中的@
应替换为%40
。
然后你可以安装包:
apt-cyg install gcc-core
您只需使用浏览器即可完成此操作。
- 右击“https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg”link
- Select "Save link as"
- 导航到 c:\cygwin\bin(或任何 Cygwin 二进制文件所在的位置)
- 删除 .txt 扩展名,使其只是 apt-cyg
- 点击"Save"
- 运行
chmod
in bash 如图所示
使用 setup.exe 安装网络包,然后使用 wget.exe https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg
和 install apt-cyg /bin
,如上所述。
采取形式 here - 解释如何安装 apt-cyg
Install apt-cyg
You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg.
Installing apt-cyg is simple. First, save this file: https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg . Then, use File Explorer to find the file in your Downloads folder and move it into C:\cygwin\bin. Then, open Cygwin and enter "chmod +x /bin/apt-cyg". This tells Cygwin that you want to be able to execute the apt-cyg command. Lastly, enter "apt-cyg mirror ftp://sourceware.org/pub/cygwin". This sets up apt-cyg to use the official repository when downloading programs.
听起来很简单。但是我有一个错误。
本教程未指定使用什么名称和扩展名保存该文件。
我保存为apt-cyg.txt
,然后移动到C:\cygwin64\bin
这不起作用。当 运行 apt-cyg
时,我得到错误:bad interpreter: No such file or directory
我的猜测是扩展名或文件名有问题。我应该使用什么名称和扩展名?
这个过程还有其他步骤吗?
注意: 我刚刚在 windows 10 上安装了 cygwin。请不要假设我已经安装了其他工具。
记住从https://www.cygwin.com/下载的setup-x86.exe
或setup-x86_64.exe
是安装cygwin的官方方法。如果您使用其他方法安装并遇到问题,您可能会得到很少或得不到官方支持。只需使用官方的 gui 安装程序来安装和更新包。
你这样安装:
1 - 确保 lynx
已安装
2 - 运行 lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
3 - 运行 install apt-cyg /bin
就是这样!
似乎扩展名没有问题,但脚本中的行结尾有问题(请参阅 ^M 部分)。当您在多个平台上使用 git 并将 unix 结尾 lf 更改为 windows 结尾 clrf 等时,会发生类似的事情。
考虑通过以下命令将 clrf 更改为 lf(删除 cr):
sed -i 's/\r//g' apt-cyg
命令中不应有扩展名,因此在将 apt-cyg 下载到 /bin
后不要添加任何扩展名。
github repo of apt-cyg要求安装apt-cyg
如下:
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin
(这需要 lynx
已经安装在您的 cygwin 中。如果您在安装 cygwin 期间没有 selected lynx
包,您可以在 installation-path-to-cygwin\cygwin\setup\setup-x86_64.exe
然后在其安装向导中 select lynx
。)
但是,在 lynx
命令上方 运行 时出现错误。似乎落后于公司代理是一个问题。而且我无法弄清楚如何为 lynx
.
所以我只是去 github 访问 apt-cyg
脚本 here. I downloaded the script from browser, by navigating to above link, right clicking and then save as. Note that you have to save it without extension (that is, select "All Files" in "Save as type" drop down of "Save As" window, instead of "Text Document"), because browser may by default save it as text file (txt
). If you have downloaded it as txt, you may change extension。将此文件剪切粘贴到 path-tocygwin\cygwin\setup\bin
。
就是这样!!!现在 apt-cyg
必须可以从 cygwin 终端访问。
注:
如果您 运行 apt-cyg install
在公司代理之后,请不要忘记设置代理路径:
export http_proxy=http://username:password@proxy-server-name:proxy-server-port
export https_proxy=http://username:password@proxy-server-name:proxy-server-port
例如:
export http_proxy=http://mahesh:password%40123@proxy.mycompany.com:8080
export https_proxy=http://mahesh:password%40123@proxy.mycompany.com:8080
注意密码中的@
应替换为%40
。
然后你可以安装包:
apt-cyg install gcc-core
您只需使用浏览器即可完成此操作。
- 右击“https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg”link
- Select "Save link as"
- 导航到 c:\cygwin\bin(或任何 Cygwin 二进制文件所在的位置)
- 删除 .txt 扩展名,使其只是 apt-cyg
- 点击"Save"
- 运行
chmod
in bash 如图所示
使用 setup.exe 安装网络包,然后使用 wget.exe https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg
和 install apt-cyg /bin
,如上所述。