软件运行环境 POSIX POSIX:Portable Operating System Interface 可移植操作系统接口,定义了操作系统应该为应用程序 提供的接口标准,是 IEEE 为要在各种 UNIX 操作系统上运行的软件而定义的一系列 API 标准的总称。 Linux 和 windows 都要实现基本的 posix 标准,程序就在源代码级别可移植了
C 语言程序的实现过程 源代码->预处理->编译->汇编->链接
预处理:略 编译:将 C 转译成汇编 汇编:将汇编转译成机器指令 链接:调用链接器 ld 来链接程序运行需要的一大堆目标文件,以及所依赖的其它库文件,最后生成可执行文件
静态链接和动态链接
ldd 查看二进制程序所依赖的库文件
1 2 3 4 5 6 7 8 lujinkai@Z510:~$ ldd /bin/ls linux-vdso.so.1 (0x00007fff7ccf9000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007ffadd6d3000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffadd2e2000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ffadd070000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffadce6c000) /lib64/ld-linux-x86-64.so.2 (0x00007ffaddb1d000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffadcc4d000)
动态库路径的配置文件:
1 2 /etc/ld.so.conf /etc/ld.so.conf.d/*.conf
将配置文件规定的路径下的库文件加载到缓存文件(字典)
缓存文件(字典)
1 2 3 4 5 lujinkai@Z510:~$ ll /etc/ld.so.cache -rw-r--r-- 1 root root 81473 Aug 14 08:47 /etc/ld.so.cache lujinkai@Z510:~$ file !$ file /etc/ld.so.cache /etc/ld.so.cache: data
查看缓存文件(字典) 显示所有可用库文件名及文件路径映射关系
程序执行时会去 ld.so.cache 文件查找动态库的信息,所以如果有新的库文件,需要先执行 ldconfig 将新的库文件加载到 ld.so.cache
软件包 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 [root@centos7 /] [root@centos7 /] [root@centos7 /] [root@centos7 cd ] CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7 EFI images Packages RPM-GPG-KEY-CentOS-Testing-7 EULA isolinux repodata TRANS.TBL [root@centos7 cd ] [root@centos7 Packages] acl-2.2.51-15.el7.x86_64.rpm aic94xx-firmware-30-6.el7.noarch.rpm aide-0.15.1-13.el7.x86_64.rpm alsa-firmware-1.0.28-2.el7.noarch.rpm alsa-lib-1.1.8-1.el7.x86_64.rpm alsa-tools-firmware-1.1.0-1.el7.x86_64.rpm ... ... [root@centos7 Packages] -rwxr-xr-x 1 root root 215840 Nov 6 2016 ./usr/bin/zip -rwxr-xr-x 1 root root 100456 Nov 6 2016 ./usr/bin/zipcloak -rwxr-xr-x 1 root root 95984 Nov 6 2016 ./usr/bin/zipnote -rwxr-xr-x 1 root root 100096 Nov 6 2016 ./usr/bin/zipsplit drwxr-xr-x 2 root root 0 Nov 6 2016 ./usr/share/doc/zip-3.0 -rw-r--r-- 1 root root 210354 Jul 6 2008 ./usr/share/doc/zip-3.0/CHANGES -rw-r--r-- 1 root root 3412 Mar 4 2007 ./usr/share/doc/zip-3.0/LICENSE -rw-r--r-- 1 root root 12748 Jun 26 2008 ./usr/share/doc/zip-3.0/README -rw-r--r-- 1 root root 6430 Mar 26 2008 ./usr/share/doc/zip-3.0/README.CR -rw-r--r-- 1 root root 6675 Jun 13 2008 ./usr/share/doc/zip-3.0/TODO -rw-r--r-- 1 root root 15731 Jul 2 2008 ./usr/share/doc/zip-3.0/WHATSNEW -rw-r--r-- 1 root root 13167 Jun 13 2008 ./usr/share/doc/zip-3.0/WHERE -rw-r--r-- 1 root root 3395 Dec 14 1996 ./usr/share/doc/zip-3.0/algorith.txt -rw-r--r-- 1 root root 28496 Jun 17 2008 ./usr/share/man/man1/zip.1.gz -rw-r--r-- 1 root root 951 May 8 2008 ./usr/share/man/man1/zipcloak.1.gz -rw-r--r-- 1 root root 819 Nov 6 2016 ./usr/share/man/man1/zipnote.1.gz -rw-r--r-- 1 root root 619 Nov 6 2016 ./usr/share/man/man1/zipsplit.1.gz 1598 blocks
范例:统计 rpm 的架构类型及相应的包管理器
1 2 3 4 5 6 7 8 9 [root@centos7 Packages] 381 x86_64 65 noarch [root@centos7 Packages] 381 x86_64 65 noarch [root@centos7 Packages] 381 x86_64 65 noarch
包管理器
redhat:rpm 文件,rpm 包管理器
debian:deb 文件,dpkg 包管理器
/var/lib/rpm 当安装完一个包后,包的信息会存储到一个数据库中,这数据库中信息是所有包共享的,所以叫共享数据库:/var/lib/rpm,这里面记录了当前主机上安装好的各种 rpm 包,包括它们的名称、版本、依赖关系、功能说明、包安装后生成的各文件路径及校验码信息。
这个数据库很重要,一旦破坏,就无法安装卸载软件,当使用 rpm 安装软件的时候,会查询这个数据库,如果已经安装,就提示已安装。
获取包的途径 光盘:http://mirrors.163.com/centos/ https://mirrors.aliyun.com/centos/ http://mirrors.163.com/ubuntu-releases/ https://mirrors.aliyun.com/ubuntu-releases/
包管理器 rpm 安装、卸载、升级、查询、校验、数据库维护
安装 1 2 3 4 5 rpm -ivh PACKAGE_FILE... -i -v -h
卸载 1 2 3 4 rpm -e PACKAGE_FILE... [--nodeps] -e --nodeps
升级 1 2 3 4 5 6 rpm -Uvh PACKAGE_FILE... rpm -Fvh PACKAGE_FILE... -U -F --force
注意:
不要对内核做升级操作;Linux 支持多内核并存,因此直接安装新版本内核
如果原程序的配置文件被修改,升级时,新版本提供的同以配置文件不会直接覆盖,而是把新版本的配置文件重命名(filename.rpmnew)后保留
降级 在升级的命令上添加 –oldpackage 即可
1 2 rpm -Uvh --oldpackage PACKAGE_FILE... rpm -Fvh --oldpackage PACKAGE_FILE...
查询 1 rpm {-q|--query} [select-options] [query-options]
常用查询语法
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -q PACKAGE -qa | grep 'pattern' -qi PACKAGE -qc PACKAGE -ql PACKAGE -qd PACKAGE -q --scripts PACKAGE -qf file -qpi PACKAGE_FILE -qpl PACKAGE_FILE, ... -a -f -p rpmfile -c -d -i -l --scripts
校验 占位。。。
数据库维护 /var/lib/rpm
yum 和 dnf rpm 不能解决包的依赖关系,yum 和 dnf 可以,yum 适用 centos7,dnf 适用 centos8,以下只介绍 yum,dnf 也都一样
yum:服务器存放 rpm 包和包相关的元数据库
yum 实现过程:
先在 yum 服务器上创建 yum repository(仓库),在仓库中事先存储了众多 rpm 包,以及包的相关的元数据文件(放置于特定目录 repodata 下),当 yum 客户端利用 yum/dnf 工具进行安装时包时,会自动下载 repodata 中的元数据,查询远数据是否存在相关的包及依赖关系,自动从仓库中找到相关包下载并安装
yum 客户端配置 配置文件
1 2 /etc/yum.conf /etc/yum.repos.d/*.repo
/etc/yum.conf 这个文件不用动,如果要改,就改 /etc/yum.repos.d/
/etc/yum.repos.d/*.repo,每个 repo 文件都记录了不同的仓库
CentOS-Base.repo
访问 mirrorlist,返回的是多个 baseurl,所以可以不设置 mirrorlist,只设置 baseurl,可以设置多个 baseurl
1 2 3 4 5 6 7 8 9 10 11 12 failovermethod roundrobin priority enable gpgcheck gpgkey $releasever $arch $basearch $contentdir $YUM0 -$YUM9
什么是 epel? extra packages for enterprise linux,是基于 Fedora 的一个项目,为“红帽系”的操作系统提供额外的软件包,适用于 RHEL、CentOS 和 Scientific Linux,可以理解为是一个第三方源
常见 baseurl centos
1 2 3 4 http://mirrors.aliyun.com/centos/$releasever /os/$basearch / http://mirrors.163.com/centos/$releasever /os/$basearch / http://mirrors.huaweicloud.com/centos/$releasever /os/$basearch / http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever /os/$basearch /
epel centos7
1 2 3 http://mirrors.aliyun.com/epel/7/$basearch http://mirrors.huaweicloud.com/epel/7/$basearch http://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch
epel centos8
1 2 3 http://mirrors.aliyun.com/epel/8/Everything/$basearch http://mirrors.huaweicloud.com/epel/8/Everything/$basearch http://mirrors.tuna.tsinghua.edu.cn/epel/8/Everything/$basearch
注意:yum 仓库指向的路径一定必须是 repodata 目录所在目录
yum 命令 1 yum [options] [command ] [package ...]
options 1 2 3 4 5 6 7 -y -q --nogpgcheck --enablerepo=<repoid> --disablerepo=<repoid> --noplugins --showduplicates
command 在 centos8 中(centos7/6 不行),yum 然后 tab 可以列出 yum 部分常用的子命令,注意不是全部
详细的命令解析参考man dnf
或man yum
,但是 man 手册的内容太多了,我们只记 yum 的常用用法就可以了,毕竟 yum 只是用来解决编译安装的依赖问题。
以下是常用的子命令:
repolist 显示仓库列表
1 yum repolist [all|enabled|disabled]
list 显示程序包
1 2 3 yum list yum list [all | glob_exp1] [glob_exp2] [...] yum list {available|installed|updates} [glob_exp1] [...]
install and reinstall 安装和重新安装程序包
1 2 yum install package1 [package2] [...] yum reinstall package1 [package2] [...]
–downloadonly:只下载相关的 rpm 包,默认下载到 var/cache/yum/x86_64/7 目录下,不执行安装动作 –downloaddir=,–destdir=:配合–downloadonly,指定下载的路径,如果不存在则自动创建
remove or erase 卸载程序包
1 yum remove | erase package1 [package2] [...]
update and downgrade 检查可用升级
升级和降级
1 2 3 yum upgrade|update [package1] [package2] [...] yum upgrade-minimal yum downgrade package1 [package2] [...]
查看包的详细信息 info、provides|whatprovides、search、deplist、repoquery
查看指定的特性(可以是某文件)是由哪个程序包提供的
1 yum provides | whatprovides feature1 [feature2] [...]
主义文件要写全路径,而不是只是文件名,可以使用通配符,例如:yum provides */vsftpd.conf
以指定的关键字搜索程序包及 summary 信息
1 yum search string1 [string2] [...]
查看指定包所依赖的 capabilities:
1 yum deplist package1 [package2] [...]
扩展: centos8 查看未安装包的文件列表
1 2 dnf repoquery package dnf repoquery -l package
扩展: centos7 查看未安装包的文件列表
1 2 3 yum -y install yum-utils repoquery -q package repoquery -ql package
clean and makecache 清除/var/cache/yum 缓存
1 yum clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]
构建缓存
范例:
history 事务历史
centos7 及以前的版本日志
centos8 版本日志
1 2 /var/log/dnf.rpm.log /var/log/dnf.log
1 yum history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync |stats]
范例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [root@centos8 ~] ID | Command line | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 4 | install lrzsz | 2020-08-15 09:58 | Install | 1 3 | install -y autofs | 2020-08-15 09:05 | Install | 1 2 | install vim wget -y | 2020-08-15 08:03 | Install | 5 1 | | 2020-07-29 05:12 | Install | 455 EE [root@centos8 ~] Transaction ID : 4 Begin time : Sat 15 Aug 2020 09:58:11 AM EDT Begin rpmdb : 455:2fec96053059825d1e35cd07ef7f27130b90a171 End time : Sat 15 Aug 2020 09:58:11 AM EDT (0 seconds) End rpmdb : 456:d9d289d9345ad932d7563415cf622772184a6e92 User : root <root> Return-Code : Success Releasever : 8 Command Line : install lrzsz Packages Altered: Install lrzsz-0.12.20-43.el8.x86_64 @BaseOS
localinstall or install 安装及升级本地程序包
1 2 yum localinstall|install rpmfile1 [rpmfile2] [...] yum localupdate|update rpmfile1 [rpmfile2] [...]
查看包的安全警告 1 yum updateinfo --summary|--list|--info
包组管理相关 groupinstall、groupupdate、grouplist、groupremove、groupinfo
什么是软件包组? 简单说就是功能相对集中的软件包集合,例如,在初始安装 Linux 时没有安装图形界面,但后来发现需要图形界面的支持,这时可以手工安装图形界面软件组(Server with GUI、GNOME),这样就可以支持图形界面了。
1 2 3 4 5 yum grouplist [hidden] [groupwildcard] [...] yum groupinstall group1 [group2] [...] yum groupupdate group1 [group2] [...] yum groupremove group1 [group2] [...] yum groupinfo group1 [...]
实现私有 yum 仓库 服务端:
将远程仓库的 rpm 包和 meta 同步到本地
安装 http 或 https 或 ftp 或 file 服务,使客户端可以访问
客户端:
修改配置文件,将远程仓库地址修改为私有的仓库地址
具体实现:
服务端 服务端环境为 CentOS7,配置 yum 和 apt 私有仓库
创建目录
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [root@centos7 mirrors] /data/mirrors [root@centos7 mirrors] . ├── centos │ ├── 6 │ │ └── x86_64 │ ├── 7 │ │ └── x86_64 │ └── 8 │ └── x86_64 ├── epel │ ├── 6 │ │ └── x86_64 │ ├── 7 │ │ └── x86_64 │ └── 8 │ └── x86_64 └── ubuntu ├── 18.04 │ └── x86_64 └── 20.04 └── x86_64 19 directories, 0 files
安装 ngnix,配置路径
1 2 3 4 5 6 location /mirrors { root /data; autoindex on; autoindex_exact_size on; autoindex_localtime on; }
配置服务端的 yum 远程仓库国内的镜像源 centos7
1 2 3 4 5 6 7 8 9 10 11 [base] name=base repo baseurl=http://mirrors.aliyun.com/centos/$releasever /os/$basearch / http://mirrors.163.com/centos/$releasever /os/$basearch / http://mirrors.huaweicloud.com/centos/$releasever /os/$basearch / http://mirrors.tuna.tsinghua.edu.cn/centos/$releasever /os/$basearch / failovermethod=priority enabled=1 gpgcheck=0
ubuntu18.04
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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-proposed main restricted universe multiverse deb-src 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-backports main restricted universe multiverse
将远程仓库的 rpm 包和 meta 同步到本地 centos 使用 reposync,centos8 的 dnf 集成,centos7 来自 yum-utils;ubuntu 使用 apt-mirror,yum 无法安装这个命令,所以可以在 ubuntu 的机器上同步完后,拷贝到 centos 的机器上。如果服务端的环境是 ubuntu,apt 则可以直接安装 apt-mirror 和 reposync 命令。
1 dnf reposync --repoid=epel --download-metadata -p /data/mirrors/epel/7/x86_64
以上命令是把整个 epel 仓库同步过来,大约有一万多个包。 如果想自定义仓库,控制仓库中有哪些包,以及每个包的版本,可以使用yum install --downloadonly
下载 指定的 rpm 包,或者去官网等渠道下载想要的版本的包,将这些包放到指定目录下:/data/mirror/centos{6,7,8}/x86_64
, 然后执行createrepo /data/mirror/centos{6,7,8}/x86_64
即可生产元数据 repodata,当仓库的包有变动,重新执行createrepo
命令即可
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 [root@centos7 x86_64] [root@centos7 x86_64] total 17724 -rw-r--r--. 1 root root 105968 Aug 23 2019 apr-1.4.8-5.el7.x86_64.rpm -rw-r--r--. 1 root root 94132 Jul 4 2014 apr-util-1.5.2-6.el7.x86_64.rpm -rw-r--r--. 1 root root 2843664 Apr 4 04:53 httpd-2.4.6-93.el7.centos.x86_64.rpm -rw-r--r--. 1 root root 94308 Apr 4 04:53 httpd-tools-2.4.6-93.el7.centos.x86_64.rpm -rw-r--r--. 1 root root 49644 Jul 4 2014 libzip-0.10.1-8.el7.x86_64.rpm -rw-r--r--. 1 root root 31264 Jul 4 2014 mailcap-2.1.41-2.el7.noarch.rpm -rw-r--r--. 1 root root 9169616 Apr 4 05:01 mariadb-5.5.65-1.el7.x86_64.rpm -rw-r--r--. 1 root root 575413 Oct 4 2019 nginx-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 19857 Oct 4 2019 nginx-all-modules-1.16.1-1.el7.noarch.rpm -rw-r--r--. 1 root root 30445 Oct 4 2019 nginx-mod-http-image-filter-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 39849 Oct 4 2019 nginx-mod-http-perl-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 29613 Oct 4 2019 nginx-mod-http-xslt-filter-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 58301 Oct 4 2019 nginx-mod-mail-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 86465 Oct 4 2019 nginx-mod-stream-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 1421660 Apr 4 05:04 php-5.4.16-48.el7.x86_64.rpm -rw-r--r--. 1 root root 2880032 Apr 4 05:04 php-cli-5.4.16-48.el7.x86_64.rpm -rw-r--r--. 1 root root 578968 Apr 4 05:04 php-common-5.4.16-48.el7.x86_64.rpm [root@centos7 x86_64] Spawning worker 0 with 17 pkgs Workers Finished Saving Primary metadata Saving file lists metadata Saving other metadata Generating sqlite DBs Sqlite DBs complete [root@centos7 x86_64] total 17728 -rw-r--r--. 1 root root 105968 Aug 23 2019 apr-1.4.8-5.el7.x86_64.rpm -rw-r--r--. 1 root root 94132 Jul 4 2014 apr-util-1.5.2-6.el7.x86_64.rpm -rw-r--r--. 1 root root 2843664 Apr 4 04:53 httpd-2.4.6-93.el7.centos.x86_64.rpm -rw-r--r--. 1 root root 94308 Apr 4 04:53 httpd-tools-2.4.6-93.el7.centos.x86_64.rpm -rw-r--r--. 1 root root 49644 Jul 4 2014 libzip-0.10.1-8.el7.x86_64.rpm -rw-r--r--. 1 root root 31264 Jul 4 2014 mailcap-2.1.41-2.el7.noarch.rpm -rw-r--r--. 1 root root 9169616 Apr 4 05:01 mariadb-5.5.65-1.el7.x86_64.rpm -rw-r--r--. 1 root root 575413 Oct 4 2019 nginx-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 19857 Oct 4 2019 nginx-all-modules-1.16.1-1.el7.noarch.rpm -rw-r--r--. 1 root root 30445 Oct 4 2019 nginx-mod-http-image-filter-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 39849 Oct 4 2019 nginx-mod-http-perl-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 29613 Oct 4 2019 nginx-mod-http-xslt-filter-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 58301 Oct 4 2019 nginx-mod-mail-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 86465 Oct 4 2019 nginx-mod-stream-1.16.1-1.el7.x86_64.rpm -rw-r--r--. 1 root root 1421660 Apr 4 05:04 php-5.4.16-48.el7.x86_64.rpm -rw-r--r--. 1 root root 2880032 Apr 4 05:04 php-cli-5.4.16-48.el7.x86_64.rpm -rw-r--r--. 1 root root 578968 Apr 4 05:04 php-common-5.4.16-48.el7.x86_64.rpm drwxr-xr-x. 2 root root 4096 Aug 18 15:33 repodata
客户端
修改配置文件 /etc/yum.repos.d/base.repo
1 2 3 4 5 6 7 [base] name=base repo baseurl=http://10.0.0.100/mirrors/centos/7/x86_64 failovermethod=priority enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
重新生产缓存
1 yum clean all; yum makecache
Ubuntu 软件管理 Ubuntu 下,dpkg 类似 rpm,apt 类似 yum
dpkg 常见用法 安装
卸载,不建议,不自动卸载依赖于它的包
1 2 dpkg -r package dpkg -P package
列出当前已安装的包
显示该包的简要说明
列出该包的状态,包括详细信息,类似 rpm -qi
列出该包中所包含的文件,类似 rpm -ql
搜索包含 pattern 的包,类似 rpm –qf
列出 deb 包的内容,类似 rpm –qpl
解开 deb 包的内容
1 dpkg --unpack package.deb
apt apt 与 apt-get 有一些类似的命令选项,但它并不能完全向下兼容 apt-get 命令,也即可用 apt 替换部分 apt-get 系列命令,但不是全部
apt 命令
被取代的命令
命令的功能
apt install
apt-get install
安装软件包
apt remove
apt-get remove
移除软件包
apt purge
apt-get purge
移除软件包及配置文件
apt update
apt-get update
刷新存储库索引
apt upgrade
apt-get upgrade
升级所有可升级的软件包
apt autoremove
apt-get autoremove
自动删除不需要的包
apt full-upgrade
apt-get dist-upgrade
在升级软件包时自动处理依赖关系
apt search
apt-cache search
搜索应用程序
apt show
apt-cache show
显示安装细节
卸载软件包: 1 2 3 4 sudo apt purge package sudo apt autoremove sudo apt autoclean
删除缓存 1 2 3 sudo apt-get autoclean sudo apt-get autoremove sudo apt-get clean