首页 > 代码库 > yum源简单配置
yum源简单配置
只下载rpm安装包而不进行安装:
安装插件yum-plugin-downloadonly:
[root@saltstack zhongw]yum install yum-plugin-downloadonly
将tcpdump包下载到目录/zhongw下面:
[root@saltstack zhongw]# yum install --downloadonly --downloaddir=/zhongw/ tcpdump
阿里云yum连接:
http://mirrors.aliyun.com/
备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
CentOS 5
wget -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
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
运行yum clear all清除缓存
运行yum makecache生成缓存
本地网络yum源配置:
新建并修改yum配置文件:
vi /etc/yum.repos.d/rh6.7.repo
[base]
Baseurl=http://192.168.1.10/rh6.7/
Gpgcheck=0
Enable=1
或
cat > /etc/yum.repos.d/rh6.7.repo <<EOF
[base]
Baseurl=http://192.168.1.10/rh6.7/
Gpgcheck=0
Enable=1
EOF
本地yum:
例如:
mount /dev/cdrom /mnt/
cat > /etc/yum.repos.d/local.repo <<EOF
[base] #库名称
name=Centos6.5_local #名称描
Baseurl=file:///mnt/ #yum源目录,源地址
Gpgcheck=0 #检查GPG-KEY,0为不检查,1为检查
Enable=1 #是否用该yum源,0为禁用,1为使用
EOF
测试yum:
yum list
yum源简单配置