How to install wget in Linux environment (CentOS 7 system)

Problem phenomenon:

When using the wget command that comes with Linux to download and install related applications, the prompt: "sudo: wget: command not found"

As shown below:

problem causes:

(1) The Linux server itself does not have its own wget installed, but this is rarely the case.
(2) The wget version of the Linux server is too low to install other applications through the wget command.

Analysis process:

First, enter the following command in the Linux server window to check if wget has been installed on the Linux server.
If it appears as shown in the figure below, it means that wget has been installed, but the version is too low. You need to uninstall the original version and install the latest version of wget.
If it does not appear as shown in the figure below, it means that the Linux server itself does not have its own wget installed, just install the latest version of wget directly.

rpm -qa|grep "wget"

Solution:

(1) Here we default that the Linux server itself has installed wget, then execute the following command to uninstall the original wget first.
Note: If wget is not installed on the Linux server itself, skip this step and go directly to step (3)

yum remove wget

(2) Execute the command rpm -qa|grep "wget" again to check whether wget is uninstalled

rpm -qa|grep "wget"

(3) Log in to the download address of wget official website and download the latest wget rpm installation package to the local

Official website address: http://mirrors.163.com/centos/7/os/x86_64/Packages/

(4) Upload the downloaded rpm installation package of wget to the corresponding directory of the Linux server through the Xftp tool.
For example, we manually create a wget file directory in the /usr/local directory, and then upload the downloaded wget-1.14-18.el7_6.1.x86_64.rpm to this wget directory through the Xftp tool

(5) The cd command enters the wget directory, and then the ls command to check whether the wget-1.14-18.el7_6.1.x86_64.rpm file is uploaded successfully

cd /usr/local/wget
ls

(6) Execute the following command to start running and install wget

rpm -ivh wget-1.14-18.el7_6.1.x86_64.rpm

(7) Execute the following command to check whether wget is installed

rpm -qa|grep "wget"

(8) Execute the following command to view the version information of wget

wget -V

(9) Check whether wget is available after installation

For example, if we install jenkins through the wget command, it appears as shown in the following figure, that is, jenkins can be successfully installed through the wget command, which means that our wget has also been successfully installed.

sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo

Guess you like

Origin blog.csdn.net/weixin_43184774/article/details/110191309