安装apt-cyg

  1. 背景

需要在cygwin下安装一些库

  1. 安装

2.1获取apt-cyg源码

git clone https://github.com/transcode-open/apt-cyg.git

2.2 安装apt-cyg

2.2.1 cd apt-cyg 切换到apt-cyg源码目录

2.2.2 install apt-cyg /binapt-cyg安装到/bin目录下

2.3演示使用apt-cyg安装nano

apt-cyg install nano
  1. 使用apt-cyg安装telnet
apt-cyg install inetutils
  1. 安装'openssh'
    apt-cyg install openssh
  • 安装cygwin时一定要安装的包有:wget,make,yasm,
    lynx,openssh,libopenssl,git

cygwin中开启ssh的大致步骤

  1. 打开cygwin控制台:输入ssh-host-config

增加以下命令,不然无法进行安装,会出现权限不够的问题

chmod +r /etc/group
chmod +r /etc/passwd
chmod +rwx /var
*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
*** Query: Enter the value of CYGWIN for the daemon: [] ntsec
  1. 提示安装成功. 输入net start sshd, 启动 ssh服务

让cygwin方便安装软件 apt-cyg

  1. Quick start:apt-cyg is a simple script. To install

    lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
    chmod +x apt-cyg
    cp apt-cyg /bin/
  2. 指定国内的镜像地址

    apt-cyg  mirror http://mirrors.163.com/cygwin/
    apt-cyg  mirror http://mirrors.aliyun.com/cygwin/

Cygwin 镜像使用帮助

https://cygwin.com 上下载 setup-x86.exe 或 setup-x86_64.exe。

选择Install from Internet, 在”User URL”处输入以下地址:

https://mirrors.tuna.tsinghua.edu.cn/cygwin/

点击”Add”按钮, 然后选中”https://mirrors.tuna.tsinghua.edu.cn”, 点击”下一步”进行安装。

阿里云镜像(http://mirrors.aliyun.com/cygwin/)

注意,该列表为可多选列表,注意把上面不需要的镜像点掉

验证Cygwin安装成功

运行cygwin,在弹出的命令行窗口输入:

cygcheck -c cygwin

会打印出当前cygwin的版本和运行状态,如果status是ok的话,则cygwin运行正常。

在windows命令下使用cygwin

要想在Windows命令提示符下使用Cygwin,你需要添加Cygwin到Windows环境变量。

通过Win+Pause/Break键或者在我的电脑上右键选择属性打开系统属性。

在左边一列选择高级系统属性打开系统属性窗口

在高级选项里点击下面的环境变量

在系统变量里,找到Path变量并单击进行编辑

在变量值选项的最后面添加Cygwin下bin路径:;C:\cygwin\bin

点击“OK”关闭对话,然后打开命令提示符来测试几个Linux命令。