I currently use Debian Jessie and I would like to upgrade to Stretch, but I fear I would lose all the programs I installed on Jessie.
Is there a way to backup my programs and files before upgrading to Stretch?
I currently use Debian Jessie and I would like to upgrade to Stretch, but I fear I would lose all the programs I installed on Jessie.
Is there a way to backup my programs and files before upgrading to Stretch?
In short, you don't have to.
Upgrading debian means you change the name of the release in sources.list, then you run update/dist-upgrade and you're done.
Regarding programs, there are two situations:
1. Programs you've installed using Debian - you don't need to worry about these. All programs and dependencies are automatically upgraded. And, if there is no upgrade available for a certain package, it remains there, untouched by the upgrade process.
2. Programs you're installed separately - these are programs that you have installed independently of the Debian package system. There are several reasons for this: the program you use is not available on Debian, or you downloaded the source, compiled and installed it, or maybe it runs its own installation package, which ignores Debian. That is also fine, because the package system does not touch those programs, since they are installed in the "local" directories: "/usr/local", "/lib/local", and so on. Those programs - and their libraries - will also remain after the upgrade process. You may have to update them because some of their dependencies may get upgraded by Debian, but it's not the case for a backup before the upgrade.
If you really want to backup your programs, I suppose you can create an archive with all of /usr, /lib and /etc and keep it somewhere else:
# tar cvzf /root/backup.tar.gz /usr /lib /etc
But I must say, it's really unnecessary.
If all the programs are in repositories, you can just backup the list of installed packages (in case something goes wrong and you need to reinstall).
dpkg -l | egrep "^ii" | cut -d' ' -f3
dpkg -l shows all installed packages
egrep "^ii" removes those things, that only have residual configs and are not actually installed
cut -d' ' -f3 just removes other columns of the output
Of course these aren't the only things you should backup if you are doing a full-backup, but that was not requested so I am not mentioning these