/×××××××××××××××××××××××××××××××××××××××××/

Author:xxx0624

HomePage:http://www.cnblogs.com/xxx0624/

/×××××××××××××××××××××××××××××××××××××××××/

利用ant编译nutch2.x

详见:1.    http://blog.javachen.com/2014/05/20/nutch-intro/

    2.    wiki.apache.org/nutch/Nutch2Tutorial

   3.    http://duguyiren3476.iteye.com/blog/2085973  (编译过程参见这个地址)

前提条件:配置ant(http://www.cnblogs.com/xxx0624/p/4172277.html)

1. 下载nutch(例如:我的是apache-nutch-2.2.1-src.tar.gz)

解压,重命名nutch文件夹(命名为nutch),然后移动文件夹到/home文件夹下

2. 编译nutch

  2.1 准备工作

  (1)待会儿编译可能会出现这个错误

Trying to override old definition of task javac
[taskdef] Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found.
ivy-probe-antlib:
ivy-download:
[taskdef] Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found.

  原因:nutch中缺少相应的jar包。

  解决办法:

    (1)下载sonar-ant-task-2.1.jar,并直接放到nutch文件夹目录下

    (2)修改build.xml文件,从而引入这个新的jar

<!-- Define the Sonar task if this hasn't been done in a common script -->
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath path="${ant.library.dir}" />
<classpath path="${mysql.library.dir}" />
<classpath><fileset dir="." includes="sonar*.jar" /></classpath>
</taskdef>

  (2)编译时间过长:

  nutch使用ivy进行构建,故编译时间长。如果时间过长,可使用该办法解决。

  修改该文件:ivy/ivysettings.xml

http://mirrors.ibiblio.org/maven2/

替换掉:

http://repo1.maven.org/maven2/

  2.2 修改nutch配置

  (1)修改nutch的conf/nutch-site.xml文件

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <!-- Put site-specific property overrides in this file. --> <configuration> <property>
<name>storage.data.store.class</name>
<value>org.apache.gora.hbase.store.HBaseStore</value>
<description>Default class for storing data</description>
</property>
<property>
<name>http.agent.name</name>
<value>xxx0624-ThinkPad-Edge</value>
</property>
</configuration>

  (2)修改ivy/ivy.xml文件

<dependency org="org.apache.gora" name="gora-hbase" rev="0.3"  conf="*->default" />  <!--把该行的注释去掉,使之生效-->

  (3)修改conf/gola.properies

    gora.datastore.default=org.apache.gora.hbase.store.HBaseStore
#gora.sqlstore.jdbc.driver=org.hsqldb.jdbc.JDBCDriver
#gora.sqlstore.jdbc.url=jdbc:hsqldb:hsql://localhost/nutchtest
#gora.sqlstore.jdbc.user=sa
#gora.sqlstore.jdbc.password=

  2.3 编译nutch(需在nutch当前目录下进行编译)

cd nutch
ant

  2.4 编译之后的目录:

.
├── build
├── build.xml
├── build.xml~
├── CHANGES.txt
├── conf
├── default.properties
├── docs
├── ivy
├── lib
├── LICENSE.txt
├── NOTICE.txt
├── README.txt
├── runtime
├── sonar-ant-task-2.1.jar
└── src 7 directories, 8 files

3. 修改nutch配置文件(在第2步中均已完成)

Nutch2.x版本存储采用Gora访问Cassandra、HBase、Accumulo、Avro等,需要在该文件中制定Gora属性。

 3.1修改 conf/nutch-site.xml(第2步中已完成)

<property>
<name>storage.data.store.class</name>
<value>org.apache.gora.hbase.store.HBaseStore</value>
<description>Default class for storing data</description>
</property>

 3.2 修改 ivy/ivy.xml(第2步中已完成)

<!-- Uncomment this to use HBase as Gora backend. -->
<dependency org="org.apache.gora" name="gora-hbase" rev="0.3" conf="*->default" />

 3.3 修改 conf/gora.properties(第2步中已完成)

gora.datastore.default=org.apache.gora.hbase.store.HBaseStore

/*****************************************************************************************************************************/

配置nutch

(nutch文件夹已在/home目录下)

1. 修改系统环境变量

sudo gedit /etc/profile

//增加

#set nutch
export PATH=/home/nutch/runtime/local/bin:$PATH

2. 测试(nutch/runtime/local/bin中./nutch  &  ./crawl)

nutch
//结果如下:
Usage: nutch COMMAND
where COMMAND is one of:
inject inject new urls into the database
hostinject creates or updates an existing host table from a text file
generate generate new batches to fetch from crawl db
fetch fetch URLs marked during generate
parse parse URLs marked during fetch
updatedb update web table after parsing
updatehostdb update host table after parsing
readdb read/dump records from page database
readhostdb display entries from the hostDB
elasticindex run the elasticsearch indexer
solrindex run the solr indexer on parsed batches
solrdedup remove duplicates from solr
parsechecker check the parser for a given url
indexchecker check the indexing filters for a given url
plugin load a plugin and run one of its classes main()
nutchserver run a (local) Nutch server on a user defined port
junit runs the given JUnit test
or
CLASSNAME run the class named CLASSNAME
Most commands print help when invoked w/o parameters.
crawl
//结果如下:
Missing seedDir : crawl <seedDir> <crawlID> <solrURL> <numberOfRounds>

  由于nutch与hbase的使用还会有新的错误出现,故在新文章中记录:nutch集成hbase(http://www.cnblogs.com/xxx0624/p/4176199.html)

Ubuntu环境下利用ant编译nutch2.2.1 & 配置nutch2.2.1的更多相关文章

  1. ubuntu环境下nginx的编译安装以及相关设置

    一.基本的编译与安装 1.安装依赖项 sudo apt-get update sudo apt-get install build-essential zlib1g-dev libpcre3 libp ...

  2. Ubuntu环境下使用npm编译从git上clone下来的前端(Javascript)项目

    一.更新Ubuntu软件源 打开终端依次输入: $ sudo apt-get update $ sudo apt-get install -y python-software-properties s ...

  3. Ubuntu环境下使用Maven编译并打包Java项目

    一.安装Maven 打开终端输入以下指令: $ mvn -v Apache Maven Maven home: /usr/share/maven Java version: 1.8.0_181, ve ...

  4. ubuntu 16.0 利用ant编译 hadoop-eclipse-plugins2.6.0

    折腾了两天,抱着不放弃的精神,我终于编译出我自己所需的hadoop中在eclipse中的插件 在网上下载的可能因为版本不一致,在编译的时候出现各种各样的问题,包括你的eclipse版本和hadoop版 ...

  5. 【转】Android 源码下利用jni编译自己的项目(参考系统development/samples/SimpleJNI)

    原文网址:http://blog.csdn.net/qiuxiaolong007/article/details/7860481 记于正文前:环境是ubuntu10.10,android 源码是2.0 ...

  6. Ubuntu环境下SSH的安装及使用

    Ubuntu环境下SSH的安装及使用 SSH是指Secure Shell,是一种安全的传输协议,Ubuntu客户端可以通过SSH访问远程服务器 .SSH的简介和工作机制可参看上篇文章SSH简介及工作机 ...

  7. Ubuntu环境下的Redis 配置与C++使用入门

      Redis是一个高性能的key-value数据库. Redisedis的出现,非常大程度补偿了memcached这类key/value存储的不足,在部分场合能够对关系数据库起到非常好的补充作用.它 ...

  8. ubuntu 环境下的QT程序打包

    很多的时候 需要将自己写的QT 程序发布一下  所以今天教一下 怎么在ubuntu 环境下将自己的写的Qt 程序打包打包是为了不依赖 开发环境 和开发的库. 1. QtCreate使用Release版 ...

  9. Ubuntu环境下配置GCC

    Ubuntu网络环境下安装GCC及其头文件步骤: 1.Ubuntu环境下配置GCC 刚装好的GCC什么都不能编译,因为没有一些必须的头文件,所以要安装build-essential,安装了这个包会安装 ...

随机推荐

  1. 3月3日 Mark

    感觉LeetCode OJ 水题较多... 不过回复基础就是这样吧.. 刚刚和Gaewah聊了下,后续可以考虑去做Topcoder的SRM或者codeforces,Mark.

  2. BCB6中SCALERICHVIEW加入GIF动画

    记载下,花了不少时间. 1.  项目导入文件GIFImage.pas 来源:http://melander.dk/delphi/gifimage/ 2.  项目导入文件RVGifAnimate.pas ...

  3. Log4Net总结

    Log4Net是用来记录日志的,可以将程序运行过程中的信息输出到一些地方(文件.数据库.EventLog等),日志就是程序的黑匣子,可以通过日志查看系统的运行过程,从而发现系统的问题.日志的作用:将运 ...

  4. mysql主从复制-linux版本

    来自:http://www.osyunwei.com/archives/7269.html,改版 mysql主从复制本文采用的是centos6.5+mysql-5.6.23版本之前在 windows7 ...

  5. PHP中strtotime函数使用方法分享

    在PHP中有个叫做strtotime的函数.strtotime 实现功能:获取某个日期的时间戳,或获取某个时间的时间戳.strtotime 将任何英文文本的日期时间描述解析为Unix时间戳[将系统时间 ...

  6. 重拾C,一天一点点_5

    switch(表达式){    case 整型常量表达式:语句序列    case 整型常量表达式:语句序列    default:语句序列} while(表达式)    语句 for(表达式1; 表 ...

  7. 关于SQLite的创建以及使用相关说明

    关于SQLite的创建以及使用相关说明 没有给出具体的程序,但看完这后可能对你有所帮助. 数据库操作基本知识: execSQL(String sql): 执行一个数据库语句 insert(table, ...

  8. Application,Session和Cookie

    做ASP.NET,肯定会和这几个对象打交道,这些也是基础面试的常见题目,总结一下还是必要的,好在大神已经总结好了,直接参考就好了: http://www.cnblogs.com/breezeblew/ ...

  9. SQL Server Management Studio Keyboard shortcuts

    一些平时在SQL Server Management Studio 使用到的快捷键 F5 (Ctrl+x)执行选中部分的语句,没有选中则全文执行 Ctrl+L 现实执行计划(估计) Ctrl+M 在运 ...

  10. 详解C/C++预处理器

     C/C++编译系统编译程序的过程为预处理.编译.链接.预处理器是在程序源文件被编译之前根据预处理指令对程序源文件进行处理的程序.预处理器指令以#号开头标识,末尾不包含分号.预处理命令不是C/C++语 ...