实验用的是Ubuntu14.04以及CentOS7
Linux自带的源速度太慢,甚至比不过一些国内的源
所以在这里更换阿里的源
Ubuntu
首先将配置文件备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
然后vim编辑
sudo vim /etc/apt/sources.list
将原来的内容全部删除然后写入以下内容
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
更新源列表
sudo apt-get update
更新软件
sudo apt-get upgrade
完成
注:有时候apt-get update 更新的时候会报错
错误一:
W: Unknown Multi-Arch type ‘no’ for package ‘compiz-core’
W: Unknown Multi-Arch type ‘no’ for package ‘compiz-gnome’
解决方法是:
sudo apt-get install -f apt
错误二:
W: GPG error: http://dl.google.com stable Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 6494C6D6997C215E
解决方法:
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys 6494C6D6997C215E
上述命令中的6494C6D6997C215E要与报错的一致
然后
apt-get update
CentOS7
登陆root帐号
cd /etc/yum.repos.d
删掉文件夹内的原有文件
rm -rf *
下载阿里源的repo文件
清理软件源
yum clean all
建立本地缓存
yum makecache
升级所有包同时也升级软件和系统内核
yum update
若想只升级所有包,不升级软件和系统内核,可以用
yum upgrade
阿里巴巴开源镜像站:https://opsx.alibaba.com/?lang=zh-CN
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。
评论