cygwin是一个在windows平台上运行的unix模拟环境,是cygnus solutions公司开发的自由软件(该公司开发了很多好东西,著名的还有eCos,不过现已被Redhat收购)。它对于学习unix/linux操作环境,或者从unix到windows的应用程序移植,或者进行某些特殊的开发工作,尤其是使用gnu工具集在windows上进行嵌入式系统开发,非常有用。 在进行hadoop的windows安装后,第二步就是cygwin的安装,虽然很多人建议在linux环境下来进行hadoop的学习,但是很多人由于没有现成的环境,比如我,又比较懒,只好在windows下尝鲜了。cygwin在windows下虽然可能遇到很多问题,但是由于现在cygwin是由redhat在维护,我还是很有信心的,虽然遇到了一些问题,但是可以在windows下模拟unix的一些东西,抛开hadoop的学习不说,仅仅安装一个软件就可以能模拟unix难道不是一件很爽的事情吗,闲话少说了。
First, the installation of Cygwin
We can go to Cygwin's official website to download the Cygwin installation program, the address is: http://www.cygwin.com/or directly using the download connection to download the installer, download connection is: Http://www.cygwin.com/setup.exe
After the download is complete, run the Setup.exe program and the installation screen appears. Directly point to "next", the Installation Mode dialog box appears as shown in:
We see three types of installation modes:
? Install from the Internet, this mode is installed directly from the Internet, suitable for fast speed situation;
? Download without installing, this mode only downloads the Cygwin component package from the Internet, but does not install;
? Install from local Directory, this mode corresponds to the second mode above, and when your Cygwin component package has been downloaded locally, you can use this mode to install Cygwin locally.
Here it is necessary to explain that the first full installation of the first mode, but the subsequent development process found that some component packages are not installed, you can run the installation program again, choose the second mode, that is, to download the component package separately instead of installing, so that you can download the required package of components. After all the package packages have been downloaded, install the component package locally from the third mode of running.
It is important to note that the download and installation must remember the use of the mirror site, because the software to the package according to different images placed in different directories, if a few downloads of the image is not the same, from the local installation, it is only the most recent one to find the image of the downloaded component package, it is important to note.
Choose from the above three modes suitable for your installation mode, here we choose the first installation mode, directly from the Internet installation, of course, while downloading, Cygwin components are also saved to the local, so that later can be installed again. When selected, click Next,
This step selects the installation directory for the Cygwin, as well as some parameter settings. The default installation location is C:\cygwin\, you can also choose your own installation directory, and then choose "Next",
This step we can select the installation process from the Internet Download Cygwin component package save location, after selecting, click "Next",
This step select the way to connect, select your connection mode, and then click Next, the Select Download Site dialog box appears, as shown in,
In this step, we need to note that in order to get the fastest download speed, we first look for the address of the Cygwin Chinese image in the list: http://www.cygwin.cn, if found, select this address; If you cannot find this address, enter the address of the Chinese mirror manually: http ://www.cygwin.cn/pub/, then click "Add" and then select it in the list. After selecting Done, click "Next",
(Here is the previous document, the current list, the domestic 163 and the Chinese University of Science and Technology mirror site, the beginning of my choice is 163 mirror site mirrors.163.com But this image is unstable in my environment is very slow, Later found that there is a large image of technology wstc.edu.cn This image is estimated to be due to the use of a few people, very fast, highly recommended)
This step, we choose to download the installed component package, in order to enable our installed Cygwin to compile the program, we need to install the GCC compiler, by default, GCC will not be installed, we need to select it to install. In order to install GCC, we use the mouse to click on the "Devel" branch in the component list, where there are many components, we must:
Binutils
Gcc
Gcc-mingw
Gdb
To expand: We need to download the component package as follows: I downloaded it in this order and installed it successfully, note the latest version of different packages, such as autoconf I currently see the latest 2.5, you can choose for yourself.
Under Devel Branch:
autoconf2.5
automake1.9
Binutils
Gcc
Gcc-core
gcc-g++
Gcc-mingw-core
gcc-mingw-g++
Gdb
Subvision
Base branch: SED, mostly compiled under eclipse
NET branch: OpenSSH and OpenSSL
Editors branch: Vim used to modify the configuration file
Mouse click on the front of the component of the loop button, the build date will appear, we choose the latest version of the installation, is selected after the four categories of components:
In particular, it is important to note that the icon with the fork is selected, a strange icon, but the foreigner is.
Binutils components
GCC components
GCC-MINGW components
GDB components
After the selection, we choose the next step, enter the installation process, as shown in,
The time of installation depends on the components you select and the network conditions. After the installation is complete, the installer will prompt you to create the Cygwin icon on the desktop and click Finish to exit Setup.
Second, the configuration of Cygwin
这步骤是最多出现问题的地方,大家需要做好心里准备。 1.环境变量的设置 path环境变量需要设置为cygwin的bin目录,在上一篇java安装的过程中也有提及。需要在path后增加e:\hadoop\cygwin\bin; 2.安装sshd服务 启动cygwin terminal,输入ssh-host-config进行配置操作。出现have fun就代表配置成功了。 这里一点需要特别重要的是:在should privilege separation be used?一定要注意输入no ,也就是不为sshd的服务生成单独的用户,如果选择yes会单独生成用户,配置就会不成功的。 出现have fun后需要启动sshd的服务,如: 我就是在这一步出错的,总是启动不成功。 查了很多的资料,主要是windows账户和linux账户root的区别,我尝试了ssh-host-config重新配置,并使用yes模式下生成sshd的账户方式,但是后来发现解决不了问题。 后来采用了如下的方式: 删除已经安装的sshd的服务:sc delete sshd 然后重新配置sshd,执行ssh-host-config使用yes yes no yes 空格 也就是覆盖ssh_config文件,覆盖sshd_config文件 ,不生成单独账户,安装sshd为单独的服务,不输入任何值,在提示配置成功后,按照页面提示运行cygrunsrv -S sshd来启动sshd的服务,通过在运行中输入“services.msc”来查看服务的运行状况,如果cygwin sshd的运行状况是已启动,那说明服务安装成功。 3.配置sshd登陆 在terminal窗口中输入ssh-keygen成功密钥文件。生成id_rsa.pub cp id_rsa.pub authorized_keys 然后关闭terminal,然后在启动输入ssh localhost 在窗口提示中提示输入的地方,输入yes完成sshd的登陆配置。 至此,完成cygwin安装已经sshd的安装配置
Hadoop Learning---2.cygwin and sshd installation configuration