Centos Stream 9 换yum源(图文具体教程)
打开centos Stream 9进入终端输入 cd /etc/yum.repos.d
进入到yum.repos.d目录
https://i-blog.csdnimg.cn/direct/a3b2734b47d54664bdb349bdf713e754.png
输入下令 vim update_mirror.pl
进入vim编辑模式,输入i 插入文本
把下面文本复制粘贴到假造机创建update_mirror.pl的文件中
#!/usr/bin/perl
use strict;
use warnings;
use autodie;
my $mirrors = 'https://mirrors.tuna.tsinghua.edu.cn/centos-stream';
if (@ARGV < 1) {
die "Usage: $0 <filename1> <filename2> ...\n";
}
while (my $filename = shift @ARGV) {
my $backup_filename = $filename . '.bak';
rename $filename, $backup_filename;
open my $input, "<", $backup_filename;
open my $output, ">", $filename;
while (<$input>) {
s/^metalink/# metalink/;
if (m/^name/) {
my (undef, $repo, $arch) = split /-/;
$repo =~ s/^\s+|\s+$//g;
($arch = defined $arch ? lc($arch) : '') =~ s/^\s+|\s+$//g;
if ($repo =~ /^Extras/) {
$_ .= "baseurl=${mirrors}/SIGs/\$releasever-stream/extras" . ($arch eq 'source' ? "/${arch}/" : "/\$basearch/") . "extras-common\n";
} else {
$_ .= "baseurl=${mirrors}/\$releasever-stream/$repo" . ($arch eq 'source' ? "/" : "/\$basearch/") . ($arch ne '' ? "${arch}/tree/" : "os") . "\n";
}
}
print $output $_;
}
}
https://i-blog.csdnimg.cn/direct/b995acf5a11848e5a38759b877c1285d.png
粘贴好后按一下键盘上右上角的Esc退出编辑模式
在按Shift+:进入末行模式输入wq生存退出
https://i-blog.csdnimg.cn/direct/c8e31f04e4ea4815903ae96c8c36adca.png
回到终端输入:dnf install perl
回车
https://i-blog.csdnimg.cn/direct/7757d3606eaf421e83becb2a20b8ab52.png
等待
https://i-blog.csdnimg.cn/direct/05b50b12c044411abe60552a2b058996.png
输入y回车
https://i-blog.csdnimg.cn/direct/5a43e32d0cd34caa95e0ef97e31ebe28.png
在次输入y回车
https://i-blog.csdnimg.cn/direct/6550f3e0db704193ab32c992c9e79f8d.png
显示完毕后在输入yum clean all && yum makecache
https://i-blog.csdnimg.cn/direct/5c6a595e4a884ee69be8b1e8b1fe4818.png
后在输入yum clean all && yum makecache
https://i-blog.csdnimg.cn/direct/e69e2856cad84e6b88959067b859cbb6.png
显示元数据缓存已建立就换源成功了
https://i-blog.csdnimg.cn/direct/684ecfbf693b4986be8319ac4473ac9d.png
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]