asteway
September 27th, 2017, 02:27 PM
I used to believe apt saves .deb packages in /var/cache/apt/archives/ for future re/installation. So I installed a package using apt on Ubuntu server 16.04 LTS and saw the /var/cache/apt/archives dir was being populated as I expected.
$ apt install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl...
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-common all 5.7.19-0ubuntu0.16.04.1 [15.7 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 mariadb-common all 10.0.31-0ubuntu0.16.04.2 [16.0 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libdbi-perl amd64 1.634-1build1 [743 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libmysqlclient20 amd64 5.7.19-0ubuntu0.16.04.1 [809 kB]
$ ll /var/cache/apt/archives/
total 16036
drwxr-xr-x 3 root root 4096 Sep 27 15:57 ./
drwxr-xr-x 3 root root 4096 Sep 27 15:49 ../
-rw-r--r-- 1 root root 6356 Oct 24 2015 libaio1_0.3.110-2_amd64.deb
-rw-r--r-- 1 root root 84350 Oct 13 2016 libdbd-mysql-perl_4.033-1ubuntu0.1_amd64.deb
-rw-r--r-- 1 root root 743276 Dec 17 2015 libdbi-perl_1.634-1build1_amd64.deb
-rw-r--r-- 1 root root 86074 Jan 22 2016 libhtml-parser-perl_3.72-1_amd64.deb
-rw-r--r-- 1 root root 13536 May 3 2008 libhtml-tagset-perl_3.20-2_all.deb
-rw-r--r-- 1 root root 809294 Jul 20 20:03 libmysqlclient20_5.7.19-0ubuntu0.16.04.1_amd64.deb
-rw-r--r-- 1 root root 27194 Dec 17 2015 libterm-readkey-perl_2.33-1build1_amd64.deb
-rw-r--r-- 1 root root 76914 Jan 13 2016 liburi-perl_1.71-1_all.deb
-rw-r----- 1 root root 0 Aug 1 14:18 lock
-rw-r--r-- 1 root root 1177754 Aug 4 04:19 mariadb-client-10.0_10.0.31-0ubuntu0.16.04.2_amd64.deb
-rw-r--r-- 1 root root 4374642 Aug 4 04:19 mariadb-client-core-10.0_10.0.31-0ubuntu0.16.04.2_amd64.deb
-rw-r--r-- 1 root root 16042 Aug 4 04:19 mariadb-common_10.0.31-0ubuntu0.16.04.2_all.deb
-rw-r--r-- 1 root root 4155992 Aug 4 04:19 mariadb-server-10.0_10.0.31-0ubuntu0.16.04.2_amd64.deb
-rw-r--r-- 1 root root 4788682 Aug 4 04:19 mariadb-server-core-10.0_10.0.31-0ubuntu0.16.04.2_amd64.deb
-rw-r--r-- 1 root root 15676 Jul 20 20:03 mysql-common_5.7.19-0ubuntu0.16.04.1_all.deb
drwx------ 2 _apt root 4096 Sep 27 15:57 partial/
However, once the installation was done, these .deb files were removed automatically. It appears the cache/apt/archives dir was used as a local cache, as its name implies. So how do I save packages as apt downloads them? in RHEL/CentOS/Fedora I'd enable keepcache=1 in yum.conf and also reference a cache dir. Could there be anything similar in Ubuntu? like anything to enable in apt.conf???
$ apt install mariadb-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libaio1 libcgi-fast-perl libcgi-pm-perl libdbd-mysql-perl libdbi-perl...
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 mysql-common all 5.7.19-0ubuntu0.16.04.1 [15.7 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 mariadb-common all 10.0.31-0ubuntu0.16.04.2 [16.0 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 libdbi-perl amd64 1.634-1build1 [743 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 libmysqlclient20 amd64 5.7.19-0ubuntu0.16.04.1 [809 kB]
$ ll /var/cache/apt/archives/
total 16036
drwxr-xr-x 3 root root 4096 Sep 27 15:57 ./
drwxr-xr-x 3 root root 4096 Sep 27 15:49 ../
-rw-r--r-- 1 root root 6356 Oct 24 2015 libaio1_0.3.110-2_amd64.deb
-rw-r--r-- 1 root root 84350 Oct 13 2016 libdbd-mysql-perl_4.033-1ubuntu0.1_amd64.deb
-rw-r--r-- 1 root root 743276 Dec 17 2015 libdbi-perl_1.634-1build1_amd64.deb
-rw-r--r-- 1 root root 86074 Jan 22 2016 libhtml-parser-perl_3.72-1_amd64.deb
-rw-r--r-- 1 root root 13536 May 3 2008 libhtml-tagset-perl_3.20-2_all.deb
-rw-r--r-- 1 root root 809294 Jul 20 20:03 libmysqlclient20_5.7.19-0ubuntu0.16.04.1_amd64.deb
-rw-r--r-- 1 root root 27194 Dec 17 2015 libterm-readkey-perl_2.33-1build1_amd64.deb
-rw-r--r-- 1 root root 76914 Jan 13 2016 liburi-perl_1.71-1_all.deb
-rw-r----- 1 root root 0 Aug 1 14:18 lock
-rw-r--r-- 1 root root 1177754 Aug 4 04:19 mariadb-client-10.0_10.0.31-0ubuntu0.16.04.2_amd64.deb
-rw-r--r-- 1 root root 4374642 Aug 4 04:19 mariadb-client-core-10.0_10.0.31-0ubuntu0.16.04.2_amd64.deb
-rw-r--r-- 1 root root 16042 Aug 4 04:19 mariadb-common_10.0.31-0ubuntu0.16.04.2_all.deb
-rw-r--r-- 1 root root 4155992 Aug 4 04:19 mariadb-server-10.0_10.0.31-0ubuntu0.16.04.2_amd64.deb
-rw-r--r-- 1 root root 4788682 Aug 4 04:19 mariadb-server-core-10.0_10.0.31-0ubuntu0.16.04.2_amd64.deb
-rw-r--r-- 1 root root 15676 Jul 20 20:03 mysql-common_5.7.19-0ubuntu0.16.04.1_all.deb
drwx------ 2 _apt root 4096 Sep 27 15:57 partial/
However, once the installation was done, these .deb files were removed automatically. It appears the cache/apt/archives dir was used as a local cache, as its name implies. So how do I save packages as apt downloads them? in RHEL/CentOS/Fedora I'd enable keepcache=1 in yum.conf and also reference a cache dir. Could there be anything similar in Ubuntu? like anything to enable in apt.conf???