A. You need to use the mount_nullfs command. It creates a null layer, duplicating a sub-tree of the file system name space under another part of the global file system namespace. This allows existing files and directories to be accessed using a different pathname. You need to run this command outside jail.
Option #1: Mount ports in read write mode
Login as root and type the following command:# D=/jail/www
# mkdir -p $D/usr/ports
# mount_nullfs /usr/ports $D/usr/ports
# mount | sort
Now login to jail called www (jail id # 10):
# jls
# jexec 10 sh
Try to install apache22:
# cd /usr/ports
# cd www/apache22
# make install clean
Option #2: Mount ports in read only mode
As suggested by reader Mel, you can mount ports tree in read only mode. This may result into ports tree integrity in a long run.D=/jail/www
mkdir -p $D/usr/ports
mount_nullfs -o ro /usr/ports $D/usr/ports
Mount /var/distfiles in read-write mode:
# mkdir $D/var/distfiles
# mount_nullfs -o rw /usr/ports/distfiles $D/var/distfiles
Now install port called php5:
# cd /usr/ports/lang/php5
# make install clean WRKDIRPREFIX=/tmp
You need to set WRKDIRPREFIX as ports installed in read only mode. WRKDIRPREFIX specifies where to create any temporary files. You need to set WRKDIRPREFIX and variables as follows to make them a permanent settings in /etc/make.conf file:
WRKDIRPREFIX= /var/portsWhere,
DISTDIR= /var/ports/distfiles
PACKAGES= /var/ports/packages
- WRKDIRPREFIX : Where to create any temporary files.
- DISTDIR : Where to find/put distfiles.
- PACKAGES : Used only for the package target; the base directory for the packages tree, normally packages/ in PORTSDIR.
# mkdir -p /var/ports/{packages,distfiles}
No comments:
Post a Comment