ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Greetings,
I cannot get 'yum update' on a CentOS 5 box to work through our proxy server at work, and am now looking for a workaround. I am thinking that a script (bash, perl, etc) to do:
1. Take the output of 'yum check-update' and parse out everything but the package name.
2. Take the list of packages and retrieve them to a local directory with wget.
3. Update the box with 'yum localinstall'
4. Delete the updates after successful install.
I am working on a script, but thought would check here in case someone has done this already, or can bang something together quicker than I can.
I cannot get 'yum update' on a CentOS 5 box to work through our proxy server
Why doesn't it work? What did you try? What where the (exact!) errors shown? And if it's using NTLM auth you could try http://ntlmaps.sourceforge.net/.
Quote:
Originally Posted by hackhound
with wget
If yum/apt/autoupdate/whatever else doesn't work why should wget work?
Why doesn't it work? What did you try? What where the (exact!) errors shown? And if it's using NTLM auth you could try http://ntlmaps.sourceforge.net/.
I don't want to get into alot of detail, because I have already beat this to death trying to get yum update to work. I have my env proxy variable set correctly, but when I execute yum update <packagename> I get:
[Errno -1] Header is not complete.
Quote:
Originally Posted by unSpawn
If yum/apt/autoupdate/whatever else doesn't work why should wget work?
My research of this error seems to indicate the problem lies with the proxy server not being able to handle the yum update request, which I have no control over. I tested wget, and it works fine.
Quote:
Originally Posted by unSpawn
Awww, just post what you got.
OK. Here is what I have so far. It's not pretty because I am taking this in a 'step by step' approach. Basically, what I have so far grabs a list or programs needing to be updated, strips off the status messages on the top 5 lines, grabs just the first column, and then reads each packagename and outputs it to the screen.
#!/bin/bash
cd yum-updates
yum check-update > update.log
sed '1,5d' update.log > yum1.log
awk '{print $1}' yum1.log > yum2.log
for i in $( cat yum2.log ); do
echo $i
done
Next steps would be to replace the 'echo $i' with the wget command, then run yum localinstall, then delete the file.
Like I said, not the nicest looking code, but I'm not an expert, and what I have so far is working.
Hmm. There apparently are no mirrors providing HTTPS but definately Rsync and FTP. Tried using "ftp://mirror.pacific.net.au/linux/fedora/linux" instead of "http://mirror.pacific.net.au/linux/fedora/linux" style URI's in your .repo file?
Hmm. There apparently are no mirrors providing HTTPS but definately Rsync and FTP. Tried using "ftp://mirror.pacific.net.au/linux/fedora/linux" instead of "http://mirror.pacific.net.au/linux/fedora/linux" style URI's in your .repo file?
Well, I tried that, and now it gives me the following:
I don't know what you're doing but "ftp://mirrorlist.centos.org/?release=5&arch=i386&repo=os" does not exist. Next to that I think help should be a two-way street and since you haven't exactly been forthcoming with details. Here's a script: remember YMMV(VM).
Code:
#!/bin/sh -
# Set debug and error mode when testing:
set -xe
# Make it a temp dir?
mkdir /tmp/yum-updates
cd /tmp/yum-updates
# Get list (your command, don't know if it works).
PKGS=$(yum check-update 2>/dev/null| sed '1,5d' | awk '{print $1}')
# Get packages. Replace basurl with the basurl of the repo.
for PKG in $PKGS; do wget "${baseurl}/$PKG" -P /tmp/yum-updates; done
# Install and only delete packages on success.
yum localinstall /tmp/yum-updates/*.rpm && \
rm -rf /tmp/yum-updates/*.rpm
exit 0
I don't know what you're doing but "ftp://mirrorlist.centos.org/?release=5&arch=i386&repo=os" does not exist.
Correct. I did a global replace of http: with ftp: in yum.repos.d, which caused the mirrorlist url to be changed as well. I caught the mistake and changed it back to http:
Quote:
Originally Posted by unSpawn
Next to that I think help should be a two-way street and since you haven't exactly been forthcoming with details.
I do not know how I could be more forthcoming. I have tried everything you suggested and reported back my results. As you may recall, I never asked for help with getting yum to work, as I have beat this to death already without ever finding a solution. All I wanted was a script to give me a workaround, which I see that you have provided below.
Quote:
Originally Posted by unSpawn
Here's a script: remember YMMV(VM).
Code:
#!/bin/sh -
# Set debug and error mode when testing:
set -xe
# Make it a temp dir?
mkdir /tmp/yum-updates
cd /tmp/yum-updates
# Get list (your command, don't know if it works).
PKGS=$(yum check-update 2>/dev/null| sed '1,5d' | awk '{print $1}')
# Get packages. Replace basurl with the basurl of the repo.
for PKG in $PKGS; do wget "${baseurl}/$PKG" -P /tmp/yum-updates; done
# Install and only delete packages on success.
yum localinstall /tmp/yum-updates/*.rpm && \
rm -rf /tmp/yum-updates/*.rpm
exit 0
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.