# Installing software from host to Jail



## ligregni (May 30, 2010)

Hi!, this time I have an easy one

I have installed some software in my host system, and I then created a Jail, it is working fine, but, the only thing I can't do is install software from packages and/or ports in the Jail since I have not yet configured internet access from the Jail. I think there is a better way to install software I have previously installed in the host system, isn't it?, to put in numbers:

Host system: Java Virtual Machine installed
Jail SD: I want here to install the JVM
Jail temp: I want here to install the JVM too

Do I have to perform the installation three times??? (one previously done and two more for each Jail), is there another way like copying the files (or the distfiles from ports and then perform the make install in the Jail)???

Thanks for the help!!!


----------



## Carpetsmoker (May 30, 2010)

You can use DESTDIR, see http://forums.freebsd.org/showthread.php?t=14592
Make sure the required directories (/usr/ports, and the build dir if you changed that) are accessible inside the chroot.

Or you can use packages (make package).


----------



## SirDice (May 31, 2010)

You can create packages with `# make package` or with portmaster/portupgrade. You can also do a make on the host, mount /usr/ports using nullfs to the jail and do the make install there. 


```
mount -t nullfs /usr/ports /jail/j1/usr/ports
```

No real need to have multiple copies of the ports tree around


----------



## expl (May 31, 2010)

Fastest way to install a package to the jail (ran from outside of it) would be :
`# pkg_add -C /jail/j1 -r package_name`


----------



## reddy (Aug 27, 2017)

SirDice said:


> You can create packages with `# make package` or with portmaster/portupgrade. You can also do a make on the host, mount /usr/ports using nullfs to the jail and do the make install there.
> 
> 
> ```
> ...



What is the difference between using nullfs and creating a symbolic link ?


----------



## getopt (Aug 27, 2017)

reddy said:


> What is the difference between using nullfs and creating a symbolic link ?


From mount_nullfs(8):


> The primary differences between a virtual copy of the file system and a symbolic link are that the getcwd(3)   functions work correctly in the virtual copy, and that other file systems may be mounted on the virtual copy without affecting the original. ...


----------



## reddy (Aug 27, 2017)

getopt said:


> From mount_nullfs(8):



Many thanks, I checked nullfs(5) but stopped too early apparently


----------

