问题
I can use dpkg --get-selections | grep -v deinstall | cut -f 1 | tr '\n' ' ' > listpackages.txt
to fill a file with all my installed packages.
Is there a to install using dpkg or apt and reference the listpackages.txt file created above?
I want to be able to backup what I have installed as a package list, reinstall my distro and finally in one command install everything I had installed on the previous version.
-thanks u2!
回答1:
apt-get install `cat listpackages.txt`
回答2:
Use the --set-selections
flag to do this.
To export the package list from one system: dpkg --get-selections
followed by whatever filtering you want.
To re-import the list to another system, pipe it into dpkg --set-selections
, and then run aptitude install
. The dpkg --set-selections
command will only queue the install process; you then actually have to execute it.
来源:https://stackoverflow.com/questions/25688982/how-can-a-feed-a-file-list-into-dpkg-get