- 论坛徽章:
- 0
|
本帖最后由 xooass 于 2012-07-16 09:56 编辑
不错 非常感兴趣 应该是debian kFreeBSD内核版本的,
freebsd# cd /usr/ports/sysutils/debootstrap
freebsd# make install clean
freebsd# rehash
Create a directory for the jail, you may create this as a ZFS dataset, too.
freebsd# mkdir -p /jail/debian
Load necessary kernel modules:
freebsd# kldload fdescfs linprocfs linsysfs tmpfs
NOTE: Add these to /boot/loader.conf to run the jail on startup
Create a Debian (squeeze) distribution in the directory using debootstrap
freebsd# debootstrap squeeze /jail/debian http://cdn.debian.net/debian
Unmount filesystems mounted by debootstrap:
freebsd# umount /jail/debian/sys
freebsd# umount /jail/debian/dev/fd /jail/debian/dev
freebsd# umount /jail/debian/proc
Mount necessary filesystems:
freebsd# mount -t linprocfs linprocfs /jail/debian/proc
freebsd# mount -t linsysfs linsysfs /jail/debian/sys
freebsd# mount -t tmpfs tmpfs /jail/debian/lib/init/rw
NOTE: Add the filesystems to /etc/fstab to run the jail on startup, see "man fstab"
Configure the jail in your /etc/rc.conf, you may follow this example:
jail_enable="YES"
jail_list="debian"
jail_debian_rootdir="/jail/debian"
jail_debian_hostname="debian.home"
jail_debian_ip="127.0.0.1"
jail_debian_devfs_enable="YES"
jail_debian_exec_start="/etc/init.d/rc 3"
jail_debian_flags="-l -u root"
Replace 127.0.0.1 with an IP address on your system and debian.home with your desired jail hostname.
Edit /jail/debian/etc/resolv.conf or you may use your system resolv.conf, if you want:
freebsd# cp /etc/resolv.conf /jail/debian/etc/resolv.conf
Run your new jail (the /etc/rc.jail script starts rsyslog, cron and sshd inside the jail)
freebsd# /etc/rc.d/jail start debian
Use jls(8) to get the JID of your jail and jexec(8) to run /bin/bash inside:
freebsd# jls
JID IP Address Hostname Path
1 127.0.0.1 debian.home /jail/debian
freebsd# jexec 1 /bin/bash
Verify that you are under debian now:
root@debian:/# uname
GNU/kFreeBSD
Adjust your debian mirror in /etc/apt/sources.list (base system /jail/debian/etc/apt/sources.list)
Have fun with Debian GNU/kFreeBSD in a FreeBSD jail! (functionality may be limited)
|
|