Nutch1.4安装及测试

Nutch安装及测试

 

一 安装环境:

Ubuntu 版本:11.10

Kernel  版本:3.0.0.12-generic

 

二 安装Java的JDK

安装JDK命令:apt-getinstall openjdk-6-jdk

 

三 下载Nutch及解压安装

       Nutch版本:apache-nutch-1.4-bin.tar.gz

       命令下见图:

 

 

四 设置环境变量:

      

问题一:当设置完环境变量后,在命令行输入”nutch”,然后回车,无法运行nutch,且出现现提示:“/home/is11/lidexin/apache-nutch-1.4-bin/runtime/local/bin/nutch:Permission denied”

解决方法:在目录“/home/is11/lidexin/apache-nutch-1.4-bin/runtime/local/bin/”下输入命令“chmod +x nutch”,然后回车。(见下图)

(注意此问题不一定会出现,我在ubuntu10.04上安装Nutch时就没出现过)

 

五 建立urls目录

       在目录“/apache-nutch-1.4-bin/runtime/local”下建立urls目录,见下图

 

六 在urls目录下建立url.txt文件,并输入你想爬的网站网址。

 

七 编辑nutch-site.xml文件。

       进入到/apache-nutch-1.4-bin/runtime/local/conf目录下,修改nutch-site.xml文件。命令见下图。

 

添加内容如下:


八 编辑regex-urlfilter.txt文件

进入到/apache-nutch-1.4-bin/runtime/local/conf目录下,修改regex-urlfilter.txtl文件,在“# accept anything else”下面输入:“+^http://([a-z0-9*\.])*mittrchinese.com/”,然后保存,见下图

 

  

 

九 开始爬了

   命令:nutch crawl urls –dir crawl –depth 3 –topN 5

   此命令的意思:“We are using the nutch crawlcommand. The urlsdir is the urls directory that we added to the distributedfilesystem. (I've called it "urlsdir" to make it clearer that itisn't merely the *file* containing urls). The "-dir crawl" is theoutput directory. This will also go to the distributed filesystem. The depth is3 meaning it will only get 3 page links deep. There are other options you canspecify, see the command documentation for those options.”

引之网站:http://wiki.apache.org/nutch/NutchHadoopTutorial

 

问题二:出现错误提示,见下图

 

 

解决方法如下:

       回到/apache-nutch-1.4-bin/runtime/local目录下,执行“chmod +x urls”命令,回车。

       (注意此问题不一定会出现,我在ubuntu10.04上安装Nutch时就没出现过)


 

重新输入命令:nutch crawl urls –dir crawl –depth 3 –topN 5

屏幕显示如下:

 

 


借鉴的主要网站:http://nutch.apache.org/

http://www.open-open.com/lib/view/open1328670771405.html

http://www.cnblogs.com/wycg1984/archive/2010/06/25/1764926.html

http://luckaway.iteye.com/blog/568496

http://www.cppblog.com/AutomateProgram/archive/2011/05/04/145657.html

http://blog.csdn.net/Mylady58/article/details/5891190

http://wiki.apache.org/nutch/NutchHadoopTutorial

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值