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