Yum简要配置example随记:修订间差异
来自三线的随记
(创建页面,内容为“also alias: DNF 简要配置example随记 === 直接用iso作为 yum repo === [iso] name=ISO baseurl=file:///mnt/os/os-iso enabled=1 gpgcheck=0 repo_gpgcheck=…”) |
小无编辑摘要 |
||
(未显示同一用户的12个中间版本) | |||
第1行: | 第1行: | ||
also alias: DNF 简要配置example随记 | also alias: DNF 简要配置example随记 | ||
=== 直接用directory作为 yum repo === | === 直接用directory作为 yum repo === | ||
第17行: | 第9行: | ||
repo_gpgcheck=0 | repo_gpgcheck=0 | ||
module_hotfixes=True | module_hotfixes=True | ||
directory作为 yum repo的话文件夹下内容概要 | |||
[root@localhost centos-7]# ls -a | [root@localhost centos-7]# ls -a | ||
. .. Packages repodata | . .. Packages repodata | ||
第27行: | 第19行: | ||
4d62094ad1c24cf491dec9b1d4e05bbbcf3a68ec9048f35ae2f2203ab8aa525c-primary.xml.gz afbce1090b604174737efe7aa75a6bf35c7be3277dc7f49dd06df66990f8d0d8-primary.sqlite.bz2 | 4d62094ad1c24cf491dec9b1d4e05bbbcf3a68ec9048f35ae2f2203ab8aa525c-primary.xml.gz afbce1090b604174737efe7aa75a6bf35c7be3277dc7f49dd06df66990f8d0d8-primary.sqlite.bz2 | ||
[root@localhost repodata]# | [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=<nowiki>http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra</nowiki> | |||
#baseurl=<nowiki>http://mirror.centos.org/centos/$releasever/os/$basearch/</nowiki> | |||
gpgcheck=1 | |||
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 | |||
#released updates | |||
[updates] | |||
name=CentOS-$releasever - Updates | |||
mirrorlist=<nowiki>http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra</nowiki> | |||
#baseurl=<nowiki>http://mirror.centos.org/centos/$releasever/updates/$basearch/</nowiki> | |||
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=<nowiki>http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra</nowiki> | |||
#baseurl=<nowiki>http://mirror.centos.org/centos/$releasever/extras/$basearch/</nowiki> | |||
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=<nowiki>http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra</nowiki> | |||
#baseurl=<nowiki>http://mirror.centos.org/centos/$releasever/centosplus/$basearch/</nowiki> | |||
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 / remi等软件源,不要直接改全局releasever的值,不然有可能出现拉不到repodata/repomd.xml文件等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/CentOS-Linux-*.repo | |||
sed -i -e "s/\$releasever/8.4.2105/" -e "s/\$contentdir/centos-vault/" /etc/yum.repos.d/CentOS-Linux-*.repo | |||
=== centos 7.x 快速换源为 mirrors.ustc.edu.cn (大概率已失效) === | |||
sed -i -e "s/^mirrorlist/#mirrorlist/" -e "s/^#baseurl/baseurl/" -e "s#<nowiki>http://mirror.centos.org#https://mirrors.ustc.edu.cn#</nowiki>" /etc/yum.repos.d/*.repo | |||
=== centos 7.9 换可用源 === | |||
sed -i -e "s#<nowiki>http://mirror.centos.org#https://i.sanxian.tech#</nowiki>" -e "s/^mirrorlist=/#&/" -e "s/^#\(baseurl=\)/\1/" /etc/yum.repos.d/*.repo | |||
[[分类:Linux]] | [[分类:Linux]] |
2024年7月18日 (四) 02:18的最新版本
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 / remi等软件源,不要直接改全局releasever的值,不然有可能出现拉不到repodata/repomd.xml文件等repo不可用的问题
- 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/CentOS-Linux-*.repo sed -i -e "s/\$releasever/8.4.2105/" -e "s/\$contentdir/centos-vault/" /etc/yum.repos.d/CentOS-Linux-*.repo
centos 7.x 快速换源为 mirrors.ustc.edu.cn (大概率已失效)
sed -i -e "s/^mirrorlist/#mirrorlist/" -e "s/^#baseurl/baseurl/" -e "s#http://mirror.centos.org#https://mirrors.ustc.edu.cn#" /etc/yum.repos.d/*.repo
centos 7.9 换可用源
sed -i -e "s#http://mirror.centos.org#https://i.sanxian.tech#" -e "s/^mirrorlist=/#&/" -e "s/^#\(baseurl=\)/\1/" /etc/yum.repos.d/*.repo