本地yum源配置方法

备份/etc/yum.repos.d中的文件

cd /etc/yum.repos.d

touch CentOS-Base.repo

vim CentOS-Base.repo

mnt /dev/cdrom /mnt/cdrom 挂载镜像文件

[BaseOS]

name=CentOS-BaseOS

baseurl=file:///mnt/cdrom/BaseOS

gpgcheck=0

enabled=1

[APP]

name=CentOS-APP

baseurl=file:///mnt/cdrom/AppStream

gpgcheck=0

enabled=1

阿里云yum源配置方法 (要有网)

  1. cd /etc/yum.repo.d
  2. touch CentOS-AppStream.repo CentOS-BaseOS.repo CentOS-Extras.repo
  3. 编辑各个文件内容

  CentOS-AppStream.repo

  [aliyun-AppStream]

  name=CentOS-$releasever - AppStream
  baseurl=https://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
  gpgcheck=1
  enabled=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
  

  CentOS-BaseOS.repo

  [aliyun-BaseOS]
  name=CentOS-$releasever - Base
  baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
  gpgcheck=1
  enabled=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
  

  CentOS-Extras.repo

  [aliyun-extras]
  name=CentOS-$releasever - Extras
  baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
  gpgcheck=1
  enabled=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

  1. dnf -y install epel-release
  2. dnf clean all
  3. dnf makecache
  4. dnf repolist

标签: none

添加新评论