I found this thread on the ubuntuforums titled: HOWTO: Make and restore apt cache backups.
apt's cache
When you install .deb
files on Ubuntu/Debian they get stored in the following directory, /var/cache/apt/archives/
. So you can copy them out of here at anytime if you want to keep them safe somewhere else. The files should be called FreeSWITCH*.deb
.
dpkg-repack
You can also make use of a tool called dpkg-repack
which will take an existing installed package and repackage it back into a .deb file.
dpkg-repack creates a .deb file out of a debian package that has
already been installed. If any changes have been made to the package
while it was unpacked (ie, files in /etc were modified), the new
package will inherit the changes.
This utility can make it easy to copy packages from one computer to
another, or to recreate packages that are installed on your system,
but no longer available elsewhere, or to store the current state of a
package before you upgrade it.
It can be installed like so, apt-get install dpkg-repack
.
NOTE: When repackaging packages, the resulting .deb
files will include any configuration files as they are on the system where the repackaging is being done, not the pristine versions of the config files that were originally included!
Example
Say I want to repackage the already installed bzip2
application.
$ sudo dpkg -l|grep bzip2
ii bzip2 1.0.6-4 amd64 high-quality block-sorting file compressor - utilities
The following command will package it:
$ sudo dpkg-repack bzip2
dpkg-deb: warning: './dpkg-repack-16687/DEBIAN/control' contains user-defined field 'Original-Maintainer'
dpkg-deb: warning: ignoring 1 warning about the control file(s)
dpkg-deb: building package `bzip2' in `./bzip2_1.0.6-4_amd64.deb'.
You can confirm the contents of the .deb
file like so:
$ sudo dpkg -c bzip2_1.0.6-4_amd64.deb |head -15
drwxr-xr-x root/root 0 2013-08-22 00:08 ./
drwxr-xr-x root/root 0 2013-08-22 00:08 ./bin/
-rwxr-xr-x root/root 31152 2012-08-03 12:30 ./bin/bunzip2
-rwxr-xr-x root/root 2140 2012-08-03 12:30 ./bin/bzdiff
-rwxr-xr-x root/root 4877 2012-08-03 12:30 ./bin/bzexe
-rwxr-xr-x root/root 3642 2012-08-03 12:30 ./bin/bzgrep
-rwxr-xr-x root/root 31152 2012-08-03 12:30 ./bin/bzcat
-rwxr-xr-x root/root 10376 2012-08-03 12:30 ./bin/bzip2recover
-rwxr-xr-x root/root 1297 2012-08-03 12:30 ./bin/bzmore
-rwxr-xr-x root/root 31152 2012-08-03 12:30 ./bin/bzip2
drwxr-xr-x root/root 0 2013-08-22 00:08 ./usr/
drwxr-xr-x root/root 0 2013-08-22 00:08 ./usr/share/
drwxr-xr-x root/root 0 2013-08-22 00:08 ./usr/share/man/
drwxr-xr-x root/root 0 2013-08-22 00:08 ./usr/share/man/man1/
-rw-r--r-- root/root 1873 2012-08-03 12:30 ./usr/share/man/man1/bzmore.1.gz
...
...