Backup for Ports or Packages

Hi all, recently I have installed gimp, Virtualbox, Eclipse through pkg-install(8) command and a few more from ports collection. Now my questions is that can I backup these specific packages or ports in a dvd or usb backup tool from which I can install them later without internet connection? And one more thing to ask that can I backup kde desktop environment also as it takes a lot of time to download.
 
There (var/cache/pkg) are a lots of compresses packages how can I identify which one to select? And how to install them later?
 
You'd probably want to back up everything, since both the package and its dependencies get downloaded.

Packages can be installed by just specifying the path to the package archive with pkg install. You could also have a look at pkg-repo(8). Would make it much easier to reinstall should the need arise.[/cmd]
 
I found that
To create a package repository catalogue you must specify the top-level
directory where all the packages are stored as repo-path. pkg repo will
search the filesystem beneath repo-path to find all the packages it con-
tains. Directories starting with ".
"" or named Latest are not traversed.
But how to select a specific package or port and take a copy of them for further use?
 
I did this
pkg create -a
pkg repo .
and found a huge number of compressed folders of the whole system...... Don't know what to do next
 
I did this
pkg create -a
pkg repo .
and found a huge number of compressed folders of the whole system...... Don't know what to do next
You can set up a new repo for pkg(8):
Code:
poudriere: {
  url: "file:///usr/local/poudriere/data/packages/local-default",
  mirror_type: "NONE",
  signature_type: "none",
  enabled: yes
}

Put your directory in there and put the file in /usr/local/etc/pkg/repos. If you want to be able to use it on other computers, set up e.g. FTP server and for the repo config in /usr/local/etc/pkg/repos use:
Code:
poudriere: {
  url: "ftp://192.168.11.3/amd64-default-serwer",
  signature_type: "none",
  enabled: yes
}
 
actually FreeBSD is my primary os. On it I have installed Virtualbox and on Virtualbox again I have installed Freebsd. Now you see it is a very time consuming process to download every package and install them so I asked that if there is any way to take a copy of those basic packages to install them on the virtual machine. But i didn't understand that after creating the tar package Do i have to save them on a pendrive or dvd?
 
actually FreeBSD is my primary os. On it I have installed Virtualbox and on Virtualbox again I have installed Freebsd. Now you see it is a very time consuming process to download every package and install them so I asked that if there is any way to take a copy of those basic packages to install them on the virtual machine. But i didn't understand that after creating the tar package Do i have to save them on a pendrive or dvd?
You could just set up FTP/HTTP server and make the VM download the packages from the server.
 
can i setup a FTP/HTTP server on my machine i.e on the host machine?
It sounds like you don't need a permanent server for this. For example if you install devel/py-twisted you can run an ad-hoc server on the host whenever you need to install packages in your VMs with:
Code:
twistd -n web --path=/path/to/your/repository -p 8000
(This runs the server on port 8000, adjust your repository configuration accodingly.) If your finished you can kill it with Ctrl-C.

P.S.: Python's has a builtin HTTP server too which you can use with python2 -m SimpleHTTPServer. I usually use Twisted's web server for stuff like this because it supports resuming downloads. But that is probably not important here. :)
 
Instead of trying to go backwards (build a repository from an existing system), consider going forward (build new system from repository). You can do this on your host or in a 'special' virtual machine. It's going to be a time consuming job but once it's done you'll have a perfectly tuned offline package repository. Set up a build repository using ports-mgmt/poudriere or ports-mgmt/synth. You mentioned you had to build some ports because of certain options you needed? Both will allow you to set those in advance. Once the tool is finished building everything you need, share it using www/nginx (small, simple web server). Other VMs, and the host itself, can use this repository to install and/or update. You would only need internet access when the build tool does its job. It will download things once. It will build the port using your settings so your packages are all set to go. You can copy the repository to USB, CD or anywhere else you want.

Build once, install many :)
 
Back
Top