Wednesday, March 9, 2011

Linux: Wget, Yum

One of my co-workers was trying to install Oracle linux update to Fedora linux box. She was trying to do a wget command based on some web site instructions. Her wget failed and was not able to get the repository file at public-yum.oracle.com.

wget http://public-yum.oracle.com/public-yum-ol6.repo

Per suggestions on the web, we tried using host or nslookup for the website. They could not find the web site.

Where as, google site was always found. host google.com and nslookup google.com worked fine. But not to the oracle server. Not even oracle.com showed up when we tried host, nslookup and ping commands.

After googling it up and trying to find solutions, we got to a point, where it pointed to some kind of network issue, probably proxy? I asked her to download the above file manually (she was always able to go to the web page directly in browser) and save to /etc/yum.repos.d directory. Then we tried,

yum list command.

This gave a different error:

IOError: <urlopen error (-2, 'Name or service not known')>

Some more web searches (http://serverfault.com/questions/76421/wget-cant-resolve-host) revealed this to be related to DNS. That was kind of strange. As we were able to ping and nslookup to google.com and we were always able to go to the oracle site in browser.

Anyways, we decided to edit the /etc/resolve.conf file and add some public name servers to it.

nameserver <dns ip address>

This didn't help. Then she logged into a unix box and we looked at the /etc/resolve.conf there. It had only one name server. We copied to the file on Linux box. Bingo!! It worked. So, the problem was that the name servers she had listed in the resolve file didn't resolve oracle servers for some reason.

Yum, Wget etc

I really didn't know much about Yum and Wget until today. While working on this problem, learned a few things:

Wget is a cool utility to download files. Per the wikipedia page , wget (formerly geturl) is a non-interactive replacement for FTP, but it also works with other protocols like HTTP, HTTPS etc. It can download recursively.

Yum is a package manager/installer for Linux. See here for a definition:

http://www.wisegeek.com/what-is-yum.htm

Turns out the .repo file we were having problem with in the first place, is the repository that has some configurations to be used by Yum to download more files and install them.

Note: If you are editing any of the /etc/ files and you already have the console window open, chances the new settings will not be effective. Close all the console windows and start a new one.

No comments :

Post a Comment

I will be happy to hear your comments or suggestions about this post or this site in general.