ubuntu18.04 apt源的添加、修改

1.软件源

在Ubuntu下,安装软件常时,常用apt命令如下:

sudo apt-get install name

如果源里面没有找到name,则无法安装该软件。

2.源安装的原理

Ubuntu 自带了 apt的软件包管理工具,它负责 Ubuntu 系统中所有软件包的管理,包括安装、更新、卸载系统中的软件。

通过命令去安装一个软件时,apt 包管理工具就会从系统中一个源列表的文件中,查找可以包含该软件的软件源的网址,然后就从该网址把指定的软件给下载下来,并进行解压和安装。

3. 软件源的分类

  •     ubuntu官方软件源
  •     PPA软件源

PPA即为“Personal Package Archives”,个人软件包集。

很多软件无法进入官方软件库,为了能让开发者自由的上传、安装软件,launchpad.net 提供了 PPA,允许开发者建立自己的软件仓库。

添加 PPA 软件源的命令:

sudo add-apt-repository ppa:user/ppa-name

添加了之后更新一下:

sudo apt update

删除 PPA 软件源的命令:

sudo add-apt-repository --remove ppa:user/ppa-name

添加完PPA源之后,系统就会在/etc/apt/sources.list.d文件夹里创建两个文件:

其中的.list文件中保存了下载地址,以google-chrome.list为例:

也可以在软件源/etc/apt/sources.list文件中添加源,例如添加阿里云的源:

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

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

清华源:

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

关于所添加每条信息的格式其实就是:

deb(deb-src) address section1 section2 ...
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值