!/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 http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
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 "完成源設置"