Ubuntu更新阿里源的方式

更改apt源为国内源方法早就有了,内容大同小异,我们应当掌握其规律了,其实每一版内容不同的地方就是版本号(或者官方一点的说:系统代号),所以我们先了解下新版本的系统代号:
使用命令:lsb_release -c

系统代号:
Ubuntu 12.04 (LTS)代号为precise。
Ubuntu 14.04 (LTS)代号为trusty。
Ubuntu 15.04 代号为vivid。
Ubuntu 15.10 代号为wily。
Ubuntu 16.04 (LTS)代号为xenial。

所以这也就解释了为什么利用搜索引擎搜出来的那么多方案里面内容不尽相同的原因,、
因为大家更改apt安装源时用的系统不一样。

1,备份系统默认的源。以防万一

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

2,打开sources.list文件。

vim /etc/apt/sources.list
删除原有内容,dd

然后将里面的内容替换为以下内容并保存关闭。
Ubuntu14.04阿里源:

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe 
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe 
deb-src 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-backports main restricted universe multiverse

Ubuntu16.04阿里源:

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

更新获取 阿里软件源 提供的软件列表

sudo apt-get update -y

更新软件

sudo apt-get upgrade -y

Ubuntu软件操作的相关命令

sudo apt-get update  更新源
 
sudo apt-get install package 安装包
 
sudo apt-get remove package 删除包
 
sudo apt-cache search package 搜索软件包
 
sudo apt-cache show package  获取包的相关信息,如说明、大小、版本等
 
sudo apt-get install package --reinstall   重新安装包
 
sudo apt-get -f install   修复安装
 
sudo apt-get remove package --purge 删除包,包括配置文件等
 
sudo apt-get build-dep package 安装相关的编译环境
 
sudo apt-get upgrade 更新已安装的包
 
sudo apt-get dist-upgrade 升级系统
 
sudo apt-cache depends package 了解使用该包依赖那些包
 
sudo apt-cache rdepends package 查看该包被哪些包依赖
 
sudo apt-get source package  下载该包的源代码
 
sudo apt-get clean && sudo apt-get autoclean 清理无用的包
 
sudo apt-get check 检查是否有损坏的依赖
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Ubuntu 18.04是一种流行的Linux操作系统,而阿里是指阿里云提供的软件,可以加速软件包的下载和更新。以下是在Ubuntu 18.04中使用阿里的步骤: 1.备份原有的软件列表文件 ```shell sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak ``` 2.编辑软件列表文件 ```shell sudo vim /etc/apt/sources.list ``` 3.将以下内容添加到文件中 ```shell # 阿里Ubuntu镜像 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse ## Not recommended # deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse ``` 4.更新软件列表 ```shell sudo apt-get update ``` 5.使用阿里安装软件包 ```shell sudo apt-get install <package-name> ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值