nutch 安装部署 以nutch2.3.1 为例

[/size][size=medium]最近在研究nutch 在Ubuntu系统上安装部署nutch,nutch安装步骤如下:
1、先 安装ANT (ant下载安装包就不写了 百度一大把)
//解压 ant
sudo tar -zxvf   /usr/test/soft/apache-ant-1.9.7-bin.tar.gz -C /usr
//移动ant (这里只是把安装的文件放到一目录下,方便管理。)
sudo mv /usr/test/apache-ant-1.9.7 /usr/test/ant1.9
修改/usr/test/ant1.9/bin/ant文件,添加如下内容
export JAVA_HOME=/usr/jdk1.7    
这里需要修改在ant文件中添加java_home 的路径

2、安装nutch
//解压nutch
sudo tar -zxvf /usr/test/soft/apache-nutch-2.3.1-src.tar.gz -C /usr

//移动nutch
sudo mv /usr/test/apache-nutch-2.3.1/usr/test/nutch2.3

修改/usr/jiankongyun/nutch2.3/ivy/ivy.xml文件,添加如下内容
<dependency org="org.apache.gora" name="gora-mongodb" rev="0.6.1" conf="*->default" />
//这里用的是mongodb3.2 安装步骤后面的会有详细的文章 特别注意的一点就是 gora 的版本一定要对应,版本太高或者太低都会出现不兼容的问题,还是尽量使用官方的推荐版本

//编译nutch
cd /usr/test/nutch2.3
/usr/test/ant1.9/bin/ant runtime 

编译nutch的过程中 你可能会得到如下错误:
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.
解决方法:
下载sonar-ant-task-2.1.jar,将其拷贝到nutch2.3/lib 目录下面
修改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>

添加完成后再次运行 编译nutch 就可以了。

当然有什么不懂的 可以留言我们www.jiankongyun.net可以多多交流

猜你喜欢

转载自tt9576.iteye.com/blog/2311939