ubuntu系统仅下载自己需要的软件安装包不安装

apt-get -d download xxx #xxx是待下载的安装包
ubuntu下载软件安装包命令。仅仅下载deb格式的安装包,不安装。
/var/cache/apt/archives #下载后的安装包在此路径下

第一种方法:

root@VM-4-11-ubuntu:/var/cache/apt/archives# apt   -d download nginx
Get:1 http://mirrors.tencentyun.com/ubuntu bionic-security/main amd64 nginx all 1.14.0-0ubuntu1.10 [3,596 B]
Fetched 3,596 B in 0s (0 B/s)     
W: Download is performed unsandboxed as root as file '/var/cache/apt/archives/nginx_1.14.0-0ubuntu1.10_all.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
root@VM-4-11-ubuntu:/var/cache/apt/archives# ll
total 36
drwxr-xr-x 3 root root 24576 Sep 23 15:21 ./
drwxr-xr-x 3 root root  4096 Sep 23 15:16 ../
-rw-r----- 1 root root     0 Jul 25  2018 lock
-rw-r--r-- 1 root root  3596 Apr 12 22:28 nginx_1.14.0-0ubuntu1.10_all.deb
drwx------ 2 _apt root  4096 Sep 23 15:16 partial/

第二种方法:

sudo apt-get -d install xxx #xxx是待下载的安装包

ubuntu下载软件安装包命令。仅仅下载deb格式的安装包,不安装。
/var/cache/apt/archives #下载后的安装包在此路径下

root@VM-4-11-ubuntu:/var/cache/apt/archives# sudo apt-get -d install lrzsz #这里下载的是上传和下载的这个安装包
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  minicom
The following NEW packages will be installed:
  lrzsz
0 upgraded, 1 newly installed, 0 to remove and 138 not upgraded.
Need to get 74.8 kB of archives.
After this operation, 531 kB of additional disk space will be used.
Get:1 http://mirrors.tencentyun.com/ubuntu bionic-security/universe amd64 lrzsz amd64 0.12.21-10~build0.18.04.1 [74.8 kB]
Fetched 74.8 kB in 0s (4,789 kB/s)
Download complete and in download only mode
root@VM-4-11-ubuntu:/var/cache/apt/archives# ll
total 112
drwxr-xr-x 3 root root 24576 Sep 23 15:24 ./
drwxr-xr-x 3 root root  4096 Sep 23 15:24 ../
-rw-r----- 1 root root     0 Jul 25  2018 lock
-rw-r--r-- 1 root root 74772 Jan 30  2019 lrzsz_0.12.21-10~build0.18.04.1_amd64.deb
-rw-r--r-- 1 root root  3596 Apr 12 22:28 nginx_1.14.0-0ubuntu1.10_all.deb
drwx------ 2 _apt root  4096 Sep 23 15:24 partial/
root@VM-4-11-ubuntu:/var/cache/apt/archives# 

通过两种方法最后都下载了需要的安装包

root@VM-4-11-ubuntu:/var/cache/apt/archives# clear
root@VM-4-11-ubuntu:/var/cache/apt/archives# ls
lock  lrzsz_0.12.21-10~build0.18.04.1_amd64.deb  nginx_1.14.0-0ubuntu1.10_all.deb  partial
root@VM-4-11-ubuntu:/var/cache/apt/archives# pwd
/var/cache/apt/archives
root@VM-4-11-ubuntu:/var/cache/apt/archives# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_14910065

你的支持是我最大的努力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值