HCRM博客

CentOS 7系统下配置163源教程

CentOS 7 163源的使用与配置

CentOS 7系统下配置163源教程-图1

什么是CentOS 7 163源?

CentOS 7 163源是基于CentOS 7官方源的一个镜像源,由163网提供,它包含了CentOS 7官方源的所有软件包,并且更新及时,能够满足大多数用户的需求,使用163源可以加快软件包的下载速度,提高系统的稳定性。

CentOS 7 163源的配置方法

临时使用163源

(1)打开终端。

(2)输入以下命令,替换为你的系统所使用的发行版版本号:

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

(3)下载并替换为163源的配置文件:

sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-base-163.repo

(4)更新本地包数据库:

CentOS 7系统下配置163源教程-图2

sudo yum clean all
sudo yum makecache

永久使用163源

(1)打开终端。

(2)编辑/etc/yum.repos.d/CentOS-Base.repo文件:

sudo vi /etc/yum.repos.d/CentOS-Base.repo

(3)将以下内容替换到文件中:

[base]
name=CentOS-7 - Base
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=Base&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
[epel]
name=Extra Packages for Enterprise Linux 7 - x86_64
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=epel&infra=$infra
#baseurl=http://dl.fedoraproject.org/pub/epel/7/x86_64/
gpgcheck=1
gpgkey=http://www.epel.org/RPM-GPG-KEY-EPEL-7
[centosplus]
name=CentOS-7 - Plus
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/plus/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
[centosupdates]
name=CentOS-7 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
[centossrc]
name=CentOS-7 - Sources
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=src&infra=$infra
#baseurl=http://mirror.centos.org/centos/7/src/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

(4)保存并关闭文件。

(5)更新本地包数据库:

sudo yum clean all
sudo yum makecache

使用163源的优势

  1. 下载速度快:163源在国内拥有大量的镜像节点,能够提供更快的下载速度。

    CentOS 7系统下配置163源教程-图3

  2. 更新及时:163源会及时更新软件包,确保用户能够使用到最新的软件。

  3. 支持多种架构:163源支持x86_64和i686等多种架构,满足不同用户的需求。

常见问题解答(FAQs)

Q1:如何查看当前系统使用的源?

A1:在终端中输入以下命令:

yum repolist enabled

Q2:如何将系统源切换回官方源?

A2:打开终端,编辑/etc/yum.repos.d/CentOS-Base.repo文件,将163源的相关配置删除或注释掉,然后保存并关闭文件,更新本地包数据库:

sudo yum clean all
sudo yum makecache

本站部分图片及内容来源网络,版权归原作者所有,转载目的为传递知识,不代表本站立场。若侵权或违规联系Email:zjx77377423@163.com 核实后第一时间删除。 转载请注明出处:https://blog.huochengrm.cn/pc/49833.html

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
请登录后评论...
游客游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~