Generate the shortest possible apt-get install command to duplicate installation?
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
1
down vote
favorite
As part of a larger backup-restore scheme, I'm trying to get a concise list of an ubuntu 16.04 server's installed packages. I want the list to be as short as possible and potentially be useful even five years later on a new LTS version of ubuntu.
Consider the following scenario:
Day 1: I install ubuntu 16.04 server on a machine.
Day 2: I install php-fpm
Day 3: I install nginx
, php
, and sendmail
Day 4: I install atanks
. No, I don't know why I'm installing a graphical game on a headless server. The point is just to add more stuff which was manually installed to apt's database.
Day 5:
My server explodes in a fiery inferno. Maybe a tank explosion had something to do with it. In any case, I need to create a new server based on the backup.
In my backup script, I'd like to be able to generate the following line based on my apt-get activity over the past few days:
apt-get install atanks nginx php php-fpm sendmail
So how do we do that?
First, I tried some apt queries,
apt-mark showmanual
but they seemed to list hundreds of packages more than I had manually installed.
Second, I found debfoster
:
Right after installing ubuntu, I'd run:
sudo apt-get update
sudo apt-get -y install debfoster
sudo debfoster -q
sudo cp /var/lib/debfoster/keepers ~/startkeepers
And normal server operations could continue. I or other users of the server might install any number of packages.
In my backup script, I'd have the following:
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) > apt-get.list
And then I could restore on a new install with:
apt-get install -y $(cat apt-get.list)
Unfortunately, this method isn't working perfectly due to different packages either installing or not installing certain reccommends.
When after storing startkeepers
, I run
sudo apt-get install -y nginx php-fpm python-certbot-nginx sendmail composer php-mbstring php-xml php-zip php-mysql
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) | tr ' ' 'n'
This last line has the following output:
composer
php-fpm
php-mbstring
php-mysql
php-xml
php-zip
python-certbot-nginx
sendmail
This is missing... nginx!!! That freaked me out, but then I realized that nginx
must be a dependency of python-certbot-nginx
, and I confirmed that. So maybe this method would work after all?
I ran sudo apt-get upgrade
on my test server and the output remained unchanged after using
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) | tr ' ' 'n'
However, on my real server, the one I'm trying to configure this scripted duplication for, there are an additional two lines in it that I don't think should be there:
linux-headers-4.4.0-112-generic
linux-image-4.4.0-112-generic
I didn't manually install those... And don't want to install them on another server, unless whoever determined they were necessary does so again. Could it have been apt-update?
TLDR; What's a reliable way to keep track of a server-version agnostic list of manually installed packages, where manually means stuff the user knows about installing, not were installed by upgrades or however linux headers and kernel versions get installed? Anything that improves my process would be appreciated, bonus points for using apt tools instead of debfoster
, considering its developers claim apt supports all of its features.
apt server bash package-management backup
add a comment |Â
up vote
1
down vote
favorite
As part of a larger backup-restore scheme, I'm trying to get a concise list of an ubuntu 16.04 server's installed packages. I want the list to be as short as possible and potentially be useful even five years later on a new LTS version of ubuntu.
Consider the following scenario:
Day 1: I install ubuntu 16.04 server on a machine.
Day 2: I install php-fpm
Day 3: I install nginx
, php
, and sendmail
Day 4: I install atanks
. No, I don't know why I'm installing a graphical game on a headless server. The point is just to add more stuff which was manually installed to apt's database.
Day 5:
My server explodes in a fiery inferno. Maybe a tank explosion had something to do with it. In any case, I need to create a new server based on the backup.
In my backup script, I'd like to be able to generate the following line based on my apt-get activity over the past few days:
apt-get install atanks nginx php php-fpm sendmail
So how do we do that?
First, I tried some apt queries,
apt-mark showmanual
but they seemed to list hundreds of packages more than I had manually installed.
Second, I found debfoster
:
Right after installing ubuntu, I'd run:
sudo apt-get update
sudo apt-get -y install debfoster
sudo debfoster -q
sudo cp /var/lib/debfoster/keepers ~/startkeepers
And normal server operations could continue. I or other users of the server might install any number of packages.
In my backup script, I'd have the following:
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) > apt-get.list
And then I could restore on a new install with:
apt-get install -y $(cat apt-get.list)
Unfortunately, this method isn't working perfectly due to different packages either installing or not installing certain reccommends.
When after storing startkeepers
, I run
sudo apt-get install -y nginx php-fpm python-certbot-nginx sendmail composer php-mbstring php-xml php-zip php-mysql
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) | tr ' ' 'n'
This last line has the following output:
composer
php-fpm
php-mbstring
php-mysql
php-xml
php-zip
python-certbot-nginx
sendmail
This is missing... nginx!!! That freaked me out, but then I realized that nginx
must be a dependency of python-certbot-nginx
, and I confirmed that. So maybe this method would work after all?
I ran sudo apt-get upgrade
on my test server and the output remained unchanged after using
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) | tr ' ' 'n'
However, on my real server, the one I'm trying to configure this scripted duplication for, there are an additional two lines in it that I don't think should be there:
linux-headers-4.4.0-112-generic
linux-image-4.4.0-112-generic
I didn't manually install those... And don't want to install them on another server, unless whoever determined they were necessary does so again. Could it have been apt-update?
TLDR; What's a reliable way to keep track of a server-version agnostic list of manually installed packages, where manually means stuff the user knows about installing, not were installed by upgrades or however linux headers and kernel versions get installed? Anything that improves my process would be appreciated, bonus points for using apt tools instead of debfoster
, considering its developers claim apt supports all of its features.
apt server bash package-management backup
The reliable way is to write down the list of programs as you install them.
â dsstorefile1
Feb 27 at 6:29
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
As part of a larger backup-restore scheme, I'm trying to get a concise list of an ubuntu 16.04 server's installed packages. I want the list to be as short as possible and potentially be useful even five years later on a new LTS version of ubuntu.
Consider the following scenario:
Day 1: I install ubuntu 16.04 server on a machine.
Day 2: I install php-fpm
Day 3: I install nginx
, php
, and sendmail
Day 4: I install atanks
. No, I don't know why I'm installing a graphical game on a headless server. The point is just to add more stuff which was manually installed to apt's database.
Day 5:
My server explodes in a fiery inferno. Maybe a tank explosion had something to do with it. In any case, I need to create a new server based on the backup.
In my backup script, I'd like to be able to generate the following line based on my apt-get activity over the past few days:
apt-get install atanks nginx php php-fpm sendmail
So how do we do that?
First, I tried some apt queries,
apt-mark showmanual
but they seemed to list hundreds of packages more than I had manually installed.
Second, I found debfoster
:
Right after installing ubuntu, I'd run:
sudo apt-get update
sudo apt-get -y install debfoster
sudo debfoster -q
sudo cp /var/lib/debfoster/keepers ~/startkeepers
And normal server operations could continue. I or other users of the server might install any number of packages.
In my backup script, I'd have the following:
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) > apt-get.list
And then I could restore on a new install with:
apt-get install -y $(cat apt-get.list)
Unfortunately, this method isn't working perfectly due to different packages either installing or not installing certain reccommends.
When after storing startkeepers
, I run
sudo apt-get install -y nginx php-fpm python-certbot-nginx sendmail composer php-mbstring php-xml php-zip php-mysql
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) | tr ' ' 'n'
This last line has the following output:
composer
php-fpm
php-mbstring
php-mysql
php-xml
php-zip
python-certbot-nginx
sendmail
This is missing... nginx!!! That freaked me out, but then I realized that nginx
must be a dependency of python-certbot-nginx
, and I confirmed that. So maybe this method would work after all?
I ran sudo apt-get upgrade
on my test server and the output remained unchanged after using
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) | tr ' ' 'n'
However, on my real server, the one I'm trying to configure this scripted duplication for, there are an additional two lines in it that I don't think should be there:
linux-headers-4.4.0-112-generic
linux-image-4.4.0-112-generic
I didn't manually install those... And don't want to install them on another server, unless whoever determined they were necessary does so again. Could it have been apt-update?
TLDR; What's a reliable way to keep track of a server-version agnostic list of manually installed packages, where manually means stuff the user knows about installing, not were installed by upgrades or however linux headers and kernel versions get installed? Anything that improves my process would be appreciated, bonus points for using apt tools instead of debfoster
, considering its developers claim apt supports all of its features.
apt server bash package-management backup
As part of a larger backup-restore scheme, I'm trying to get a concise list of an ubuntu 16.04 server's installed packages. I want the list to be as short as possible and potentially be useful even five years later on a new LTS version of ubuntu.
Consider the following scenario:
Day 1: I install ubuntu 16.04 server on a machine.
Day 2: I install php-fpm
Day 3: I install nginx
, php
, and sendmail
Day 4: I install atanks
. No, I don't know why I'm installing a graphical game on a headless server. The point is just to add more stuff which was manually installed to apt's database.
Day 5:
My server explodes in a fiery inferno. Maybe a tank explosion had something to do with it. In any case, I need to create a new server based on the backup.
In my backup script, I'd like to be able to generate the following line based on my apt-get activity over the past few days:
apt-get install atanks nginx php php-fpm sendmail
So how do we do that?
First, I tried some apt queries,
apt-mark showmanual
but they seemed to list hundreds of packages more than I had manually installed.
Second, I found debfoster
:
Right after installing ubuntu, I'd run:
sudo apt-get update
sudo apt-get -y install debfoster
sudo debfoster -q
sudo cp /var/lib/debfoster/keepers ~/startkeepers
And normal server operations could continue. I or other users of the server might install any number of packages.
In my backup script, I'd have the following:
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) > apt-get.list
And then I could restore on a new install with:
apt-get install -y $(cat apt-get.list)
Unfortunately, this method isn't working perfectly due to different packages either installing or not installing certain reccommends.
When after storing startkeepers
, I run
sudo apt-get install -y nginx php-fpm python-certbot-nginx sendmail composer php-mbstring php-xml php-zip php-mysql
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) | tr ' ' 'n'
This last line has the following output:
composer
php-fpm
php-mbstring
php-mysql
php-xml
php-zip
python-certbot-nginx
sendmail
This is missing... nginx!!! That freaked me out, but then I realized that nginx
must be a dependency of python-certbot-nginx
, and I confirmed that. So maybe this method would work after all?
I ran sudo apt-get upgrade
on my test server and the output remained unchanged after using
sudo debfoster -q
sudo echo $(diff --new-line-format="" --unchanged-line-format="" /var/lib/debfoster/keepers ~/startkeepers) | tr ' ' 'n'
However, on my real server, the one I'm trying to configure this scripted duplication for, there are an additional two lines in it that I don't think should be there:
linux-headers-4.4.0-112-generic
linux-image-4.4.0-112-generic
I didn't manually install those... And don't want to install them on another server, unless whoever determined they were necessary does so again. Could it have been apt-update?
TLDR; What's a reliable way to keep track of a server-version agnostic list of manually installed packages, where manually means stuff the user knows about installing, not were installed by upgrades or however linux headers and kernel versions get installed? Anything that improves my process would be appreciated, bonus points for using apt tools instead of debfoster
, considering its developers claim apt supports all of its features.
apt server bash package-management backup
apt server bash package-management backup
edited Feb 27 at 5:56
asked Feb 27 at 5:15
Menasheh
200113
200113
The reliable way is to write down the list of programs as you install them.
â dsstorefile1
Feb 27 at 6:29
add a comment |Â
The reliable way is to write down the list of programs as you install them.
â dsstorefile1
Feb 27 at 6:29
The reliable way is to write down the list of programs as you install them.
â dsstorefile1
Feb 27 at 6:29
The reliable way is to write down the list of programs as you install them.
â dsstorefile1
Feb 27 at 6:29
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1010170%2fgenerate-the-shortest-possible-apt-get-install-command-to-duplicate-installation%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
The reliable way is to write down the list of programs as you install them.
â dsstorefile1
Feb 27 at 6:29