Is there a way to temporarily install packages?

Sometimes I find myself trying to make a project work and end up apt-get install'ing a lot of stuff that I never use again. Is there some sort of tool help prevent that kind of mess by either:

  1. akin to virtualenv + pip, put all installed packages in a little sandbox that can later be deleted.
  2. specify that libWIDGET should be considered dependency oftemporary_program even if it's not in the official repo
  3. set up a reminder so that 2 weeks after running apt-get install libWIDGET --temporary I'd get a little reminder that says "You installed libWIDGET 2 weeks ago, are you still using it?"

Thanks

Posted Jun 25, 2018, 6:20 PM UTC

2013
Linuxllc•

I test things all the time. I just install a Linux distro in Virtualbox. Play around, delete sometime soon. And start using another Linux distro and new packages. That's how I weed things I like and don't like. Keep on my primary if I like it.

There is times I might forget something I install and would like to go back to it again. I just list all packages install and go through it quick. If something I think I like to get rid of. I get rid of it.

With Debian;

dpkg --get-selections

https://www.faqforge.com/linux/how-to-list-installed-packages-on-debian/

I use Solus so my is this;

sudo eopkg li

10
Espinosidro•

You could use Timeshift and create a snapshot of your clean system then mess it up and if something breaks you can roll back to your snapshot.

4
testcase51OP•

Can you make that work if you want to keep some changes made in the meantime? i.e. Suppose I apt-get install libWIDGET-* on Monday, edit work_document.odf on Tuesday, and give up on the WIDGET-dependent project on Wednesday. Can I roll back to Monday's snapshot without losing changes to work_document.odf?

2
white_nrdy•

I mean, you could upload them to some remote, or throw it on a flash drive...

1
Espinosidro•

Timeshift doesn't backup or touch the /home folder by default.

That way only the system is backup and restored while your data is always intact.

Still I would recommend backing up important files somewhere else.

1
Saurap•

Docker.

3
M08Y•

Exactly

1
grepgop•

Can't you just install it in the /var/tmp directory? That directory will delete most things after 30 days, but if you're familiar with Linux Sysadmin you can change the settings so that it deletes it in whatever timeframe you need it to. Be careful though, because some packages are preset to delete after two weeks in /var/tmp.

1
mistralol•

You could use debootstrap to create a chroot and then just blow that away when your finished. Its typically used to build environments.

Have a look at something like pbuilder for example.

1
LoveandRockets•

That's kind of what snaps are for right? You can make your own. https://docs.snapcraft.io/build-snaps/

1
MurderShovel•

A couple people have said it different ways but you need something with snapshotting. Whether that’s a VM or not.

1
blade_junky•

Virtualbox or docker best way to do exactly what you're talking about

1