I'd like to output a list of all installed packages into a text file so that I can review it and bulk-install on another system. How would I do this?
|
Ubuntu 14.04 and aboveThe
Older VersionsTo get a list of packages installed locally do this in your terminal:
(The To get a list of a specific package installed:
To save that list to a text file called
Alternatively, simply use
(you don't need to run any of these commands as the superuser, so no |
|||||||||||||||||||||
|
|
Help out this community wiki - Add up-to-date solutions. dpkg, xargs, & apt-getThis command should accomplish the creation of a text file containing installed packages:
To accomplish the bulk installation of the listed packages you'll need to edit 'package_list.txt'. Remove the weird lines at the top of the file using a text editor. You can then use this command to install packages from the created file using:
apt-cache, xargs, & apt-getOnly use this method if you want all current packages to be installed using the list (which includes automatically installed, etc). Output the response of 'apt-cache pkgnames' to a file we'll simply name "package_list.txt". You can accomplish this with:
Then when you want to install packages from "package_list.txt" you would use this command:
apt-mark, xargs, & apt-getWe can use the command 'apt-mark showmanual' to give a list of packages that were manually or initially installed with Ubuntu. We'll want to output that to a file we'll just call "package-list.txt". Use this command to accomplish that:
The command we would use to install packages from the file "package_list.txt" is below.
Aptik Migration Utility
For information on Aptik, try visiting its official page, and for a screenshot click here or view the end of this section. Installing Aptik is simple. Follow these steps:
|
|||||||||
|
|
To list all packages intentionally installed (not as dependencies) by apt commands, run the following :
This provides a reverse time based view, with older commands listed first:
Installation data also showing synaptic usage, but without details (the same with installation date) :
providing the following:
|
|||||||||||||||||||||
|
|
To list all installed packages,
or
or
Note: |
||||
|
|
|
Or:
|
|||||||||||||
|
|
Create a backup of what packages are currently installed:
Then (on another system) restore installations from that list:
To get rid of stale packages:
To get installed like at backup time (i.e. to install packages set by
|
|||||||||||||||||
|
|
To save a list of installed packages to a file named
|
||||
|
|
man pages state:
So, it should just give a list of explicitly installed packages (though this includes packages that were part of the default initial install) without all of the dependencies included due to these packages being installed. To output the result into a text file:
|
|||||||||||||
|
|
You can look at the and you can get the list of the installed packages with just a command:
|
||||
|
|
APT-Clone is used by
How to Use
It make simple gzipped tar file which can be easily edited and reviewed before restoring on the other machines. Here an example of its structure:
|
|||
|
|
|
I'm surprised the
For more info, run **apt-cache is a low-level tool used to query information from APT's binary cache files Commands: gencaches - Build both the package and source cache showpkg - Show some general information for a single package showsrc - Show source records stats - Show some basic statistics dump - Show the entire file in a terse form dumpavail - Print an available file to stdout unmet - Show unmet dependencies search - Search the package list for a regex pattern show - Show a readable record for the package depends - Show raw dependency information for a package rdepends - Show reverse dependency information for a package pkgnames - List the names of all packages in the system dotty - Generate package graphs for GraphViz xvcg - Generate package graphs for xvcg policy - Show policy settings Options: -h This help text. -p=? The package cache. -s=? The source cache. -q Disable progress indicator. -i Show only important deps for the unmet command. -c=? Read this configuration file -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp See the apt-cache(8) and apt.conf(5) manual pages for more information. ** |
|||||||||
|
|
To get just the packages which were expressly installed (not just installed as dependencies), you can run
This will also include a brief description, which you may want. If not, use the option Yet another option seems to be to copy the file
|
|||||||||||||||||||||
|
|
There's a great explanation on Unix StackExchange that describes how to use aptitude to list packages not installed as dependencies, and how to compare that list with the list of default packages for your Ubuntu release. To obtain the manifest file for desktop versions of 12.04 and newer, visit this site, choose your release, and scroll down below the CD images to the files section. You'll find something like "ubuntu-12.04.4-desktop-amd64+mac.manifest" that matches your architecture. For server versions you'll need to obtain the manifest file from the ISO that was used to install the original system. For a VPS or cloud server, your provider may make the images available or you might need to contact them. Here's an example using the code from the referenced post, along with modifications to install on the new server. Old server (code from other post, output saved to file):
On the new server, copy the file using scp, then use sed to append 'install' to every line (-i performs an inline-replace). Then you can use the list as input to 'dpkg --set-selections' and install the packages with apt-get:
Before starting this task, I recommend reading and understanding all parts of the post mentioned in the beginning, and then consult the aptitude reference guide for details on search patterns. |
||||
|
|
|
There's also a tool called Aptik (both command line and GUI) which can help you view a list of all installed packages, with an option to select/unselect some of them, make a backup list, and then restore the same set of packages in another system. To install:
Further info: http://www.teejeetech.in/2014/04/aptik-v14.html
As can be seen in the screenshot, Aptik lets you also backup and restore PPAs, which will certainly be necessary to install some of the packages installed. |
|||
|
|
|
The below command will also lists all the installed packages,
|
|||||
|
|
For the complete rundown see: half way across the page:
|
|||
|
|
|
You want to reinstall the packages now there on 12.04, right? If so, it's very easy. You'll need an "Ubuntu Single Sign On account." (Create it before reinstalling so that your system is synced.)
|
|||||
|
|
I recommend using blueprint. Even though it is designed for servers, it can be also used from desktops as well. It will create a shell script/chef/puppet that you ca use to re-install all you packages. |
|||||
|
|
You can use Synaptic to save the current state of your installed packaged. In Synaptic, select "file/save markings", Enter the name of the file to save the state to, and make sure to check the "Save full state, not only changes" box. The file saved from this can be loaded into a new machine using "file/read markings" in Synaptic. |
|||
|
|
protected by Mitch♦ Nov 5 '14 at 12:53
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

