Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Nov 2013 14:57:15 +0000
From:      Frank Leonhardt <frank2@fjl.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: Installing Java without enter FreeBSD Jail
Message-ID:  <5288D94B.9090301@fjl.co.uk>
In-Reply-To: <CACMhkcM3yG=XABVPYmHg%2BRHTtV37T0e5T=KVdF%2BRx_%2B_6x1LTg@mail.gmail.com>
References:  <CACMhkcM3yG=XABVPYmHg%2BRHTtV37T0e5T=KVdF%2BRx_%2B_6x1LTg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 16/11/2013 19:17, Hung Son Nguyen wrote:
> Hi,
>
> I plan to write a script that automatically create FreeBSD Jail with Java
> installed. But  I have problem when installing java. As I found on the
> internet, I have to install java using port collection, but how can I use
> port collection to install software without enter the Jail?
> Do we have another way to install java on FreeBSD?
>
> Many thanks,

First of all, you can install ports in a jail. You either copy the ports 
directory there, map the ports directory using mount_nullfs, to save 
disk space. This can either be r/w (but make sure only one instance is 
building at a time) or you can mount it r/o, and use the variables 
WRKDIRPREFIX, DISTDIR and PACKAGES to redirect the build mechanism to a 
r/w area inside the jail. You can set these conveniently in 
/etc/make.conf. If you leave distfiles r/o and make sure everything is 
already there then there is no need for each jail to download its own 
copy. If you want to make distillates r/w and you've mounted ports are 
r/o you CAN mount a r/w distfiles directory over the r/o one. e.g.:

mount_nullfs -o ro /usr/ports /data/jail1/usr/ports
mount_nullfs -o rw /usr/ports/distfiles /data/jail1/usr/distfiles

Or better,optionally copy teh distfiles in to /data/jail1/var... and in 
/data/jail1/etc/make.conf, add:
DISTDIR= /var/ports/distfiles



Secondly, there is more than one version of Java. The "old" one required 
several manual steps to overcome licensing restrictions - see 
/usr/ports/java/diablo-jdk16.

The latest releases have OpenJDK instead - /usr/ports/java/openjdk7

Java seems to need to compile every open-source package on the planet 
before it will build and install, so it could be easier to build it, and 
its dependencies, once and copy the resulting binaries directly in to 
every jail. Alternatively, compile the port and its dependencies and 
selectively copy the bits in /usr/ports that change in to every jail - 
then do the make install from the jail.

You do not need to go through all the buildworld stuff to create a jail. 
You can just copy the files from an installation in to the jail 
directory, as long as they are compatible with the kernel you're using.

Regards, Frank.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5288D94B.9090301>