
安装Cygwin
一、下载完成后,安装Cygwin_setup.exe,直接点击下一步出现安装模式,如下图所示:
三种安装模式:
1.Installfrom Internet,这种模式直接从Internet安装,适合网速较快的情况;
2.downloadWithout Installing,这种模式只从网上下载Cygwin的组件包,但不安装;
3.Installfrom Local Directory,这种模式与上面第二种模式对应,当你的Cygwin组件包已经下载到本地,则可以使用此模式从本地安装Cygwin。
二、从上述三种模式中选择适合的安装模式,这里我们选择第一种安装模式,Cygwin组件下载完毕后会直接保存到本地,以便能够再次安装。选中后,点击“下一步”,如图所示:
三、这一步选择Cygwin的安装目录,默认安装位置是c:cygwin,你自己也可以选择安装目录,然后点击“下一步”吵链衡,如图所示:
四、安装过程中从网上下载的Cygwin组件包的保存位置,是你上一步 *** 作选择的目录,点击“下一步”,如图所示:
1.Direct Connection指定 Internet 连接
2.如果你有代理服务器,选择“Use Internet Explorer ProxySettings”
3.通过浏览器选项获得服务器名,选择使用代理,输入代理服务器的主机名和端口号。
五、通过Direct Connection连接,选择“下一步”,如图所示:
1.Cygwin默认情况下提供了多个下载镜像站点,因为这些站点是义务的镜像,单独一个下载点可能有风险,在其中选择一个下载站点即可(通常情况升做下它们是可用的,但有时可能因各种原因不可用)。通常情况下,建议选择离你比较近的那个站点。
2.指定一个站点,例如输入http://www.cygwin.cn,在User URL中填写这个地址,然后点add,就能将这个地址加到上面的镜像列表中,然后可以选择这个镜像进行安装。
六、通过http://mirrors.163.com用户连接,点击“下一步”,如图所示:
1.在此页面,你将选择要安装的包。默认情况下,Cygwin 基本包将不会安装 GCC,因此,你必须修改默认设置
2.将鼠标移动Devel边的加号(+)上,然后点击它展开Devel类后面紧跟三个参数分别为:Default(默认),Install(安装,全部),Uninstall(卸载,全部)。
3.Devel的分支下有很多组件,其中我们必须唤虚安装的组件包含:Binutils,gcc,gcc-mingw,gdb,如图所示:
binutils组件
gcc组件
gcc-mingw组件
gdb组件
选择完成之后,点击“下一步”,进入安装过程,此时等待安装结束,出现如图所示,点击“完成”。
七、测试安装是否成功
CYGWIN SSH Server配置
Cygwin是宴源轿许多软件的集合,最初由Cygnus Solutions开发,用于各种版本的Microsoft Windows上,运行UNIX类晌肆系统。Cygwin的主要目的是通过重新编译,将POSIX系统(例如Linux、BSD,以及其他Unix系统)上的软件移植到Windows上。
安装了Cygwin之后,就可以像 *** 作Unix那裂察样的 *** 作windows了,下面简要介绍一下如何在Cygwin上面配置SSH服务,使得可以从远程的机器上访问这台Windows。
1. 给文件授权,以完成sshd 服务的安装
chmod +r /etc/group
chmod +r /etc/passwd
chmod +rwx /var
2. 安装 sshd 服务
$ ssh-host-config
*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
*** Info: Creating default /etc/ssh_config file
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Updating /etc/sshd_config file
*** 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
*** Info: On Windows Server 2003, Windows Vista, and above, the
*** Info: SYSTEM account cannot setuid to other users -- a capability
*** Info: sshd requires. You need to have or to create a privileged
*** Info: account. This script will help you do so.
*** Info: You appear to be running Windows XP 64bit, Windows 2003 Server,
*** Info: or later. On these systems, it's not possible to use the LocalSystem
*** Info: account for services that can change the user id without an
*** Info: explicit password (such as passwordless logins [e.g. public key
*** Info: authentication] via sshd).
*** Info: If you want to enable that functionality, it's required to create
*** Info: a new account with special privileges (unless a similar account
*** Info: already exists). This account is then used to run these special
*** Info: servers.
*** Info: Note that creating a new user requires that the current account
*** Info: have Administrator privileges itself.
*** Info: The following privileged accounts were found: 'cyg_server' .
*** Info: This script plans to use 'cyg_server'.
*** Info: 'cyg_server' will only be used by registered services.
*** Query: Do you want to use a different name? (yes/no) no
*** Query: Please enter the password for user 'cyg_server':
*** Query: Reenter:
*** Info: The sshd service has been installed under the 'cyg_server'
*** Info: account. To start the service now, call `net start sshd' or
*** Info: `cygrunsrv -S sshd'. Otherwise, it will start automatically
*** Info: after the next reboot.
*** Info: Host configuration finished. Have
Administrator@backup ~
$ cygrunsrv.exe -S sshd # 启动 SSH服务
安装完成后,系统服务中应该会有 CYGWIN sshd服务
一切正常,即可启动ssh服务. 登录的用户名是cyg_server, 密码是配置是设置的密码
3. 使用 windows 用户本地认证
mkpasswd -l >/etc/passwd 使用windows 用户的密码
mkgroup -l >/etc/group使用windows 用户组
1、如果是win10用户,别折腾Cygwin了,win10已经自己支持安装Ubuntu:控制面板—卸载或者更新程序—启用或关闭windows功能—适用于Linux的windows子系统前打勾,然后再在windows自带的应颤冲和茄盯用商店搜Ubuntu,然后安装,基本Linux的命令都可以运行,比Cygwin强大多了。2、如果是win7等系统,安装cygwin后,在环境变量—系统环境变量—PATH的原有值后面加分号“”,然后再把cygwin安装的路径/bin添加在后面。
比如cygwin安装在C:\Program Files\cygwin文件夹里,那么变量路径为:C:\Program Files\cygwin\bin
3、系统环境变量弄好后,比如要执行放在C盘Program Files文件夹里的1.sh文件,那么bat文件为:bash C:\"Program Files"\1.sh
注:带空格的文判信件夹名需要加英文状态的引号("")
如果是win10的Ubuntu,和win7的路径写法有点不同,bat内容为:
bash /mnt/C/"Program Files"/1.sh
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)