I have tried aptbackup in the past with bad results so I did some research and found this alternative. The below instructions are from "kioskea, Sebastien, Orine and iPhoner."
This method will save all your packages in a text file, that well move to your computer. After updating and jailbreaking, we will import this text file into your iPhone.
Backing Up Your Packages
You need to have sbsettings on your phone as well.
Step 1: Launch MobileTerminal on your iPhone.
Step 2: Type the following command: dpkg -get-selections > installed-apps.txt
Step 3: The previous command line will save a text file in /var/mobile called installed-apps.txt. Save this file on your computer via SSH.
Reinstalling Your Packages
After updating your iPhone to a newer iOS, you will have to jailbreak again and install MobileTerminal, Sbsettings, aptbackup (for the command tools), openSSH in Cydia. Then follow these instructions.
Step 1: SSH into your iPhone and copy the installed-apps.txt file in /var/mobile.
Step 2: Type the following commands in MobileTerminal
* su
* alpine (which is the default password. Type your password if you changed it)
* dpkg -set-selections < installed-apps.txt
* apt-get dselect-upgrade
If you encounter any issue, type the following command: apt-get dselect-fix-missing-upgrade
Cydia will automatically reinstall all your packages.
(Usually the installed-apps.txt will install a lot of stuff that may be buggy on your new iOS, if run into trouble you may edit that txt file and replace the 'install' command bellow each suspicious package with 'deinstall'.)
Now in mobile terminal it will ask you to choose yes to complete the operation. MobileTerminal will now download and install all of your stuff. When it is done, I rebooted the phone and all my stuff was back on my phone just like it was before I restored! It worked AWESOME!! All of my settings and app data was retained and applied after the reboot.(it did take me a couple of times to get the commands right, just FYI)
Note, you should change your default password "alpine" to something else.
This method will save all your packages in a text file, that well move to your computer. After updating and jailbreaking, we will import this text file into your iPhone.
Backing Up Your Packages
You need to have sbsettings on your phone as well.
Step 1: Launch MobileTerminal on your iPhone.
Step 2: Type the following command: dpkg -get-selections > installed-apps.txt
Step 3: The previous command line will save a text file in /var/mobile called installed-apps.txt. Save this file on your computer via SSH.
Reinstalling Your Packages
After updating your iPhone to a newer iOS, you will have to jailbreak again and install MobileTerminal, Sbsettings, aptbackup (for the command tools), openSSH in Cydia. Then follow these instructions.
Step 1: SSH into your iPhone and copy the installed-apps.txt file in /var/mobile.
Step 2: Type the following commands in MobileTerminal
* su
* alpine (which is the default password. Type your password if you changed it)
* dpkg -set-selections < installed-apps.txt
* apt-get dselect-upgrade
If you encounter any issue, type the following command: apt-get dselect-fix-missing-upgrade
Cydia will automatically reinstall all your packages.
(Usually the installed-apps.txt will install a lot of stuff that may be buggy on your new iOS, if run into trouble you may edit that txt file and replace the 'install' command bellow each suspicious package with 'deinstall'.)
Now in mobile terminal it will ask you to choose yes to complete the operation. MobileTerminal will now download and install all of your stuff. When it is done, I rebooted the phone and all my stuff was back on my phone just like it was before I restored! It worked AWESOME!! All of my settings and app data was retained and applied after the reboot.(it did take me a couple of times to get the commands right, just FYI)
Note, you should change your default password "alpine" to something else.