How To Enable A Repo Using Perl

Published Date Author: , Posted September 4th, 2011 at 10:50:30am

Normally, I have to specify the desired repo on the command line:
yum --enablerepo=remi,remi-test install {package name here}

To enable the Remi repo so you do not have to specify it on the command line:
# perl -pi -e 's/enabled=0/enabled=1/g' /etc/yum.repos.d/remi.repo

To disable the Remi repo so you do not have to specify it on the command line:
# perl -pi -e 's/enabled=1/enabled=0/g' /etc/yum.repos.d/remi.repo

Of course, you could just edit the file by hand…

No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.