centos7如何更换网易的yum源
时间: 2023-10-10 20:12:38 浏览: 57
以下是在CentOS 7中更换为网易yum源的步骤:
1.备份原有yum源
```
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
```
2.下载网易yum源
```
sudo wget http://mirrors.163.com/.help/CentOS7-Base-163.repo -O /etc/yum.repos.d/CentOS-Base.repo
```
3.清除缓存
```
sudo yum clean all
```
4.生成缓存
```
sudo yum makecache
```
至此,你已经成功更换为网易yum源了。
相关问题
centos7更换国内yum源
更换CentOS 7的国内yum源的步骤如下:
1. 首先备份系统自带yum源配置文件:在终端输入以下命令备份文件:
```shell
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
```
2. 下载国内yum源配置文件到/etc/yum.repos.d/目录下:根据需要选择阿里云源或网易云源。在终端输入以下命令下载阿里云源配置文件:
```shell
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
```
或者输入以下命令下载网易云源配置文件:
```shell
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
```
3. 清理yum缓存,并生成新的缓存:在终端输入以下命令以清理缓存并生成新的缓存:
```shell
yum clean all
yum makecache
```
4. 检查是否成功更换yum源:在终端输入以下命令以更新yum源并检查是否生效:
```shell
yum update
```
注意:如果只想更新软件包而不更新内核,可以在yum命令后加上参数`--exclude=kernel*`,例如:
```shell
yum --exclude=kernel* update
```
以上就是更换CentOS 7的国内yum源的步骤。可以根据自己的需求选择合适的国内yum源进行替换。
Centos7更换yum镜像源
要更换CentOS 7的yum镜像源,可以按照以下步骤进行操作:
1. 首先备份系统自带的yum源配置文件:
```
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
```
这样可以保留原有的配置文件备份。
2. 下载国内的yum源配置文件到/etc/yum.repos.d/目录下。可以选择阿里源或网易源,具体命令如下:
- 阿里源(推荐):
```
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
```
- 网易源:
```
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
```
这样就会将对应的yum源配置文件下载到指定目录。
3. 更新yum缓存:
```
yum clean all
yum makecache
```
这样会清除旧的yum缓存并生成新的缓存。
现在你的CentOS 7系统的yum镜像源已经更换成功了。你可以使用新的yum源来安装和更新软件包。
#### 引用[.reference_title]
- *1* *2* *3* [Centos7更换yum国内源教程](https://blog.csdn.net/m0_49605975/article/details/120039048)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![repo](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)