写在前面
工作中经常需要查看在线文档,在没有网络的情况下如何查看在线文档呢?计划使用HTTRACK将文档克隆到本地,然后离线查看。
CENTOS7 安装
A. HTTRACK的官网:https://www.httrack.com
B. 下载:wget https://download.httrack.com/cserv.php3?File=httrack.tar.gz
C. 按如下4条命令执行:
# tar -xzvf httrack.tar.gz
# cd httrack-3.49.2
# ./configure
# make
# make install
如何使用
在命令行中执行如下命令:
# httrack
Welcome to HTTrack Website Copier (Offline Browser) 3.49-2
Copyright (C) 1998-2017 Xavier Roche and other contributors
To see the option list, enter a blank line or try httrack --help
# 输入项目名称
Enter project name :baidu
# 输入本地存储路径
Base path (return=/root/websites/) :/root/test/baidu
# 输入抓取的网站地址
Enter URLs (separated by commas or blank spaces) :https://www.baidu.com/
# 选择抓取模式
Action:
(enter) 1 Mirror Web Site(s)
2 Mirror Web Site(s) with Wizard
3 Just Get Files Indicated
4 Mirror ALL links in URLs (Multiple Mirror)
5 Test Links In URLs (Bookmark Test)
0 Quit
: 4
# 是否使用代理(直接回车)
Proxy (return=none) :
You can define wildcards, like: -*.gif +www.*.com/*.zip -*img_*.zip
# 定义通配符(直接回车)
Wildcards (return=none) :
You can define additional options, such as recurse level (-r<number>), separated by blank spaces
To see the option list, type help
# 抓取选项(直接回车)
Additional options (return=none) :
---> Wizard command line: httrack https://www.baidu.com/ -O "/root/test/baidu/baidu" --mirrorlinks -%v
# 是否启动(输入Y)
Ready to launch the mirror? (Y/n) :Y
WARNING! You are running this program as root!
It might be a good idea to run as a different user
Mirror launched on Mon, 29 Apr 2024 08:50:43 by HTTrack Website Copier/3.49-2 [XR&CO'2014]
mirroring https://www.gushiwen.cn/ with the wizard help..
....
Done.
# 抓取完毕
Thanks for using HTTrack!