ubantu学习之更改apt源

Posted sunxiuwen

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ubantu学习之更改apt源相关的知识,希望对你有一定的参考价值。

1.获取版本codename

sudo lsb_release -a

2.确认阿里源支持

传送门地址
注:该网页提供了阿里云支持的ubuntu系统下各个Codename版本

3.备份系统源文件

sudo cp /etc/apt/sources.list    /etc/apt/sources.list.bak

4.将阿里云源提供的源里的bionic替换成自己版本的codename,下面提供脚本,复制运行即可

Codename=$( (lsb_release -a)|awk '{print $2}'|tail -n 1 )
echo "deb http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-updates main multiverse restricted universe " >sources.list

5.更新源索引

sudo  apt-get update

6.更新软件升级

sudo apt-get upgrade

以上是关于ubantu学习之更改apt源的主要内容,如果未能解决你的问题,请参考以下文章

ubantu+nginx+uwsgi+django部署

GoLang学习之变量定义和初始化

韦东山linux学习之ubuntu 9.10 软件源 问题

Python面向对象学习之八,装饰器

npm学习之如何使用语义化版本

[Ubantu] 换源