添加本地 yum源

添加本地 yum源
yum-updatesd.conf yum的主配置文件
 
[root@zhou ~]# cd /etc/yum.repos.d/
[root@zhou yum.repos.d]# ls
rhel-debuginfo.repo
rhel-debuginfo.repo  方括号里面的名字不能一样,名字随意起。
baseurl=file:///mnt/Server    文件系统的路径
enable=1   这个改成1
gpgcheck=0 改成0
 
以下是Oracle Linux 5.7  public-yum-oel5u7.repo文件
[oel5u7]
name = Oracle Enterprise Linux 5.7-64bit DVD
baseurl=file:///mnt/Server/
gpgcheck=0
enable=1
 
 
以下是CentOS 6配置文件
[centos6]
name = Oracle Enterprise Linux 6.4-64bit DVD
baseurl=file:///mnt/
gpgcheck=0
enable=1
 
 
 
以下是CentOS 7  配置文件

mkdir /media/CentOS
mount -t auto /dev/cdrom /media/CentOS

vi /etc/yum.repos.d/CentOS-Base.repo
[centos7]
name = Oracle Enterprise Linux 7-64bit DVD
baseurl=file:///media/CentOS/
gpgcheck=0
enable=1

然后挂载光盘
mount /dev/cdrom  /mnt
yum list
 
清除设置  : yum clean
 
yum安装
yum -y install baoming.rpm  包名可以不全。-y :确认。
 

改成阿里云源

1、备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/

 
CentOS 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

 

 
CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

 

 
CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 
3、之后运行yum makecache生成缓存


原文地址:https://www.cnblogs.com/l10n/p/7528529.html