1 替换成阿里源
1.1 进入yum源配置文件所在文件夹
1 | cd / etc / yum.repos.d / |
1.2 首先备份
1 | mv / etc / yum.repos.d / CentOS - Base.repo / etc / yum.repos.d / CentOS - Base.repo.backup |
1.3 下载aliyun的yum源配置文件,放入/etc/yum.repos.d/(操作前请做好相应备份)
1 | wget - O / etc / yum.repos.d / CentOS - Base.repo http: / / mirrors.aliyun.com / repo / Centos - 7.repo |
1.4 运行yum makecache生成缓存
1 2 3 4 5 | yum clean all # 清除缓存 rm -rf /var/cache/yum/ # 清除缓存 yum makecache # 生成缓存 yum clean all && rm -rf /var/cache/yum/ && yum makecache |
2 替换成公司源
2.1 进入yum源配置文件所在文件夹
1 | cd / etc / yum.repos.d / |
2.1 首先备份
1 | cp / etc / yum.repos.d / CentOS - Base.repo / etc / yum.repos.d / CentOS - Base.repo.backup |
3.3 打开/etc/yum.repos.d/CentOS-Base.repo 修改其内容
1 2 3 4 5 6 7 8 | vim / etc / yum.repos.d / CentOS - Base.repo [base] name = sw - CentOS - $releasever - Base baseurl = http: / / yum.swomc.xyz / centos / $releasever / os / $basearch / http: / / yum.swomc.net / centos / $releasever / os / $basearch / gpgcheck = 1 gpgkey = http: / / yum.swomc.net / centos / RPM - GPG - KEY - CentOS - $releasever |
4.4 运行yum makecache生成缓存
1 | yum makecache |
5.公司服务器yum源
1.CentOS-Base.repo
1 2 3 4 5 6 7 | vim CentOS - Base.repo [base] name = sw - CentOS - $releasever - Base baseurl = http: / / yum.swomc.xyz / centos / $releasever / os / $basearch / http: / / yum.swomc.net / centos / $releasever / os / $basearch / gpgcheck = 1 gpgkey = http: / / yum.swomc.net / centos / RPM - GPG - KEY - CentOS - $releasever |
2.custome.repo
1 2 3 4 5 6 7 8 | vim custome.repo [custome] name = sw - Custome - $releasever - Custome baseurl = http: / / yum.swomc.xyz / custome / Packages http: / / yum.swomc.net / custome / Packages enabled = 1 gpgcheck = 0 |
3.epel.repo
1 2 3 4 5 6 7 8 9 | vim epel.repo [epel] name = sw - Extra Packages for Enterprise Linux $releasever - $basearch baseurl = http: / / yum.swomc.xyz / epel / $releasever / $basearch http: / / yum.swomc.net / epel / $releasever / $basearch failovermethod = priority enabled = 1 gpgcheck = 0 gpgkey = file : / / / etc / pki / rpm - gpg / RPM - GPG - KEY - EPEL - $releasever |
4.获取 GPG 密钥失败:[Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
1 2 | cd / etc / pki / rpm - gpg / wget https: / / archive.fedoraproject.org / pub / epel / RPM - GPG - KEY - EPEL - 7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | yum list installed # 显示已经安装的软件包 yum list vim # 查找可以安装的软件包 (以 vim 为例) yum -y install vim # 安装软件包 (以 vim 为例) yum deplist vim # 列出软件包的依赖 (以 vim 为例) yum info vim # info 显示软件包的描述信息和概要信息(以 vim 为例) yum update vim # 升级某一个软件包 ,(以 vim 为例) yum check-update # 检查可更新的程序 yum remove vim # 卸载软件包 (以 vim 为例) |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
2019-03-07 Django在根据models生成数据库表时报 __init__() missing 1 required positional argument: 'on_delete'
2019-03-07 xadmin设置
2019-03-07 python3安装xadmin出现 UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 3444: illegal multibyte sequence