Yum简要配置example随记:修订间差异

来自三线的随记
无编辑摘要
无编辑摘要
第76行: 第76行:


* 注意epel等repo也会读取releasever这个变量,如果是用了epel等仓库,不要直接改全局releasever的值
* 注意epel等repo也会读取releasever这个变量,如果是用了epel等仓库,不要直接改全局releasever的值
* sed -i "s/\$releasever/8.4.2105/" /etc/yum.repos.d/*.repo
*echo "8.4.2105" > /etc/yum/vars/releasever; echo "centos-vault" > /etc/yum/vars/contentdir


  sed -i -e "s|#baseurl=<nowiki>http://mirror.centos.org|baseurl=https://mirrors.ustc.edu.cn|</nowiki>" -e "s|^mirrorlist|#mirrorlist|" /etc/yum.repos.d/*.repo
  sed -i -e "s|#baseurl=<nowiki>http://mirror.centos.org|baseurl=https://mirrors.ustc.edu.cn|</nowiki>" -e "s|^mirrorlist|#mirrorlist|" /etc/yum.repos.d/*.repo
  echo "8.4.2105" > /etc/yum/vars/releasever
  sed -i -e "s/\$releasever/8.4.2105/" -e "s/contentdir/centos-vault/" /etc/yum.repos.d/*.repo
echo "centos-vault" > /etc/yum/vars/contentdir
[[分类:Linux]]
[[分类:Linux]]

2022年11月20日 (日) 00:43的版本

also alias: DNF 简要配置example随记

直接用directory作为 yum repo

[directory-repo]
name=directory
baseurl=file:///root/directory/os-requirements-resources/repo/centos-7
enabled=1
gpgcheck=0
repo_gpgcheck=0
module_hotfixes=True

directory作为 yum repo的话文件夹下内容概要

[root@localhost centos-7]# ls -a
.  ..  Packages  repodata

repodata下内容概要

[root@localhost centos-7]# cd repodata/
[root@localhost repodata]# ls
17a0c7cff0884d983840e3f4db3e8d56996bd246a95944de35348396bb457d6d-other.sqlite.bz2  4de172fe99a91ec8648e29a0d164d2713ef8341e7a6a2665ef43e409be591cf1-filelists.sqlite.bz2  repomd.xml
3f9204c44002f8de302b335a02b4b5aefd5a4abf7de9db965de8688cbdee8c1d-other.xml.gz      a1d2873df3fccbd51f325140e0241daa3ed715675adf6aae9838664327be6d35-filelists.xml.gz
4d62094ad1c24cf491dec9b1d4e05bbbcf3a68ec9048f35ae2f2203ab8aa525c-primary.xml.gz    afbce1090b604174737efe7aa75a6bf35c7be3277dc7f49dd06df66990f8d0d8-primary.sqlite.bz2
[root@localhost repodata]#

可以直接将iso挂载到/mnt/xxx 下然后直接配置yum.repos.d使用

[iso]
name=ISO
baseurl=file:///mnt/os-iso
enabled=1
gpgcheck=0
repo_gpgcheck=0

常规形式

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

centos 8.x 快速换源为 mirrors.ustc.edu.cn

其它8.x版本自行修改releasever版本号

  • 注意epel等repo也会读取releasever这个变量,如果是用了epel等仓库,不要直接改全局releasever的值
  • echo "8.4.2105" > /etc/yum/vars/releasever; echo "centos-vault" > /etc/yum/vars/contentdir
sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=https://mirrors.ustc.edu.cn|" -e "s|^mirrorlist|#mirrorlist|" /etc/yum.repos.d/*.repo
sed -i -e "s/\$releasever/8.4.2105/" -e "s/contentdir/centos-vault/" /etc/yum.repos.d/*.repo