apt介绍

apt是Advanced Packaging Tool的简称。

在Ubuntu下,我们可以使用apt命令进行软件包的更新安装删除清理

类似于Windows的软件管理工具.

就是Centos的yum

但是更新很慢,强烈建议在 /etc/apt/sources.list 文件修改换源!

关于apt的所有指令都要在root权限下执行或者加上sudo

apt更新软件下载地址教程

  1. 查看Ubuntu的版本中Codename信息

    lsb_release -a
  2. 修改源文件

    sudo gedit /etc/apt/sources.list
  3. 将内容替换

    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
    # 注意须将xenial改成自己系统的Codename
    # 阿里云源
    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
    ##proposed表示測試版源,不建议启用
    #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://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
    deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
    ##測試版源
    #deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
    # 源碼
    deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
    deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
    deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
    deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
    ##proposed表示測試版源,不建议启用
    #deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
  4. 更新源

    apt-get update

    这个命令,会访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑。 我们在软件包管理器里看到的新的软件列表,都是通过update命令更新的。

  5. 更新软件(如果不需要更新就不用)

    apt-get upgrade

apt相关命令

更新源(就你换了apt源位置地址后需要更新一次)

apt-get update

升级系统

apt-get dist-upgrade

下载包的源代码

apt-get source 包名

安装包相关指令


安装包

apt-get install 包名

重新安装包

apt-cache install 包名 --reinstall

修复安装

apt-get -f install

安装相关编译环境

apt-get build-dep 包名

更新已安装的包

apt-get upgrade

删除包相关指令

删除包

apt-get remove 包名

删除包和包的配置文件

apt-get remove 包名 --purge

查询包信息相关指令

搜索相关软件包

apt-cache search 包名

获取包的相关信息

apt-cache show 包名

了解这个包需要哪些依赖

apt-cache depends 包名

查看这个包是什么包的依赖

apt-cache redpends 包名

dpkg介绍

dpkg是一个Debian的命令行工具。

用来安装,删除,构建和管理Debian的软件包

就类似CentOS的rpm软件包管理工具

dpkg相关命令

安装软件

dpkg -i 软件包的路径地址

列出已安装的软件

dpkg -l

卸载软件

dpkg -r 软件名

查看软件包内容

就查看你离线下载到本地的那个软件包里面的内容

dpkg -c 软件包路径

查看已安装软件的信息

dpkg -s 软件包名

查看软件包安装位置

dpkg -L 软件包名

筛选包含指定模式的软件包

dpkg -S 指定模式

Linx__Ubuntu_APT的更多相关文章

随机推荐

  1. 枚举子集为什么是 O(3^n) 的

    这是更新日志 \(2021/2/9\) 代数推导 \(2021/2/10\) 组合意义,构建 TOC 目录 枚举子集 复杂度证明 代数推导 组合意义 Summary 枚举子集 枚举子集为什么是 \(O ...

  2. ZJOI2016 小星星 题解

    我一生之敌是状压 本文发表于 洛谷博客:https://www.luogu.com.cn/blog/LoveMC/solution-p3349 Cnblogs:https://www.cnblogs. ...

  3. qbxt数学五一Day4

    目录 1. 随机试验 2. 概率 1. 平凡 2. 条件概率 3. 期望 习题 1 2 3 4 1. 随机试验 定义: 不能预先确知结果 试验之前可以预测所有可能结果或范围 可以在相同条件下重复实验 ...

  4. Vue 内置指令 && 自定义指令

    1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8" /> 5 & ...

  5. 【web自动化测试】Playwright快速入门,5分钟上手

    我喜欢Playwright! 这是微软开源的一款非常强大的自动化工具,再过几年,他很有可能取代Selenium在浏览器自动化的通知地位.使用过一段时间,我没有找到很好的中文资料可以参考,导致很多问题无 ...

  6. 5.26 NOI 模拟

    \(T1\)石子与HH与HHの取 博弈是不可能会的 \(c_i\)相等,比较显然的\(Nim,\)直接前缀异或求一下 \(a_i=1,\)区间长度对\(2\)取模 结论\(:\)黑色石子严格大于白色个 ...

  7. 跳转语句break、continue、return

    1.break 语句 概念: break语句在循环中的作用是终止当前循环,在switch语句中的作用是终止switch. 示例: 输出结果:  2.continue 语句 概念: continue语句 ...

  8. Luogu2290 [HNOI2004]树的计数 (组合计数,prufer编码)

    这不prufer编码吗,防爆long long就行了啊 #include <iostream> #include <cstdio> #include <cstring&g ...

  9. Luogu1137 旅行计划 (拓扑排序)

    每次入队时DP : \(f[v] = \max \{f[u] + 1\}\) #include <iostream> #include <cstdio> #include &l ...

  10. 051_末晨曦Vue技术_处理边界情况之provide和inject依赖注入

    provide和inject依赖注入 点击打开视频讲解更详细 在此之前,在我们描述访问父级组件实例的时候,展示过一个类似这样的例子: <google-map> <google-map ...