centos7配置本地yum源
先从官网下载centos7镜像 以centos7.4 为例 CentOS-7-x86_64-Everything-1804
[root@kangvcar ~]# mv CentOS-7-x86_64-Everything-1804 /dev/cdrom
[root@kangvcar ~]# mkdir /opt/centos-yum.bak
[root@kangvcar ~]# mv /etc/yum.repos.d/* /opt/centos-yum.bak/
2、挂在磁盘:
[root@bogon ~]#
[root@bogon ~]# mount -o loop /dev/cdrom /mnt/cdrom/
3、配置yum文件
[root@bogon yum.repos.d]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# vi local.repo
[root@bogon yum.repos.d]# cat local.repo
[local]
name=local
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
yum celan all && yum makecache
centos7配置阿里云yum源
备份
[root@bogon ~]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# mkdir repo_bak
[root@bogon yum.repos.d]# mv *.repo repo_bak/
[root@bogon yum.repos.d]# ls
repo_bak
下载新的CentOS-Base.repo 到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo
[root@bogon yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@bogon yum.repos.d]# ls
CentOS-Base.repo repo_bak
执行yum clean all 清除缓存,运行 yum makecache 生成新的缓存
[root@bogon yum.repos.d]# yum clean all
配置阿里云epel源
[root@bogon stress]# wget http://mirrors.aliyun.com/repo/epel-7.repo
[root@bogon stress]#mv epel-7.repo /etc/yum.repos.d/
[root@bogon stress]#yum clean all
配置163源
备份
[root@bogon ~]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# mkdir repo_bak
[root@bogon yum.repos.d]# mv *.repo repo_bak/
[root@bogon yum.repos.d]# ls
repo_bak
CentOS 7
wget -O /etc/yum.repos.d/CentOS7-Base-163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
清除缓存
yum clean all
yum makecache
yum list
ftp配置yum
参照地址 https://blog.csdn.net/yonggeit/article/details/70258152