阅读摘要

  • Ubuntu安装软件包
    • apt 安装
    • aptitude安装
    • 使用Deb包安装
  • 镜像源
    • 阿里云
    • 清华大学开源软件镜像站
    • 中科大源
    • 网易
  • Ubuntu apt-get命令安装软件包时遇到的问题
    • Question1
    • Question2
    • Question3
    • 解决方案
  • Ubuntu安装软件包

    apt 安装

  • sudo apt search package #搜索包
    sudo apt show package #获取包的相关信息,如说明、大小、版本等
    sudo apt depends package #了解使用依赖
    sudo apt rdepends package #查看该包被哪些包依赖
    sudo apt-cache pkgnames  #执行pkgnames子命令列出当前所有可用的软件包
    sudo apt policy package #使用policy命令显示软件包的安装状态和版本信息。
    sudo apt install package #安装包
    sudo apt install package=version #安装指定版本的包
    sudo apt install package --reinstall #重新安装包
    sudo apt -f install #修复安装, "-f = --fix-missing"
    sudo apt remove package #删除包
    sudo apt purge package  #删除包,包括删除配置文件等
    sudo apt autoremove #自动卸载所有未使用的软件包
    sudo apt source package #下载该包的源代码
    sudo apt update #更新apt软件源信息
    sudo apt upgrade #更新已安装的包
    sudo apt full-upgrade #在升级软件包时自动处理依赖关系
    sudo apt dist-upgrade #升级系统
    sudo apt dselect-upgrade #使用dselect升级
    sudo apt build-dep package #安装相关的编译环境
    sudo apt clean && sudo apt autoclean #清理无用的包
    sudo apt clean  #清理已下载的软件包,实际上是清楚/var/cache/apt/archives目录中的软件包
    sudo apt autoclean  #删除已经卸载的软件包备份
    sudo apt-get check #检查是否有损坏的依赖
    

    例子:

  • root@gegewu1:/etc/zabbix# sudo apt purge  zabbix-server-mysql
    正在读取软件包列表... 完成
    正在分析软件包的依赖关系树       
    正在读取状态信息... 完成       
    下列软件包是自动安装的并且现在不需要了:
      libevent-2.1-6 libmysqlclient20
    使用'sudo apt autoremove'来卸载它(它们)。
    下列软件包将被【卸载】:
      zabbix-server-mysql*
    升级了 0 个软件包,新安装了 0 个软件包,要卸载 1 个软件包,有 13 个软件包未被升级。
    解压缩后会消耗 0 B 的额外空间。
    您希望继续执行吗? [Y/n] y

  • apt和apt-get的区别:
    随着 apt install package 命令的使用频率和普遍性逐步超过 apt-get install package,越来越多的其它 Linux 发行版也开始遵循 Ubuntu 的脚步,开始鼓励用户使用 apt 而不是 apt-get。
    详情请跳转至:apt 和 apt-get的区别(建议使用apt)

    aptitude安装
    sudo apt install aptitude # 安装

    sudo aptitude update     更新可用的包列表
    sudo aptitude upgrade    升级可用的包
    sudo aptitude dist-upgrade   将系统升级到新的发行版
    sudo aptitude install pkgname    安装包
    sudo aptitude remove pkgname     删除包
    sudo aptitude purge pkgname  删除包及其配置文件
    sudo aptitude search string  搜索包
    sudo aptitude show pkgname   显示包的详细信息
    sudo aptitude clean  删除下载的包文件
    sudo aptitude autoclean  仅删除过期的包文件
    

    使用Deb包安装

  • sudo dpkg -i <package.deb>    #安装包
    sudo dpkg -r <package.deb>   #删除包
    sudo dpkg -p <package.deb>   #彻底删除包(包括配置文件)
    dpkg -l                       #列出当前已安装的包
    

    镜像源

    阿里云

  • deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
    

    清华大学开源软件镜像站

  • #默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
    # deb-src 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-src 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-src 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-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    # 预发布软件源,不建议启用
    # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
    

    中科大源

  • deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
    

    网易

  • deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
    deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
    deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
    

    遇到的问题

  • Ubuntu apt-get命令安装软件包时遇到的问题
    Question1
    root@soft3-94:~# apt-get install libssl-dev
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    You might want to run ‘apt-get -f install’ to correct these:
    The following packages have unmet dependencies:
    activity-log-manager : Depends: libglib2.0-0 (>= 2.43.2) but 2.40.0-2 is to be installed
    alsa-base : Depends: kmod (>= 17-1)
    libssl-dev : Depends: libssl1.1 (= 1.1.1-1ubuntu2.1~18.04.6) but it is not going to be installed
    E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solution).Question2
    root@soft3-94:/var/lib/dpkg# apt-get install update
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package update
    root@soft3-94:/var/lib/dpkg# apt-get install libssl-dev
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    You might want to run ‘apt-get -f install’ to correct these:
    The following packages have unmet dependencies:
    activity-log-manager : Depends: libglib2.0-0 (>= 2.43.2) but 2.40.0-2 is to be installed
    alsa-base : Depends: kmod (>= 17-1)
    libssl-dev : Depends: libssl1.1 (= 1.1.1-1ubuntu2.1~18.04.6) but it is not going to be installed
    E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solution).Question3
    root@soft3-94:/var/lib/dpkg# apt-get -f install
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Correcting dependencies… Done
    The following extra packages will be installed:
    kmod libglib2.0-0 libglib2.0-bin libkmod2
    The following packages will be upgraded:
    kmod libglib2.0-0 libglib2.0-bin libkmod2
    4 upgraded, 0 newly installed, 0 to remove and 1422 not upgraded.
    3 not fully installed or removed.
    Need to get 0 B/1368 kB of archives.
    After this operation, 2181 kB disk space will be freed.
    Do you want to continue? [Y/n] y
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = “zh_CN.UTF-8”,
    LC_ADDRESS = “zh_CN.UTF-8”,
    LC_MONETARY = “zh_CN.UTF-8”,
    LC_NUMERIC = “zh_CN.UTF-8”,
    LC_TELEPHONE = “zh_CN.UTF-8”,
    LC_IDENTIFICATION = “zh_CN.UTF-8”,
    LC_MEASUREMENT = “zh_CN.UTF-8”,
    LC_TIME = “zh_CN.UTF-8”,
    LC_NAME = “zh_CN.UTF-8”,
    LANG = “en_US.UTF-8”
    are supported and installed on your system.
    perl: warning: Falling back to the standard locale (“C”).
    locale: Cannot set LC_ALL to default locale: No such file or directory
    dpkg-deb: error: archive ‘/var/cache/apt/archives/libkmod2_24-1ubuntu3.4_amd64.deb’ has premature member ‘control.tar.xz’ before ‘control.tar.gz’, giving up
    dpkg: error processing archive /var/cache/apt/archives/libkmod2_24-1ubuntu3.4_amd64.deb (–unpack):
    subprocess dpkg-deb --control returned error exit status 2
    E: Sub-process /usr/bin/dpkg returned an error code (1)E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。解决方案
    各种依赖导致的安装失败,这个可能就是源的问题,替换镜像源链接即可。
    解决方案:
    (1)备份原镜像源文件:mv /etc/apt/sources.list /etc/apt/sources.list.bak;
    (2)创建编辑/etc/apt/sources.list新文件: sudo vim /etc/apt/sources.list ;
    (3)选择上面任一镜像源地址粘贴,保存退出;
    (4)修改后使用sudo apt-get update更新缓存,sudo apt-get upgrade升级包。如果有报错的及时删除后再更新就行了。
    ————————————————
    版权声明:本文为CSDN博主「桑榆非晚晚」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/ITerated/article/details/106947459

