Solution to linux vps unable to wget remote files

888u

Last update at :2024-04-26,Edit by888u

It occasionally happens that vps cannot wget remote files. Most of the reasons are that wget is not installed. In this case, you can just install it yourself.

If it is confirmed that it has been installed, but still cannot wget, it may be due to a DNS problem with the vps itself. At this time, we need to modify the system's DNS to solve the problem. Generally, we change to Google's DNS.


1. Temporary modification

Sometimes we don't want to modify the system settings, but just want to temporarily download files. At this time, we can make temporary changes.

vi /etc/resolv.conf

After opening the file, press the letter [I] to edit it.

Change [nameserver] to

nameserver 8.8.8.8

nameserver 8.8.4.4

Then press [Esc] and then [:wq] to exit and save.

Of course, it is really inconvenient to edit files with vi. You can also use [WinSCP] to open and edit files online.


2. Permanent modification

Using the above method, if we restart the VPS, it will be the original default DNS again.

If we need to permanently modify the DNS, then we must use the first method

1. centos series

vi /etc/sysconfig/network-scripts/ifcfg-eth0

Add in the last two lines:

DNS1=8.8.8.8

DNS2=8.8.4.4

2. debian series

vi /etc/dhcp/dhclient.conf

Then add in the last line of dhclient.conf

prepend domain-name-servers 8.8.8.8, 8.8.4.4;


Generally speaking, foreign hosts already use Google's DNS, but hosts in mainland China generally do not. If you don't modify it, sometimes various strange problems may occur when installing certain one-click packages.

Recommended site searches: free virtual host, free cloud server, domain name query, foreign virtual host, domain name resolution server, domain name transfer, US server defense, domain name transfer, domain name registration center, Hong Kong host, < /p>

Solution to linux vps unable to wget remote files

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码