[FrontPage] [TitleIndex] [WordIndex

This is a read-only archived version of wiki.centos.org

Automated RPMForge Repository Installation

1. What is RPMForge?

You can find more information about RPMForge here. If you feel that you need something beyond the scope of native CentOS repositories you should definitely try using RPMForge.

2. Installing repository

Become root.

If you are not yet in your home directory execute:

cd ~

Then we need to create a script file, which will do automatic installation. Execute the following command:

cat ->rpmforge_inst.sh

Then just paste the following code into console:

exit_with_message() {
        echo $1;
        exit 1;
}
echo -e "FractalizeR's RPM Forge Repository Installation Script for CentOS v0.91\n"
arch=`uname -i`
echo "Detected architecture is $arch"
RELEASE=`awk '{ print $3 }' < /etc/redhat-release`
MAJOR=`echo $RELEASE | awk -F. '{ print $1 }'`
MINOR=`echo $RELEASE | awk -F. '{ print $2 }'`
echo "Detected CentOS Release: $RELEASE, Major=$MAJOR, Minor=$MINOR"
repoVer="0.5.1-1"
if [ `id -u` != 0 ]; then
        echo "You need to be root!"
        exit 1
fi
repoFileName="/etc/yum.repos.d/CentOS-Base.repo"
if [ ! -r $repoFileName -o ! -w $repoFileName ]; then
        echo "Repository file $repoFileName is not readable or writtable!"
        exit 1
fi
echo "Installing yum-priorities plugin..."
yum -y install yum-priorities
condition=`grep priority $repoFileName`
if [ -z "$condition" ]; then
    sed -i.back -e 's/\[base\]/\[base\]\npriority=1/' -e 's/\[addons\]/\[addons\]\npriority=1/' -e 's/\[updates\]/\[updates\]\npriority=1/' -e 's/\[extras\]/\[extras\]\npriority=1/' -e  's/\[centosplus\]/\[centosplus\]\npriority=2/' -e 's/\[contrib\]/\[contrib\]\npriority=2/' $repoFileName
    echo "Repository file edited ok"
else
        echo "Priorities for base packages already set!"
fi

echo "Loading RPMForge RPM..."

wget "http://packages.sw.be/rpmforge-release/rpmforge-release-$repoVer.el$MAJOR.rf.$arch.rpm" || exit_with_message "RPMForge RPM download failed!"

echo "Importing RPM Forge GPG key..." 
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt || exit_with_message "RPMForge GPG key download failed!"

echo "Verifying RPMForge RPM..."
rpm -K rpmforge-release-$repoVer.el$MAJOR.rf.*.rpm || exit_with_message "RPMForge GPG key verification failed!"

echo "Installing RPMForge RPM..."
rpm -i rpmforge-release-$repoVer.el$MAJOR.rf.*.rpm || exit_with_message "RPMForge RPM installation failed!"

echo "Editing RPMForge repo file..."
repoFileName="/etc/yum.repos.d/rpmforge.repo"
if [ ! -r $repoFileName -o ! -w $repoFileName ]; then
    "Repository file $repoFileName is not readable or writtable!"
    exit 1
fi
condition=`grep priority $repoFileName`
if [ -z "$condition" ]; then
    sed -i.back 's/\[rpmforge\]/\[rpmforge\]\npriority=20/' $repoFileName
else
    echo "Priorities for rpmforge packages already set!"
fi
rm -f rpmforge-release-$repoVer.el$MAJOR.rf.$arch.rpm
echo "Done!"

Now press Ctrl-D. Sometimes you should press it twice (don't know why). Now we need to make this file executable:

chmod u+x rpmforge_inst.sh

And then just execute the file we created:

./rpmforge_inst.sh

Automatic installation of RPMForge repository is now in progress. In a few seconds you are done and you can check results with

yum repolist

Voila!


2023-09-11 07:23