修改apt-get和yum為阿里源
apt-get
在使用apt-get update的時候,出現如下錯誤時:
E: Some index files failed to download, they have been ignored, or old ones used instead.
可以將目錄下/var/lib/apt/lists/partial/所有的檔案清掉,再次執行apt-get update即可!
自帶源在大陸不好,導致無法下載成功
Err http://security.ubuntu.com precise-security Release.gpg
Temporary failure resolving 'security.ubuntu.com'
Err http://cn.archive.ubuntu.com precise InRelease
.......
步驟
首先可以對原檔案進行備份
sudo cp /etc/apt/source.list /etc/apt/source.list.bak
編輯源列表檔案(以管理員身份執行)
sudo vim /etc/apt/source.list
將檔案內容刪除,替換如下內容
deb http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
4、執行sudo apt-get update
5、執行sudo apt-get upgrade
yum
1、備份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下載新的CentOS-Base.repo 到/etc/yum.repos.d/
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、之後執行yum makecache生成快取
相關文章
- CentOS7 yum源修改為阿里,配置阿里epel源CentOS阿里
- 修改Centos7預設yum源為阿里雲源CentOS阿里
- Centos-7修改yum源為國內的yum源CentOS
- 【Ubuntu】修改 apt-get 源為國內映象源的方法Ubuntuapt-get
- Centos-Stream 配置本地yum源和配置阿里雲yum源CentOS阿里
- CentOS修改yum源CentOS
- CentOS 更改 yum 映象源為阿里雲映象源CentOS阿里
- CentOS 搭建內部Yum源同步阿里Yum源CentOS阿里
- centos7替換yum源為阿里雲CentOS阿里
- redhat6.7修改為centos6.7官方yum源RedhatCentOS
- CentOS7 修改 yum 源CentOS
- centos7 更換yum為阿里源或者別的源CentOS阿里
- 將Centos 的預設yum源改為阿里雲的yum源後出現的問題CentOS阿里
- Centos7配置阿里epel源|yum源CentOS阿里
- 將Centos的yum源更換為國內的阿里雲(163)源CentOS阿里
- centos6-增加阿里yum源CentOS阿里
- CentOS 7 配置 阿里雲 yum源CentOS阿里
- yum映象源修改最新版(2023)
- Linux中更換yum源為阿里的詳細步驟Linux阿里
- CentOS7.9 搭建內部yum源伺服器同步阿里yum源CentOS伺服器阿里
- 包管理工具apt-get和yum的區別apt-get
- CentOS8配置阿里雲YUM源CentOS阿里
- YUM源部署和使用
- Ubuntu apt-get和pip源更換Ubuntuapt-get
- Fedora怎麼設定DVD為yum源?Fedora設定DVD為yum源的方法
- CentOS8使用阿里雲yum源異常CentOS阿里
- Ubuntu apt-get和pip國內源更換Ubuntuapt-get
- 搭建本地yum源,使用安裝光碟的rpm作為yum源的檔案
- Linux中wget、yum與apt-get用法及區別Linuxwgetapt-get
- yum本地源和外網源的配置方法
- yum 配置源
- 配置yum源
- 新增yum源
- centos7 更換為aliyun的yum源CentOS
- linux配置本地yum源 centos7.9為例LinuxCentOS
- docker apt-get 換源問題Dockerapt-get
- CentOS 配置yum源CentOS
- yum源配置大全
- linux yum 源部署Linux