i dont know linux that much
Me neither. Who is this Linux Stallman anyway?
what is rsync a distro's mirror??
Rsync synchronises contents of directories. Once you have downloaded a copy of the remote directory it will only transfer changes (in this case new packages) which is efficient.
what is sneakernet??
See
http://catb.org/jargon/html/S/sneakernet.html
i have to write my yum.conf,yum cache dir & rpm db dir in a cd and take it to my friends house.
I'd prefer a removable storage like an external USB harddisk, USB stick or Flash Card, but yes, that's the idea.
then how to separate it, i mean different config files on my friends pc.
Make sure your hostname is set to something less generic than "localhost". Now, on your box:
Code:
HOST=$(hostname -s)
mv /etc/yum.conf /etc/yum-${HOST}.conf
mv /var/cache/yum /var/cache/yum-${HOST}
mv /var/lib/rpm /var/lib/rpm-${HOST}
ln -sf /etc/yum-${HOST}.conf /etc/yum.conf
ln -sf /var/cache/yum-${HOST} /var/cache/yum
ln -sf /var/lib/rpm-${HOST} /var/lib/rpm
tar -cjf /tmp/yum-${HOST}.tar.bz2 /etc/yum.conf /var/cache/yum /var/lib/rpm
now copy the /tmp/yum-${HOST}.tar.bz2 to the media of choice.
Let him make a backup of the targetted files and directories. Then make sure he has his hostname set to something less generic than "localhost". Now, his box copy in your /tmp/yum-YOURHOSTNAME.tar.bz2 and:
Code:
HOST=$(hostname -s)
mv /etc/yum.conf /etc/yum-${HOST}.conf
mv /var/cache/yum /var/cache/yum-${HOST}
mv /var/lib/rpm /var/lib/rpm-${HOST}
tar -xjf /tmp/yum-YOURHOSTNAME.tar.bz2 -C /
ln -sf /etc/yum-${HOST}.conf /etc/yum.conf
ln -sf /var/cache/yum-${HOST} /var/cache/yum
ln -sf /var/lib/rpm-${HOST} /var/lib/rpm
Now all should be set. Save this to an executable file named /usr/local/bin/yum_switch. File owner/group is root and mode is 0750:
Code:
#!/bin/sh
# whoami: yum_switch
# Purpose: switch Yum cache
# Args: hostname
# Deps: Bash, GNU utils, yum, rpm
# Run from: manual or cron
# Prepstage functions
progn=${0//*\//}
# set error mode when testing:
set -e
case "$1" in
s) shift 1; expr index "$1" "-+=;\#\'\"\$\&\*/" >/dev/null || host="$1";
test -f /etc/yum-${host}.conf && \
ln -sf /etc/yum-${host}.conf /etc/yum.conf || \
echo "${progn} [ERROR]: failed to link yum.conf." > /dev/stderr
test -d /var/cache/yum-${host} && \
ln -sf /var/cache/yum-${host} /var/cache/yum || \
echo "${progn} [ERROR]: failed to link yum cache." > /dev/stderr
test -d /var/lib/rpm=${host} && \
ln -sf /var/lib/rpm-${host} /var/lib/rpm || \
echo "${progn} [ERROR]: failed to link rpm db." > /dev/stderr
;;
*) echo "${progn} [-s hostname]"; exit 1
;;
esac
exit 0
Before he runs yum for *his* box he needs to do "yum_switch HISHOSTNAME". He may use all yum commands.
When you show up for updates, run "yum_switch YOURHOSTNAME". You should only use "yum update --download-only", that is: no clean, remove or install commands. Switch back with "yum_switch HISHOSTNAME" when you're done. Now your yum cache should have the downloaded updates for your box and you can tar /var/cache/yum-YOURHOSTNAME and /var/lib/rpm-YOURHOSTNAME up and sneakernet it back to your box. Remember: you always need to bring along your fresh copy of /var/cache/yum-YOURHOSTNAME and /var/lib/rpm-YOURHOSTNAME and return it. /etc/yum-YOURHOSTNAME.conf not if you don't change it.
BIG FAT WARNING. I know GNU/Linux is versatile, extendible and on and on and for that I am sure this will work. It may however not. Making backups is a good practice anyway.
rpm -ivh <fn>.rpm
and what is i,v,h??
The fun thing is the docs are on your system. Try running "man rpm". Now type -i and press return. See?
so downloading a rpm and installing with the the above command will work??
Yes.