Linux更新源

1.切换至目录下

cd  /etc/apt

2.备份源文件

cp  sources.list   sources.list.bak

3.更换源文件内容

a.切换至root用户:

su

b.用空字符覆盖源文件:

echo  ''  >  sources.list

c.将国内源复制进sources.list文件,源文件在下文。

d.update 是同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,获取到最新的软件包:

sudo apt-get update

e.升级已安装的所有软件包,升级为本地索引中版本:

sudo apt-get upgrade

4.安装软件

sudo apt-get install xxx

例子:安装Linux图形化桌面:sudo apt-get install ubuntu-desktop

国内源如下,亲测可用,之前用163的和其他的一些源都会报一些错误,你们用过后就知道了。


deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
#deb http://archive.canonical.com/ubuntu/ xenial partner
#deb http://extras.ubuntu.com/ubuntu/ xenial main

猜你喜欢

转载自blog.csdn.net/qq_32364281/article/details/78834791