ubuntu下载apt工具

芮雪风
2023-12-01

问题:

安装aptitude 后apt被自动替换/删除

下载地址:

http://security.ubuntu.com/ubuntu/pool/main/a/apt/

下载指引:

1.下载apt*.deb
2. 下载libapt-pkg.deb
3. 使用dpkg -i <*.deb> 恢复apt的使用

tips

选择与当前环境安装版本一致的deb包。
我通过dpkg -l(这个是l 就是L的小写) 查看其他包的版本是amd64 还是i386 来选择386还是amd64
具体依赖版本的话会报错:

root@localhost:~# dpkg -i apt_1.6.12ubuntu0.2_i386.deb
Selecting previously unselected package apt:i386.
(Reading database ... 74194 files and directories currently installed.)
Preparing to unpack apt_1.6.12ubuntu0.2_i386.deb ...
Unpacking apt:i386 (1.6.12ubuntu0.2) ...
dpkg: dependency problems prevent configuration of apt:i386:
 apt:i386 depends on libapt-pkg5.0 (>= 1.6.12ubuntu0.2).
 apt:i386 depends on libc6 (>= 2.15).
 apt:i386 depends on libgcc1 (>= 1:4.2).
 apt:i386 depends on libgnutls30 (>= 3.5.6).
 apt:i386 depends on libseccomp2 (>= 1.0.1).
 apt:i386 depends on libstdc++6 (>= 5.2).

dpkg: error processing package apt:i386 (--install):
 dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
Errors were encountered while processing:
 apt:i386

正确安装结果

root@localhost:~# dpkg -i apt_1.6.12ubuntu0.2_amd64.deb
(Reading database ... 74403 files and directories currently installed.)
Preparing to unpack apt_1.6.12ubuntu0.2_amd64.deb ...
Unpacking apt (1.6.12ubuntu0.2) over (1.6.12ubuntu0.2) ...
Setting up apt (1.6.12ubuntu0.2) ...
Created symlink /etc/systemd/system/timers.target.wants/apt-daily-upgrade.timer -> /lib/systemd/system/apt-daily-upgrade.timer.
Created symlink /etc/systemd/system/timers.target.wants/apt-daily.timer -> /lib/systemd/system/apt-daily.timer.
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...

 类似资料: