在装完cygwin后我们一般将它添加到win7系统环境变量PATH中:
D:\cygwin\bin;D:\cygwin\usr\sbin;
在cygwin中开启停用删除服务的命令:
开启服务: $ net start 服务名
停止服务: $ net stop 服务名
删除服务: $ cygrunsrv -R 服务名
cygwin自带的命令:
检查所有安装的软件的版本号: $ cygcheck -c
检查当前Cygwin的版本号: $ cygcheck -c cygwin
cygwin编译搭建hadoop环境需要安装的软件包:
1.openssh
2.openssl
3.sed
4.zlib
4.tcp_wrappers
5.diffutils
6.vim
7.subversion
8.mpfr(版本4)
cygwin没有自动卸载功能,需要手动操作3个步骤如下:
1.停止服务: $ net stop 服务名
2.删除服务: $ cygrunsrv -R 服务名
3.删除cygwin文件
然后如下进行操作(因为是重新安装,与第一次安装稍有区别)
Administrator@RD-2013-03-25-02 ~ $ 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/READ ME.privsep. *** Query: Should privilege separation be used? (yes/no) no *** 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: [] netsec *** 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: No privileged account could be found. *** 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) yes *** Query: Enter the new user name: Administrator *** Query: Reenter: Administrator *** Warning: Privileged account 'Administrator' was specified, *** Warning: but it does not have the necessary privileges. *** Warning: Continuing, but will probably use a different account. *** Warning: The specified account 'Administrator' does not have the *** Warning: required permissions or group memberships. This may *** Warning: cause problems if not corrected; continuing... *** Query: Please enter the password for user 'Administrator': *** Query: Reenter: *** Info: The sshd service has been installed under the 'Administrator' *** 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 fun!
Administrator@RD-2013-03-25-02 ~ $ net start sshd CYGWIN sshd 服务正在启动 . CYGWIN sshd 服务已经启动成功
接下来是配置无密码登陆:
Administrator@RD-2013-03-25-02 ~ $ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/sony/.ssh/id_rsa):回车 Created directory '/home/Administrator/.ssh'. Enter passphrase (empty for no passphrase):回车 Enter same passphrase again:回车 Your identification has been saved in /home/Administrator/.ssh/id_rsa. Your public key has been saved in /home/Administrator/.ssh/id_rsa.pub. The key fingerprint is: e8:38:5e:e3:bb:cf:76:03:61:5f:f2:68:ed:a3:49:db Administrator@RD-2013-03-25-02 The key's randomart image is: +--[ RSA 2048]----+ | | | | | | | .o . . | | ..So * | | o . + o | | o + o.. | | . + o..o+o | | . +=o.+oE. | +-----------------+ Administrator@RD-2013-03-25-02 ~ $ cd .ssh/ Administrator@RD-2013-03-25-02 ~/.ssh $ ls id_rsa id_rsa.pub Administrator@RD-2013-03-25-02 ~/.ssh $ cp id_rsa.pub authorized_keys Administrator@RD-2013-03-25-02 ~/.ssh $ ls authorized_keys id_rsa id_rsa.pub
验证如下:
Administrator@RD-2013-03-25-02 ~/.ssh $ ssh localhost The authenticity of host 'localhost (::1)' can't be established. ECDSA key fingerprint is 5f:21:b1:24:80:92:f6:af:3e:e3:a8:f9:cb:a4:4f:ec. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts. Administrator@RD-2013-03-25-02 ~/.ssh $ who admin tty0 2011-11-25 15:42 (::1)