捣鼓了两三天,参考了好多资料,终于在win7/Cygwin/Hadoop1.0.3下跑通了自带例子。
注意事项如下:
一 安装Cygwin,注意要选中Net分类下的Openssh
二 在Cygwin下安装SSH,步骤如下:
$ 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) 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: [] *** 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: hadoop *** Query: Reenter: hadoop *** Query: Create new privileged user account 'hadoop'? (yes/no) yes *** Info: Please enter a password for new user hadoop. Please be sure *** Info: that this password matches the password rules given on your system. *** Info: Entering no password will exit the configuration. *** Query: Please enter the password: *** Query: Reenter: *** Info: User 'hadoop' has been created with password 'hadoop'. *** Info: If you change the password, please remember also to change the *** Info: password for the installed services which use (or will soon use) *** Info: the 'hadoop' account. *** Info: Also keep in mind that the user 'hadoop' needs read permissions *** Info: on all users' relevant files for the services running as 'hadoop'. *** Info: In particular, for the sshd server all users' .ssh/authorized_keys *** Info: files must have appropriate permissions to allow public key *** Info: authentication. (Re-)running ssh-user-config for each user will set *** Info: these permissions correctly. [Similar restrictions apply, for *** Info: instance, for .rhosts files if the rshd server is running, etc]. *** Info: The sshd service has been installed under the 'hadoop' *** 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!
建议按上述步骤执行,这样服务里的Cygwin ssh可以直接启动(已经自动修改好了登录用户)。另外在win7Cmd中输入net user hadoop,显示如下:
C:\Users\anjx>net user hadoop
用户名 hadoop 全名 Privileged server 注释 用户的注释 国家/地区代码 000 (系统默认值) 帐户启用 Yes 帐户到期 从不 上次设置密码 2012/6/27 17:45:17 密码到期 从不 密码可更改 2012/6/27 17:45:17 需要密码 Yes 用户可以更改密码 Yes 允许的工作站 All 登录脚本 用户配置文件 主目录 D:\Cygwin\var\empty 上次登录 从不 可允许的登录小时数 All 本地组成员 *Administrators *Users 全局组成员 *None 命令成功完成。
而通过控制面板可以看到新增了个用户“Privileged server”。注意这个就是hadoop用户的全名,并非两个用户。
如果想多次测试,可以使用cygrunsrv -R sshd来删除当前sshd服务。另外在删除系统中的用户时,除了win7用户,还要到Cygwin/etc/passwd文件中删除掉刚才新建的用户。
三 按quick start进行即可。