# Install packages from CD



## SI_KH (Dec 11, 2012)

Hi

I need to install the packages and ports through  cd.
How I can do this?
For example when I install xfce4 ,It is connected to a different sites 
and download many file and...
Is it possible to download all needs for install xfce4 and write them to a cd
Thereafter install xfce4 from cd?
If yes 
How I can find all needs for install a package or port ? 

For example Is there any way find out what the xfce4 needs to be installed?


----------



## sk8harddiefast (Dec 11, 2012)

If I understood right you need to backup your ports.
Make a clean install of your FreeBSD.
Install xorg and xfce4.
copy /var/db/pkg on a usb flashdisk.
Done!
Every time you make a clean install of FreeBSD copy pkg folder back to /var/db
Of course run

```
postsnap fetch update
portupgrade -af
```
to update/reinstall (or install if is a clean install) your ports witch is... xorg and xfce4


----------



## Beastie (Dec 11, 2012)

If you have the ports/packages already installed you can use pkg_create(1) to recreate the entire list as packages.


If you don't have them on your machine already...

Using packages you would only need the packages themselves: the .tbz files for the package + all its dependencies.
Using ports you would need both the ports tree as well as the "dist files" (the .tar.gz containing the source) of the port and all its dependencies.

I'd use packages if I were you. Once you have them all, you can burn them on a CD, mount the CD, cd to the appropriate directory and issue a single *pkg_add package_name-ver.s.i.o.n.tbz* command for the "main" package (e.g. *pkg_add xfce-4.10.tbz*). That's it.

You can find the list of dependencies here. For example Xfce needs all these. Note that this list includes both run dependencies as well as build dependencies so you may not need them all if you'll be using packages.
A better way is to download the meta package (e.g. for Xfce) and extract it.
You'll find a file called +CONTENTS that contains a list of all dependencies (every line starting with *@pkgdep*).
Using a script you can easily automate the process to create a list of all the files you need. Then you just prepend the URL of the repository FTP and fetch them, e.g. libxfce4util-4.10.0_1.tbz is located here if your using 8.x packages.
You can fetch multiple files using fetch(1) in a shell script loop or ftp/wget with the *-i* option.


----------

