redhat 8 配置系统yum源(同步centos 8)

A,配置国内源------>>>>阿里yum源

<1>,vi /etc/yum.repos.d/XXX.repo

------------(自定义repo是名字可随意,但后缀一定要遵守格式XXX.repo)

[AppStream]
name=CentOS-$releasever-AppStream
baseurl=http://mirrors.aliyun.com/centos/$releasever/AppStream/$basearch/os/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

># a,(若系统是centos系,则对应的gpgkey指向就要改变
>#可设置为------>>>gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial )
># b,gpgkey 会在命令yum makecache运行后同步到本地系统的/etc/pki/rpm-gpg/目录下

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

 

># c,(若系统是centos系,则对应的gpgkey指向就要改变
># 可设置为------>>>gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
> )

[epel]
name=CentOS-$releasever-Epel
baseurl=http://mirrors.aliyun.com/epel/8/Everything/$basearch
enabled=1
gpgcheck=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
 

># d,(若系统是centos系,则对应的gpgkey指向就要改变
>#可设置为------>>>gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
> )

2,yum clean all -------清理yum包
3, yum makecache --------重新缓存yum包
yum 可能用到的命令:
####### yum remove xxx(wget) -----------卸载某个命令(示例卸载的是wget)
####### yum -y install epel-release ---------- 下载第三方 epel源
####### yum provides semanage ----------查看semanage这个命令所属的安装包

####### yum provides netstat ---------查看netstat这个命令所属的安装包

< ####### yum provides semanage
policycoreutils-python-utils-2.9-9.el8.noarch : SELinux policy core python utilities
Repo : BaseOS
Matched from:
Filename : /usr/sbin/semanage

< ####### yum provides netstat
net-tools-2.0-0.52.20160912git.el8.x86_64 : Basic networking tools

B, centos 8 快速配置阿里yum源

wget -O /etc/yum.repos.d/aliyuan.repo http://mirrors.aliyun.com/repo/Centos-8.repo

C, centos7 使用阿里的epel源:

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

D,centos7 更换阿里yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 
sed -i  's#enabled=1#enabled=0#g'  /etc/yum.repos.d/CentOS-Media.repo     

yum clean all  && yum makecache 

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值