远程调用下载文件直接用wget http就可以,一般文件路径类型是http。如果有遇到是https就会下载出错。
例如:
[root@localhost jenkins]# sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
-bash: udo: command not found
[root@localhost jenkins]# sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
--2019-11-29 20:48:39-- https://pkg.jenkins.io/redhat-stable/jenkins.repo
Resolving pkg.jenkins.io (pkg.jenkins.io)... 52.202.51.185
Connecting to pkg.jenkins.io (pkg.jenkins.io)|52.202.51.185|:443... connected.
ERROR: cannot verify pkg.jenkins.io's certificate, issued by ‘/C=US/ST=VeriSign, Inc./L=VeriSign Trust Network/O=Terms of use at https://www.verisign.com/rpa/OU=Terms of use at https://www.verisign.com/rpa/CN=VeriSign Class 1 Extended Validation CA’:
Unable to locally verify the issuer's authority.
To connect to pkg.jenkins.io insecurely, use `--no-check-certificate'.
只需要在wget后面加上--no-check-certificate就可以,需要一个认证下载指令而已。
即:sudo wget --no-check-certificate -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo