Ubuntu系统三种安装软件包的方法(apt/aptitude/deb命令)和常用的镜像源 您所在的位置:网站首页 软件升级包怎么安装教程 Ubuntu系统三种安装软件包的方法(apt/aptitude/deb命令)和常用的镜像源

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

#Ubuntu系统三种安装软件包的方法(apt/aptitude/deb命令)和常用的镜像源| 来源: 网络整理| 查看: 265

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

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 #检查是否有损坏的依赖

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 #安装包 sudo dpkg -r   #删除包 sudo dpkg -p   #彻底删除包(包括配置文件) 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升级包。如果有报错的及时删除后再更新就行了。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有