Ubuntu系统三种安装软件包的方法(apt/aptitude/deb命令)和常用的镜像源相关推荐

  1. 【系统收藏】分析Windows 8系统三种安装方式的利弊

    安装win 8系统不只有一种方法,一般来说想安装win 8系统你可以有三种选择方式,不过这三种方式都有些利弊,以下就是关于Windows 8系统安装三种方式的利弊分析. 三种常见的安装方式 1.把Wi ...

  2. 【分析Windows 8系统三种安装方式的利弊】

    安装win 8系统不只有一种方法,一般来说想安装win 8系统你可以有三种选择方式,不过这三种方式都有些利弊,以下就是关于Windows 8系统安装三种方式的利弊分析. 三种常见的安装方式 1.把Wi ...

  3. 三种安装httpd的方法

    rpm包管理工具 rpm rpm -q httpd 查看是否安装httpd rpm -qa 查看所有已安装的软件 rpm -ivh httpd-2- 安装httpd rpm -qi httpd 查看h ...

  4. mysql几种安装方法_mysql的三种安装方式(详细)

    安装MySQL的方式常见的有三种: rpm包形式 通用二进制形式 源码编译 1,rpm包形式 (1) 操作系统发行商提供的 (2) MySQL官方提供的(版本更新,修复了更多常见BUG)www.mys ...

  5. ubuntu安装mysql没反应_Ubuntu安装mysql三种安装方式

    三种安装方式: 1. 从网上安装 sudo apt-get install mysql-server.装完已经自动配置好环境变量,可以直接使用mysql的命令. 注:建议将/etc/apt/sourc ...

  6. win7计算机名怎么是感叹号,Win7系统wifi信号后出现感叹号怎么办 Win7连接wifi后出现感叹号三种原因和解决方法...

    Win7连接wifi出现感叹号,并且提示有限的访问权限,且无法上网.有什么办法能解决,让win7系统能够正常连接网络呢?针对Win7连接wifi信号后出现感叹号的问题,下面脚本之家的小编给大家讲解具体 ...

  7. Ubuntu系统---NVIDIA 驱动安装

    Ubuntu系统---NVIDIA 驱动安装 第一次安装"NVIDIA 驱动",小小的激动,因为终于可以玩GPU了.预想一块GPU,盼望太久,差点放弃,感谢J姐让我捡个漏.但是,第 ...

  8. CentOS7安装软件包的方法

    文章目录 一.rpm安装 1.查看系统中已安装的软件包 2.查看软件包的安装文件 3.安装/升级软件包 4.删除软件包 二.yum安装 1.yum的语法 2.yum的常用命令 3.示例 三.应用经验 ...

  9. linux 软件包的安装,linux安装软件包的方法

    Linux有多种发行版本,各种发行版本之间安装软件包的方法和命令不一样,同发行版本之间安装软件包的方法也有不同.Linux主要有三大派系:红帽子派系(Redhat.Centos.Oracle Linu ...

最新文章

  1. html像素和em转换,初识HTML(5)+CSS(3)-2020升级版 - 像素px:相对单位em:就是本元素给定字...
  2. 让 Python 更加充分的使用 Sqlite3
  3. c+gui语言可视化编程
  4. java执行python脚本并传递参数_从Java执行Python脚本存在参数传递问题
  5. Mybatis注解的方式,如何实现MySQL ,update后,返回更新后的值
  6. 原生js滚动到底部加载数据和下拉刷新 Scrollload
  7. Kubernetes - - k8s - v1.12.3 一键部署高可用 Prometheus 并实现邮件告警
  8. canopy java_在Windows上安装带有Enthought Canopy的Theano
  9. oracle votedisk ocr,Oracle 11gR2 RAC OCR和votingdisk故障恢复案例
  10. dataset lfw
  11. mac M1 IDEA配置SVN
  12. Android开源库:手把手教你实现一个简单好用的搜索框(含历史搜索记录)
  13. python爬虫入门基础知识_【PYTHON】【爬虫】关于python爬虫的一些基础知识
  14. 睡地板的女高管,也被马斯克裁了!推特丧心病狂的第八轮裁员来了
  15. python好用的编程工具
  16. android10热点验证身份,通过Android的AccountManager类进行Twitter身份验证
  17. H60-RS232自动售货机主板规格书
  18. gif动图制作软件下载(ScreenToGif)
  19. 实验三在git上操作遇到的一些问题
  20. 美颜算法原理,推荐一个开源美颜算法工具

热门文章

  1. mLife | 刘星吟等肠道菌群、基因变异和饮食互作介导孤独症的发生
  2. 解决CSS position:fixed 抖动问题
  3. Gradle Builds Everything——Task 实例
  4. 报错:C1189#error: The <experimental/filesystem> header providing std::ex………………
  5. SSRF(服务器请求伪造)
  6. js 二维数组降一维数组
  7. 2BizBox API开发教程
  8. 芯片设计服务器配置,从AMD的“小芯片”设计,谈谈平衡的内存配置
  9. Maven入门,读这篇文章就够了
  10. c语言多维指针,C语言中多维数组和多维数组指针的应用