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. RestTemplate上传文件

    1.上传的文件是File类型 如果文件保存在本地,即可以通过File file = new File(path) 或者 文件路径地址获取到指定文件 public String uploadFile(F ...

  2. 故障案例 | lsof是怎么"影响"MySQL计算打开文件句柄数的

    欢迎来到 GreatSQL社区分享的MySQL技术文章,如有疑问或想学习的内容,可以在下方评论区留言,看到后会进行解答 lsof中附加不同参数产生的结果也不同,小心"踩坑". 1. ...

  3. CDO如何盘点算法、推动算法业务增长

    在数字经济时代,算法对企业业务增长至关重要,是企业进行数字化转型.构建竞争优势的关键.IT工程师或数据分析师可能会将算法描述为一组由数据操作形成的规则.而从业务价值方面考虑,算法是一种捕获商业机会.提 ...

  4. [题解]Balance

    1.题目 POJ-1837 2.题目大意 一个天平上有一些钩子,现在有一些砝码.给出每个钩子到原点(姑且这么叫吧)的距离(-15 ~ 15,负数代表在左边,正数相反)以及砝码的重量(1 ~ 20),求 ...

  5. pnpm凭什么这么快

    前端包管理器层出不穷,pnpm算是一个后起之秀.它和npm有什么不同,为什么有了npm还要造一个pnpm? npm的问题 npm是最早的包管理器,安装nodejs自带npm,v3版本之前,npm安全依 ...

  6. [网鼎杯 2018]Comment-1|SQL注入|二次注入

    1.打开之后只有一个留言页面,很自然的就想到了二次注入得问题,顺带查看了下源代码信息,并没有什么提示,显示界面如下: 2.那先扫描一下目录,同时随便留言一个测试以下,但是显示需要登录,账户.密码给出了 ...

  7. 【java】学习路线14-抽象类、多态

    /*抽象类 abstractabstract class A{    }注意abstract类中不一定需要有abstract方法但是有abstract方法的类中,该类一定是abstract方法抽象类不 ...

  8. C++工厂方法模式讲解和代码示例

    在C++中使用模式 使用示例: 工厂方法模式在 C++ 代码中得到了广泛使用. 当你需要在代码中提供高层次的灵活性时, 该模式会非常实用. 识别方法: 工厂方法可通过构建方法来识别, 它会创建具体类的 ...

  9. 【android 逆向】arm if

    #include <stdio.h> void if1(int n){ //if else语句 if(n < 10){ printf("the number less th ...

  10. 延宕执行,妙用无穷,Go lang1.18入门精炼教程,由白丁入鸿儒,Golang中defer关键字延迟调用机制使用EP17

    先行定义,延后执行.不得不佩服Go lang设计者天才的设计,事实上,defer关键字就相当于Python中的try{ ...}except{ ...}finally{...}结构设计中的finall ...