Ubuntu修改apt-get软件源,解决E: Unable to locate package redis错误

今天新装的Ubuntu安装软件一直报错Unable to locate package ****,原因Ubuntu apt软件源有问题,更换为apt阿里云源解决问题。

1、备份apt源

1.1Ubuntu 的apt源配置文件:/etc/apt/sources.list,备份原来的源。

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak20181105
2、修改阿里云apt源配置内容

2.1阿里源

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse
2.2修改/etc/apt/sources.list的内容为2.1里面的内容
sudo vim /etc/apt/sources.list
3应用新源

修改源之后需要执行命令更新,新源才能正常使用。

sudo apt-get update

推荐阅读更多精彩内容