CENTOS6 Yum Configuration Script-source +epel+rpmforge source for 163

Source: Internet
Author: User

Each lecture will be configured Yum, very troublesome, I always answer, wrote a script, a key to complete.

It is a good idea to optimize the installation of the system after it has just been installed.

No more nonsense, on the script

[Email protected] ~]# VI yum_config.sh
#!/bin/bash
#by SCFA 2015-08-01
########### #install Base tools#########
echo "############################"
echo "Make sure can access Internet."
Yum-y install wget lftp yum-plugin-priorities 1>/dev/null &&echo "Tools install OK."


######### #backup Repo file#########
echo "############################"
Repo_d=/etc/yum.repos.d
CD $repo _d
if [!-e $repo _d/rbak];then
mkdir $repo _d/rbak
MV $repo _d/*.repo $repo _d/rbak
Fi

########## #config 163.repo ###############
echo "############################"
m_163= "Centos6-base-163.repo"
echo "config mirrors.163.com repo now."
wget Http://mirrors.163.com/.help/CentOS6-Base-163.repo &>/dev/null
If [-e/etc/repos.d/$m _163];then
Sed-i-E "s/\]$/\]\npriority=1/g"/etc/yum.repos.d/$m _163
echo "163.repo is OK."
Fi

############ #config Epel repository##########
echo "############################"
echo "config epel-release repo now."
Yum-y Install epel-release >/dev/null &&echo "epel-relase install OK."
Sed-i-E "s/\]$/\]\npriority=5/g"/etc/yum.repos.d/epel.repo
Sed-i-E "s/enabled=1/enabled=0/g"/etc/yum.repos.d/epel.repo
epel_f= "/etc/yum.repos.d/epel.repo"
if [!-Z "$ (grep priority $EPEL _f)"-A!-Z "$ (grep 0 $EPEL _f)"];then
echo "Epel repo priority is 5."
echo "Epel usage:yum--enablerepo=epel Install [package]."
Fi

############ #config Rpmforge repository#############
echo "############################"
echo "config Rpmforge repo now."
Yum-y Install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm 1>/dev/ Null&&echo "Rpmforge install OK."
Sed-i-E "s/\]$/\]\npriority=10/g"/etc/yum.repos.d/rpmforge.repo
Sed-i-E "s/enabled = 1/enabled = 0/g"/etc/yum.repos.d/rpmforge.repo

rpmforge_f= "/etc/yum.repos.d/rpmforge.repo"
if [!-Z "$ (grep priority $RPMFORGE _f)"-A!-Z "$ (grep 0 $RPMFORGE _f)"];then
echo "Rpmforge priority is 10."
echo "Rpmforge usage:yum--enablerepo=rpmforge Install [package]."
Fi

: Wq

chmod +x yum_config.sh

./yum_config.sh

This article from "To work smoothly study good system" blog, declined reprint!

CENTOS6 Yum Configuration Script-source +epel+rpmforge source for 163

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.