<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Guguweb - packages</title><link href="https://www.guguweb.com/" rel="alternate"></link><link href="https://www.guguweb.com/feeds/packages.atom.xml" rel="self"></link><id>https://www.guguweb.com/</id><updated>2022-01-07T11:48:54+01:00</updated><subtitle>Freelance developer and sysadmin</subtitle><entry><title>Backup and restore apt packages on Debian-Ubuntu</title><link href="https://www.guguweb.com/2018/07/24/backup-and-restore-apt-packages-on-debian-ubuntu/" rel="alternate"></link><published>2018-07-24T15:43:06+00:00</published><updated>2022-01-07T11:48:54+01:00</updated><author><name>Augusto Destrero</name></author><id>tag:www.guguweb.com,2018-07-24:/2018/07/24/backup-and-restore-apt-packages-on-debian-ubuntu/</id><summary type="html">&lt;p&gt;Suppose you want to install all the apt packages already installed on one server to another one.&lt;/p&gt;
&lt;p&gt;On the source machine execute the following commands to make a list of installed packages and their &amp;#8220;states&amp;#8221; (installed manually or automatically):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;sudo dpkg --get-selections &amp;amp;gt; pkgs_selection.lst
sudo apt-mark showauto &amp;amp;gt …&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Suppose you want to install all the apt packages already installed on one server to another one.&lt;/p&gt;
&lt;p&gt;On the source machine execute the following commands to make a list of installed packages and their &amp;#8220;states&amp;#8221; (installed manually or automatically):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;sudo dpkg --get-selections &amp;amp;gt; pkgs_selection.lst
sudo apt-mark showauto &amp;amp;gt; pkgs_auto.lst
sudo apt-mark showmanual &amp;amp;gt; pkgs_manual.lst
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Copy files &lt;strong&gt;pkgs_selection.lst&lt;/strong&gt;, &lt;strong&gt;pkgs_auto.lst&lt;/strong&gt; and &lt;strong&gt;pkgs_manual.lst&lt;/strong&gt; to the destination machine.&lt;/p&gt;
&lt;p&gt;On the destination machine execute the following commands to install the packages that are installed in the source machine and set the correct &amp;#8220;state&amp;#8221; for packages:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;sudo apt-get install dselect
sudo dselect update
sudo dpkg --set-selections &amp;amp;lt; pkgs_selection.lst
sudo apt-get dselect-upgrade
sudo apt-mark auto $(cat pkgs_auto.lst)
sudo apt-mark manual $(cat pkgs_manual.lst)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Bye!&lt;/p&gt;</content><category term="sysadmin"></category><category term="apt"></category><category term="backup"></category><category term="packages"></category></entry></feed>