修改yum源

vim /etc/yum.repos.d/CentOS-Base.repo

	    1. mirrorlist --> #mirrorlist
		2. #baseurl --> baseurl
		3. baseurl后的地址为 http://mirrors.163.com

修改yum源为阿里云

cd /etc/yum.repo.d

mv CentOS-Base.repo CentOS-Base.repo.bak
wget http://mirrors.aliyun.com/repo/Centos-7.repo
mv Centos-7.repo CentOS-Base.repo
yum clean all
yum makecache
yum update

搭建ftp远程yum源

cd /etc/yum.repos.d
vi centos7.repo

添加内容为:
[base]
name=centos7.2
baseurl=ftp://192.168.2.10/centos7
enabled=1
gpgcheck=0

yum clean all
yum repolist

使用本地镜像文件

将iso文件直接挂载/mnt
vi /etc/yum.repos.d/CentOS-Media.repo
添加  file:///mnt/
使用文件里的语句,如
yum --disablerepo=\* --enablerepo=c6-media install -y binutils compat-libcap1 compat-libstdc++-33

搭建局域网下yum源

系统镜像在 192.168.10.10

在192.168.10.10 下
mount -o loop  CentOS-7-x86_64-DVD-1611.iso  /mnt/

cd /mnt 
nohup python -m SimpleHTTPServer 80  > /dev/null 2>&1 &

使用端
cat > /etc/yum.repos.d/CentOS-Base.repo  <<'_EOF'
[base]
name= Centos7
baseurl=http://192.168.10.10
enabled=1
gpgcheck=1
gpgkey=http://192.168.10.10/RPM-GPG-KEY-CentOS-7
_EOF

yum makecache fast

yum install -y xxxx
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值