我们安装完成CentOS系统,默认都是系统自带的yum源,国内用户用yum安装软件的时候,是比较慢的,为了提高效率,一般我们会配置国内的yum源。
国内比较好的yum源有网易yum源、搜狐yum源等,现在介绍下怎么配置网易163yum源:
官方链接【CentOS镜像使用帮助】:http://mirrors.163.com/.help/centos.html
收录架构为:i386,x86_64,SRPMS
收录版本为:5.x和6.x系列
更新时间:每5小时更新一次
1、首先备份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.$(date+%F)_backup
2、根据CentOS不同版本选择下载对应的repo文件,放到/etc/yum.repos.d/ 目录
cd /etc/yum.repos.d/
# CentOS 5.x
wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
# CentOS 6.x
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
3、最后,执行yum makecache生成缓存
yum makecache
OK,简单3步操作即可配置完成。
中科大yum源
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://centos.ustc.edu.cn/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
本地yum源
[yum]
name=yum
baseurl=file:///mnt/
enabled=1 开启本地镜像
gpgcheck=0
yum源配置
vi /etc/rc.local 开机自起
mount /dev/cdrom /mnt
service iptables stop 临时关闭防火墙
chkconfig iptables off 永久关闭防火墙
vi /etc/selinux/config修改/etc/selinux/config 文件中为SELINUX="disabled" ,然后重启。如果不想重启系统,使用命令setenforce 0
原文链接:https://www.f2er.com/centos/380578.html