My installation environment is RedHatEnterpriseLinux5, jdk6, and tomcat6. 1. For the environment requirement 1.1SunJDK1.5or higher, set NUTCH_JAVA_HOME as the root of your JVM installation. 1.2 & n
My installation environments are Red Hat Enterprise Linux 5, jdk6, and tomcat6.
1. Environment requirements
1.1 Sun JDK 1.5 or later, set "NUTCH_JAVA_HOME" as the root of your JVM installation.
1.2 Apache's Tomcat 5.x or later.
1.3 1 GB hard disk space
2. Start preparation
First, you need to get the installation package of nutch.
Http://labs.renren.com/apache-mirror//nutch/
What I download is apache-nutch-1.3-bin.tar.gz. Decompress the package and enter its root directory.
Run the following command:
Runtime/local/bin/nutch to get-bash: runtime/local/bin/nutch: the permission is not enough. It indicates that the execution permission of the program is not available.
Chomd 755 runtime/local/bin/nutch (grant the execution permission to nutch)
Then run runtime/local/bin/nutch to display the usage of the nutch command.
Good! You can "capture your website. You need to give your crawler a name. This is required. Otherwise, he cannot "catch ".
Edit $ NUTCH_HOME/conf/nutch-site.xml ($ NUTCH_HOME/runtime/local/conf/nutch-site.xml with version> = 1.3) to add the following content
Http. agent. name
YourCRAWLERWww.linuxidc.com
Replace"YourCRAWLERThe name is www.linuxidc.com ".
Now we have to prepare crawl. There are two ways to use crawl.
3. Capture commands
When you plan to climb about 1 million pages on a few Web servers, it is appropriate to search for commands.
Capture command: Configuration
Something you must configure to catch
A. Create A directory and create A file in the directory to store the website address. For example, if you want to capture a website named "Nutch", you may first create a file named "urls/nutch", which only contains the URL of the home page of the website. From this page, all other pages of the Nutch can be accessed. So the file should contain http://lucene.apache.org/nutch/
B. edit the file $ NUTCH_HOME/runtime/local/conf/regex-urlfilter.txt and replace
# Accept anything else+.
Match the domain to be crawled. For example, if you want to restrict crawling to the apache.org domain, the row should be changed:
+ ^ Http: // ([a-z0-9] * \.) * apache.org/
This expression will include all apache URLs.
Capture command: Run capture
Once the task is configured, it is easy to run the capture task. You only need to use the capture command. The options include:
·-Dir DirNames thedirectory to put the crawl in.
·-Threads ThreadsDetermines thenumber of threads that will fetch in parallel.
·-Depth DepthIndicatesthe link depth from the root page that should be crawled.
·-TopN NDetermines the maximum number of pages that will be retrieved ateach level up to the depth.
Typical command bin/nutch crawl urls/nutch-dir crawl-depth 3-topN 50
{Typicallyone starts testing one's configuration by crawling at shallow depths, sharplylimiting the number of pages fetched at each level (-topN ), and watching theoutput to check that desired pages are fetched and undesirable pages are not. once one is confident of the configuration, then an appropriate depth for afull crawl is around 10. the number of pages per level (-topN) for a full crawler can be from tens of thousands to millions, depending on your resources .}
A detailed introduction to Nutch: Click here
The: Click here