欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

centos替换源

程序员文章站 2022-03-16 20:42:48
!/bin/sh 本文原内容来自:https://github.com/judasn/Linux Tutorial/blob/master/CentOS Extra Packages.md 可能额外需要移除/etc/yum.repos.d/mirrors rpmforge中失效的源,以及移除对应的. ......

#!/bin/sh

# 本文原内容来自:https://github.com/judasn/linux-tutorial/blob/master/centos-extra-packages.md
## 可能额外需要移除/etc/yum.repos.d/mirrors-rpmforge中失效的源,以及移除对应的.repo文件

echo "源设置开始"

echo "备份默认源设置"

sudo mv /etc/yum.repos.d/centos-base.repo /etc/yum.repos.d/centos-base.repo.backup

cd /etc/yum.repos.d/

echo "下载网易 centos6 源"

sudo wget http://mirrors.163.com/.help/centos6-base-163.repo

echo "安装网易 centos6 源"

sudo mv centos6-base-163.repo centos-base.repo

rpm --import /etc/pki/rpm-gpg/rpm-gpg-key-centos-6

echo "清除缓存后更新程序"

sudo yum clean all

sudo yum makecache

sudo yum update -y

echo "使用第三方源"

echo "安装 epel 源"

sudo yum install -y epel-release

rpm --import /etc/pki/rpm-gpg/rpm-gpg-key-epel-6

echo "安装 repoforge 源"

wget

sudo rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

sudo rpm --import /etc/pki/rpm-gpg/rpm-gpg-key-rpmforge-dag

echo "清除缓存后更新程序"

sudo yum clean all

sudo yum makecache

sudo yum update -y

echo "测试安装 htop"

sudo yum install -y htop

echo "完成源设置"