FreeBSD 5 Jail Install Howto

-- hd [DateTime(2005-02-07T03:49:28Z)]

TableOfContents

前言

以前我写过一个文档,是讲述FreeBSD 4.x上安装Jail的Howto。这次梅劲松写了一个更新的文档,又加上这两天为大家安装测试服务器,所以更新一下以前的文档,让它更适用于FreeBSD 5.x,同时期待今年会推出的FreeBSD 6。 _

安装脚本

由梅劲松提供,主要是加入了参数行这一段:

if [ -z $4 ]; then
echo "specify dest dir such as $0 /some/dir servernick servername ipaddr"
exit
fi 

if [ ! -d $1 ]; then
echo "dest dir $1 does not exist, mkdir..."
mkdir -p $1
exit
fi
echo "Install a new jail into $1"

D=$1
echo $D
cd /usr/src
make installworld DESTDIR=$D
cd etc
make distribution DESTDIR=$D
cd $D
ln -sf dev/null kernel 

echo "Add config to /etc/rc.conf.local"
echo 'if you starting jail in system booting add jail_enable="YES" to /etc/rc.conf.local'
echo 'if you starting $3 in jail add $3 to jail_list variable in /etc/rc.conf.local'
echo 'jail_$2_hostname="$3"' >> /etc/rc.conf.local
echo 'jail_$2_ip="$4"' >> /etc/rc.conf.local
echo 'jail_$2_rootdir="$D"' >> /etc/rc.conf.local
echo 'jail_$2_exec="/bin/sh /etc/rc"' >> /etc/rc.conf.local
echo 'jail_$2_devfs_enable="YES"' >> /etc/rc.conf.local
echo 'jail_$2_devfs_ruleset="devfsrules_jail"' >> /etc/rc.conf.local