How to install wget in the virtual machine Centos7 environment

1. Introduction to wget
Wget is a free tool for automatically downloading files from the Internet. It supports downloading through the three most common TCP/IP protocols, HTTP, HTTPS, and FTP, and can use HTTP proxy. The name "wget" comes from the combination of "World Wide Web" and "get". The so-called automatic download means that wget can continue to execute in the background after the user exits the system until the download task is completed.
Startup:
-V, --version Exit after displaying the version of wget
-h, --help Print syntax help -b, --background Execute in the background
after startup –header=STRING Insert the string STRING in the headers –proxy-user=USER Set the proxy user name as USER –proxy-passwd=PASS Set the proxy password as PASS –referer=URL Include .listing’ in the HTTP request file -g, --glob=on/off Turn filename globbing on or off --passive-ftp uses passive transfer mode (default). --active-ftp uses active transfer mode --retr-symlinks When recursive, Point links to files (not directories) for recursive downloads: -r, --recursive recursive downloads - use with caution!
.wgetrc'格式的命令,wgetrc格式参见/etc/wgetrc或~/.wgetrc wget默认会根据网站的robots.txt进行操作 使用-e robots=off参数即可绕过该限制 记录和输入文件: -o, --output-file=FILE 把记录写到FILE文件中 -a, --append-output=FILE 把记录追加到FILE文件中 -d, --debug 打印调试输出 -q, --quiet 安静模式(没有输出) -v, --verbose 冗长模式(这是缺省设置) -nv, --non-verbose 关掉冗长模式,但不是安静模式 -i, --input-file=FILE 下载在FILE文件中出现的URLs -F, --force-html 把输入文件当作HTML格式文件对待 -B, --base=URL 将URL作为在-F -i参数指定的文件中出现的相对链接的前缀 --sslcertfile=FILE 可选客户端证书 --sslcertkey=KEYFILE 可选客户端证书的KEYFILE --egd-file=FILE 指定EGD socket的文件名 下载: --bind-address=ADDRESS 指定本地使用地址(主机名或IP,当本地有多个IP或名字时使用) -t, --tries=NUMBER 设定最大尝试链接次数(0 表示无限制). -O --output-document=FILE 把文档写到FILE文件中 -nc, --no-clobber 不要覆盖存在的文件或使用.#前缀 -c, --continue 接着下载没下载完的文件 --progress=TYPE 设定进程条标记 -N, --timestamping 不要重新下载文件除非比本地文件新 -S, --server-response打印服务器的回应 --spider 不下载任何东西 -T, --timeout=SECONDS 设定响应超时的秒数 -w, --wait=SECONDS 两次尝试之间间隔SECONDS秒 --waitretry=SECONDS 在重新链接之间等待1...SECONDS秒 --random-wait 在下载之间等待0...2*WAIT秒 -Y, --proxy=on/off 打开或关闭代理 -Q, --quota=NUMBER 设置下载的容量限制 --limit-rate=RATE 限定下载速率 目录: -nd --no-directories 不创建目录 -x, --force-directories 强制创建目录 -nH, --no-host-directories 不创建主机目录 -P, --directory-prefix=PREFIX 将文件保存到目录 PREFIX/... --cut-dirs=NUMBER 忽略 NUMBER层远程目录 HTTP 选项: --http-user=USER 设定HTTP用户名为 USER. --http-passwd=PASS 设定http密码为 PASS. -C, --cache=on/off 允许/不允许服务器端的数据缓存(一般情况下允许). -E, --html-extension 将所有text/html文档以.html扩展名保存 --ignore-length 忽略



Referer: URL'头 -s, --save-headers 保存HTTP头到文件 -U, --user-agent=AGENT 设定代理的名称为 AGENT而不是 Wget/VERSION. --no-http-keep-alive 关闭 HTTP活动链接 (永远链接). --cookies=off 不使用 cookies. --load-cookies=FILE 在开始会话前从文件 FILE中加载cookie --save-cookies=FILE 在会话结束后将 cookies保存到 FILE文件中 FTP 选项: -nr, --dont-remove-listing 不移走






-l, --level=NUMBER maximum recursion depth (inf or 0 for infinite).
--delete-after delete files locally after completion
-k, --convert-links convert non-relative links to relative links
-K, --backup -converted Before converting file X, back it up as X.orig
-m, --mirror Equivalent to -r -N -l inf -nr.
-p, --page-requisites Download all images showing HTML file

2. On the newly installed virtual machine Linux, there is no wget command, and the system prompts "-bash wget: command not found". You
insert image description here
can use the command to check whether the system has the original wget rpm -qa|grep "wget".
insert image description here
If it exists, you can delete it first. Operate yum remover wget, and then execute it again to check whether the deletion is successful.

Log in to the official website of wget and download the latest rpm installation package of wget to the local http://mirrors.163.com/centos/7/os/x86_64/Packages/
insert image description here
to download wget-1.14-18.el7_6.1.x86_64 The .rpm installation package is uploaded to the directory on the virtual machine server through xftp. For example, create a wget file directory under the /home directory of the virtual machine, and upload the just downloaded rpm installation package to the wget directory.

insert image description here

insert image description here

After uploading, you can query whether the file has been successfully uploaded to the server through the command through the centos terminal.
insert image description here
After finding the installation package, execute the installation command to install rpm -ivh wget-1.14-18.el7_6.1.x86_64.rpm

insert image description here
Then execute the query command to check whether the installation is successful rpm -qa|grep "wget"

insert image description here
You can query the version information content of wget through wget -V. If you look at the following information so far, it means that the installation is successful and you can use the wget command normally.

insert image description here

Guess you like

Origin blog.csdn.net/lssffy/article/details/131472442