Ph: 19216812

Archive

Posts Tagged ‘repo’

How to install a specific version of some rpm with YUM

November 23rd, 2008

You want to install a special version of openssl that’s not the latest release, but some other app requires that specific one — how do you do it?

Lets assume you don’t have the right repository installed, and you need to set that up first.  If you’re looking for some package that you know is in freshrpms or livna, then right out of the box, the default fedora installation won’t look in those repositories.  So import the GPG key and add the repo file.

The –import lets the gpg check pass, and will fail if someone tries to stick a bad package in their repo, unless they’ve gotten ahold of their key a-la the fedora fiasco a few months ago.  But don’t worry about any of that right now.  Just import the key or else yum will complain when you try to install anything.  The 2nd line “rpm -ivh”, that’s going to install a package.  The package will have the .repo file, and it will put it in /etc/yum.repos.d/  that’s what really enables you to search in freshrpms.

Here’s another one, installing livna this time (livna is great for nvidia and ati drivers.  They compile the video drivers for specific kernels and package them for you.)

Now onto installing a specific version of something.  If you know what you’re looking for, say openssl for example, put the version after the package name when you install it from the command line.  You can also specify the architecture and distribution release version too.  But when that doesn’t work, try this:

Find a mirror somewhat geographically close to you, or one that you know will serve your requests fast, and click on “http”.  I’ll choose mirrors.kernel.org.  At this point you’ll be in a basic directory browsing mode.
<a href="http://mirrors.kernel.org/fedora/?C=N;O=D">Name</a>                    <a href="http://mirrors.kernel.org/fedora/?C=M;O=A">Last modified</a>      <a href="http://mirrors.kernel.org/fedora/?C=S;O=A">Size</a>
<hr /><a href="http://mirrors.kernel.org/">Parent Directory</a>                             -
<a href="http://mirrors.kernel.org/fedora/core/">core/</a>                   17-Oct-2006 12:46    -
<a href="http://mirrors.kernel.org/fedora/development/">development/</a>            23-Nov-2008 06:30    -
<a href="http://mirrors.kernel.org/fedora/extras/">extras/</a>                 18-Jun-2007 21:00    -
<a href="http://mirrors.kernel.org/fedora/releases/">releases/</a>               18-Nov-2008 22:12    -
<a href="http://mirrors.kernel.org/fedora/updates/">updates/</a>                21-Nov-2008 19:16
From here I clicked updates, then 9, then x86_64.newkey and ended up here: http://mirrors.kernel.org/fedora/updates/9/x86_64.newkey/  with a huge list of packages.
Find the package you want, http://mirrors.kernel.org/fedora/updates/9/x86_64.newkey/openssl-0.9.8g-9.fc9.i686.rpm“>openssl-0.9.8g-9.fc9.i686.rpm for example, and download it.
Find this file in a terminal.  It’s probably going to download to your home directory, or ~/Desktop but that all depends on how your browser is set up.  Once you’re there, here’s the line to install it properly.

$ sudo yum localinstall openssl-0.9.8g-9.fc9.i686.rpm

The end result is exactly the same as if you installed from the repository.

Linux fedora, howto, install, repo, yum

Setup your own YUM repository, the easy way!

September 25th, 2008

I don’t understand why some people think this is a complicated thing to set up, so here goes my approach which I think is the easiest method.  Perhaps you’re behind a very restrictive corporate firewall or you want to conserve bandwidth when you’re setting up several machines.  You can set up your own repositories on one machine in your network and have it download the packages and updates in the off-hours.  Whenever a client machine on your network wants updates, they’ll get them much faster and you’ll save bandwidth too.

Step-by-step:

Install createrepo on the machine you want to be your update server.

[user@hostname ~]$ sudo yum install createrepo

Now you’ll create a few crons to create and maintain your mirror.  Let’s start with the one that does the grunt work of downloading the packages.  I’ll go ahead and set a bandwidth limit and log my mirroring.  I don’t care about debug stuff so i’ll exclude that and any iso’s that may get dumped in there too.

#!/bin/sh
# GET THE LATEST PACKAGES
/usr/bin/rsync -aq –bwlimit=500 –stats –log-file=/var/log/rsync/i386.rsync.1.log rsync://your-favorite-linux-mirror/linux/updates/9/i386.newkey/ –exclude=debug/ –exclude=*.iso /opt/yum/updates/8/i386/
/usr/bin/rsync -aq –bwlimit=500 –stats –log-file=/var/log/rsync/x86_64.rsync.1.log rsync://your-favorite-linux-mirror/linux/updates/9/x86_64.newkey/ –exclude=debug/ –exclude=*.iso /opt/yum/updates/8/x86_64/

Create a cron to update your repo as new rpms get mirrored.

#!/bin/sh
# CREATE/MAINTAIN MY LOCAL REPOSITORY
/usr/bin/createrepo –update /opt/yum/base/8/i386
/usr/bin/createrepo –update /opt/yum/base/8/x86_64

Create another cron to rotate your logs, saving the last week’s worth.

#!/bin/sh
# ROTATE THE LOGS
rm -f /var/log/rsync/yum-rsync-log7.tar.gz
mv -f /var/log/rsync/yum-rsync-log6.tar.gz /var/log/rsync/yum-rsync-log7.tar.gz
mv -f /var/log/rsync/yum-rsync-log5.tar.gz /var/log/rsync/yum-rsync-log6.tar.gz
mv -f /var/log/rsync/yum-rsync-log4.tar.gz /var/log/rsync/yum-rsync-log5.tar.gz
mv -f /var/log/rsync/yum-rsync-log3.tar.gz /var/log/rsync/yum-rsync-log4.tar.gz
mv -f /var/log/rsync/yum-rsync-log2.tar.gz /var/log/rsync/yum-rsync-log3.tar.gz
mv -f /var/log/rsync/yum-rsync-log1.tar.gz /var/log/rsync/yum-rsync-log2.tar.gz
mv -f /var/log/rsync/yum-rsync-log.tar.gz /var/log/rsync/yum-rsync-log1.tar.gz
tar -czf /tmp/yum-rsync-log.tar.gz /var/log/rsync/*.log
rm -rf /var/log/rsync/*.log
mv -f /tmp/yum-rsync-log.tar.gz /var/log/rsync/

On your client machines, move or delete the existing repo definitions and create a new one that points to your local repositories.  Assuming your server machine’s IP address is 192.168.1.2 and you’re using Fedora your new repo definitions would look something like this:

[fairfield-base]
name=My_Local_Repo - base - Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://192.168.1.2/yum/base/$releasever/$basearch
enabled=1
gpgcheck=1

[fairfield-updates]
name=My_Local_Repo - updates - Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://192.168.1.2/yum/updates/$releasever/$basearch
enabled=1
gpgcheck=1

Wait until your cron fills your repositories or download a few packages and run your createrepo.  From now on your updates will execute much faster.  And if you want to build new machines, you can point your kickstart to get packages from your local mirror instead of just your cdrom so you can build machines that are fully up to date right out of the box.  Try updating on your clients.  You should notice it takes ten times longer to install the updates than it does to download them.

[user@hostname ~]$ sudo yum update

http://blog.rootninja.com/wp-content/uploads/2008/09/rootninja_80×151.jpg“>[image]http://blog.rootninja.com/wp-content/uploads/2008/09/rootninja_80×151.jpg” alt=”root|ninja” width=”80″ height=”15″ />

Linux Linux, packages, repo, rpm, rsync, server, updates, yum


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser
Mobilytics