ubutnu如何安装指定版本软件,软件降级,软件默认不升级

ubutnu如何安装指定版本软件,软件降级,软件默认不升级

1.安装指定版本软件

(1)安装指定版本软件,首先查看系统支持多少个版本软件
xxx@xxx:~$ apt-cache madison typora 
    typora |    1.0.2-1 | https://typora.io/linux ./ Packages
    typora |    1.0.0-1 | https://typora.io/linux ./ Packages
    typora |  0.11.18-1 | https://typora.io/linux ./ Packages
    typora |  0.11.16-1 | https://typora.io/linux ./ Packages
    typora |  0.11.14-1 | https://typora.io/linux ./ Packages
    typora |   0.11.8-1 | https://typora.io/linux ./ Packages
    typora |   0.11.2-1 | https://typora.io/linux ./ Packages
    typora |  0.10.11-1 | https://typora.io/linux ./ Packages
    typora |   0.9.98-1 | https://typora.io/linux ./ Packages

其中typora为很好用的文档编辑器

(2)安装列出软件中的一个版本
xxx@xxx:~$ sudo apt install typora=1.0.0-1

注意:如果是pip安装指定版本,则需要用双等于号’==’

2.软件降级

(1)类似于1中的做法选择旧的版本安装
xxx@xxx:~$ sudo apt install typora=1.0.0-1
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
下列软件包是自动安装的并且现在不需要了:
  linux-hwe-5.4-headers-5.4.0-73 linux-hwe-5.4-headers-5.4.0-77
  linux-hwe-5.4-headers-5.4.0-80 linux-hwe-5.4-headers-5.4.0-81
  linux-hwe-5.4-headers-5.4.0-84 linux-hwe-5.4-headers-5.4.0-86
  linux-hwe-5.4-headers-5.4.0-87 shim
使用'sudo apt autoremove'来卸载它(它们)。
建议安装:
  pandoc
下列软件包将被【降级】:
  typora
升级了 0 个软件包,新安装了 0 个软件包,降级了 1 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 70.3 MB 的归档。
解压缩后会消耗 0 B 的额外空间。
您希望继续执行吗? [Y/n] y
获取:1 https://typora.io/linux ./ typora 1.0.0-1 [70.3 MB]
已下载 70.3 MB,耗时 13秒 (5,535 kB/s)                                                 
dpkg: 警告: 即将把 typora 从 1.0.2-1 降级到 1.0.0-1
(正在读取数据库 ... 系统当前共安装有 368208 个文件和目录。)

1.0.2-1是最新版本,1.0.0-1是旧的版本,之所以要回到旧版,是因为最新的版本收费

(2)查看被安装的软件详情

安装详情

xxx@xxx:~$ dpkg -l typora 
期望状态=未知(u)/安装(i)/删除(r)/清除(p)/保持(h)
| 状态=未安装(n)/已安装(i)/仅存配置(c)/仅解压缩(U)/配置失败(F)/不完全安装(H)/触发器等待(W)/触发器未决(T)
|/ 错误?=(无)/须重装(R) (状态,错误:大写=故障)
||/ 名称             版本          体系结构      描述
+++-================-=============-=============-=====================================
ii  typora           1.0.0-1       amd64         a minimal Markdown reading & writing

安装目录

dair@dair:~$ dpkg -L typora 
/.
/usr
/usr/bin
/usr/share
/usr/share/applications
/usr/share/applications/typora.desktop
/usr/share/doc
/usr/share/doc/typora
/usr/share/doc/typora/copyright
/usr/share/icons
/usr/share/icons/hicolor
/usr/share/icons/hicolor/128x128
/usr/share/icons/hicolor/128x128/apps
/usr/share/icons/hicolor/128x128/apps/typora.png
/usr/share/icons/hicolor/256x256
/usr/share/icons/hicolor/256x256/apps
/usr/share/icons/hicolor/256x256/apps/typora.png
/usr/share/icons/hicolor/32x32
/usr/share/icons/hicolor/32x32/apps
/usr/share/icons/hicolor/32x32/apps/typora.png
/usr/share/icons/hicolor/64x64
/usr/share/icons/hicolor/64x64/apps
/usr/share/icons/hicolor/64x64/apps/typora.png
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/typora
/usr/share/typora

3.软件默认不升级

(1)软件包的锁定状态hold

要想软件被系统锁定不更新,就要将软件包的状态设置为hold

方法一:
xxx@xxx:~$ sudo apt-mark hold typora
typora 设置为保留。
方法二:
sudo echo typora hold | sudo dpkg --set-selections

查看锁定的软件包有哪些

xxx@xxx:~$ sudo dpkg --get-selections | grep hold
typora						hold

查看详情

dair@dair:~$ dpkg -l typora 
期望状态=未知(u)/安装(i)/删除(r)/清除(p)/保持(h)
| 状态=未安装(n)/已安装(i)/仅存配置(c)/仅解压缩(U)/配置失败(F)/不完全安装(H)/触发器等待(W)/触发器未决(T)
|/ 错误?=(无)/须重装(R) (状态,错误:大写=故障)
||/ 名称             版本          体系结构      描述
+++-================-=============-=============-=====================================
hi  typora           1.0.0-1       amd64         a minimal Markdown reading & writing 
dair@dair:~$ 

状态从ii变成了hi

(2)取消软件包的锁定状态
方法一:
xxx@xxx:~$ sudo apt-mark unhold typora
取消保留 typora 的设置。
方法二:
sudo echo typora install | sudo dpkg --set-selections
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值