Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to synchronize my installations (and removals) between multiple PCs?

Preferably with dropbox - since I'm already using that to keep my files in sync.

I thought of an alias for the apt-get install and apt-get remove commands that stores the parameters to a file (one for install, one for remove) and another command that reads all the entries in the file and executes the respective command. Is this a realistic approach?

share|improve this question

5 Answers 5

up vote 6 down vote accepted

You could use puppet to create configuration files specifying which packages should be installed, and you could use Dropbox rather than a puppetmaster server to synchronise the puppet config between machines, plus a cron job to periodically run puppet and implement any config changes.

share|improve this answer
    
This is a great idea for a small number of machines. In a larger environment, you definitely should have a puppetmaster. Where I work we manage thousands of machines with puppet. –  Ed Manet Aug 14 '13 at 18:26

I don't know if there is a better way (there probably is), but depending on the scale you need, you could use aptitude's search feature for part of the machinery. It lets you search for packages matching a pattern. So, aptitude search '~i' gives you all installed packages

We need to go a step further, though. The packages manager likes to know which packages were directly requested by you and which ones were just pulled in because of other packages. Without that information, ugly stuff can happen. So, we can expand on that search pattern to select packages that are not automatically installed: aptitude search '!~M ~i'

The search feature is covered in some detail in Aptitude's reference manual.

Now, you have your list of packages to install. You can format the output as necessary by passing the -F flag to that command, like -F '%p' to get a list with just package names.


For example, you could run this on machine 1:

aptitude search '!~M ~i' | awk -F " " '{ print "apt-get -y install " $2 }' > aptshell.sh

Then copy the newly created aptshell.sh file over to machine 2 and and use this command on machine 2 to run it there:

sudo sh aptshell.sh

Then repeat the process, with the original machine 2 as the new machine 1, and the original machine 1 as the new machine 2. Now each machine has all the packages that were formerly only on the other.

share|improve this answer

This is an old question, but since no one has said it, you could possibly do something with dpkg and cron. Set up a cron job that does something clever with the get-selections and set-selections commands of dpkg.

dpkg --set-selections < ~/Dropbox/selections.dpkg


dpkg --get-selections > ~/Dropbox/selections.dpkg

This isn't a proposed solution, you'll have to work out some way to make sure that the selections.dpkg gets updated whenever you make a change on either computer...

share|improve this answer

Ubuntu Software Center has a feature for syncing installed packages among multiple computers. It uses your Ubuntu One account for saving packages. Just select File > Sync Between Computers... and login with your Ubuntu One account.

Syncing packages with Ubuntu Software Center

Currently it has somehow limited functionality, for example it only supports default packages (not ppas), and you must manually select which packages to install (this can be seen as a positive feature tough). For detailed instructions, see this article.

share|improve this answer

You won't be able to use dropbox to sync package installs.

Synaptic does have a way to save a package download list, but I'm not sure it handles the case of "everything that's ever been installed" rather than just "these are the packages I want to download this time"

share|improve this answer
    
-1 because your assumption is incorrect, the question describes a process to implement that, using a install/remove list, he is just asking if there is a realistic implementation, per the question description dropbox is just the medium used to exchange the synchronization lists –  João Pinto Jan 10 '11 at 16:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.