Tuesday, September 29, 2009

Como salvar a lista de pacotes no ubuntu e usar ela para re-instalação posterior.

Várias vezes passamos pelo problema de querer ter duas máquinas com a mesma instalação do linux (ubuntu, no caso) ou de simplesmente recuperar a instalação padrão anterior.

Para isso rode o comando:

sudo dpkg --get-selections | grep -v deinstall > packagelist

Esse comando salvará o nome de todos os pacotes instalados no arquivo packagelist.

Depois abra o synaptic, com o comando:

sudo synaptic

Agora, vá em file depois em read markings e selecione o arquivo packagelist e pronto, é só clicar em instalar.

Espero que estas dicas sejam úteis.

Segue abaixo uma descrição do problema e de soluções "alternativas" a esta.
fonte: http://www.inportb.com/wp/

___________________________________________________________________


HOW TO: on Ubuntu, save the package list and use it to
reinstall packages later

(This tutorial will work for any Debian-based system,
including Ubuntu.)

Have you ever wanted to save a list of software
installed on a Debian box and reinstall the same
packages after reinstalling Debian? Have you ever
wanted to install on a Debian box the same software
you have installed on another Debian box? I've
recently had to reinstall my system from scratch, and
the following may help you as well.

(This is also posted on my blog at
http://www.inportb.com/wp/)


Generate the Package List

Let's first save the current package selection states:

Quote
$ dpkg --get-selections | grep -v deinstall > packagelist

Now we have a compact list of installed packages in a
file called "packagelist". Let's store this so that we
could retrieve it from our other Debian installation.
Or we could email it to ourselves using mailx:

Quote
$ cat packagelist | mailx -s "packagelist" user@example.com


Reinstall the Packages

To restore our packages, let's first restore the
package selection states:

Quote
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo dpkg --set-selections < packagelist

Now let's actually install it all:

Quote
$ sudo apt-get -u dselect-upgrade


Restore the System

What if we wanted to restore our system to an earlier
state by installing everything that's on our list and
uninstalling everything that's not? We can do that
too, but we need to be careful because this may entail
a radical change. Before restoring our package
selection states, we're going to deselect every
package, thereby marking them for uninstallation:

Quote
$ sudo dpkg --clear-selections
$ sudo dpkg --set-selections < packagelist

Now, every package not on our list has been deselected
and everything on our list has been selected. Let's
commit the changes:

Quote
$ sudo apt-get -u dselect-upgrade

If we wanted to remove the configuration files of the
uninstalled packages, we'd do the following instead:

Quote
$ sudo apt-get -u dselect-upgrade --purge

Please don't forget to restore the package selection
states before running apt-get, or the whole system
would be uninstalled!

No comments:

Post a Comment

 
Locations of visitors to this page