# How to really restore packages with pkg backup?



## oxyaxion (Aug 11, 2014)

Hi all,

I'm trying to restore installed packages in a fresh FreeBSD install, from another server pkg database export.

`pkg backup -d file.db` and `pkg backup -r file.db`  only dumping / restoring database, indeed.

But how to "force" pkg to really install the pack_age_ list like the host-master configuration_?_


----------



## junovitch@ (Aug 12, 2014)

*Re: How to really restore packets with pkg backup ?*

`pkg upgrade -fy` would normally be what you are looking for to force a re-install of everything.  However, I don't know what would happen when you take a package database from one machine and put it on another since that doesn't appear to be what backing up the database is designed to do.


----------



## gkontos (Jan 8, 2016)

Excellent solution! Actually it is the only one that I have found so far for bootstrapping a new server with packages from a local repo. Assuming that you maintain a recent pkg.sql you can easily deploy a new server within minutes.


----------

