centos7配置国内yum源
时间: 2023-06-08 21:03:56 浏览: 273
可以使用阿里云或者网易云的yum源,具体配置可以参考以下步骤:
1.备份原有的yum源配置文件:
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2.下载新的yum源配置文件:
阿里云yum源配置文件:
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
网易云yum源配置文件:
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
3.清除yum缓存:
sudo yum clean all
4.更新yum索引:
sudo yum makecache
5.测试yum源是否配置成功:
sudo yum update
如果yum源配置成功,则可以顺利更新系统包。
注意:使用第三方yum源,风险自担。
相关问题
centos7配置http yum源
好的,以下是配置 CentOS 7 的 http yum 源的步骤:
1. 安装 httpd 服务:
```
sudo yum install httpd
```
2. 启动 httpd 服务:
```
sudo systemctl start httpd
```
3. 下载 CentOS 7 的 yum 源配置文件:
```
sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
```
4. 清除 yum 缓存:
```
sudo yum clean all
```
5. 生成 yum 缓存:
```
sudo yum makecache
```
6. 更新系统:
```
sudo yum update
```
以上就是配置 CentOS 7 的 http 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源进行替换。